Repository: pyccel/pyccel (python)

Issue:
Allow the user to do `from pyccel import epyccel`
### Describe the feature
I would like to be able to import `epyccel` directly from Pyccel.

### Test Code
Provide code which does not currently work but which should do when this issue is fixed:
```python
from pyccel import epyccel

def func():
     return 1

new_func = epyccel(func)
```

### Proposed Solution
The file `epyccel.py` should be moved to `pyccel/commands/epyccel.py` and `pyccel/__init__.py` should be modified to allow importing `epyccel` directly

### Pitfalls
This change will make the old code `from pyccel.epyccel import epyccel` invalid. Unfortunately it is not possible for the 2 syntaxes to exist. This change should therefore be made in the new major version (which is in preparation).

Pull request description:
Simplify `epyccel` import
Move `epyccel.py` to `pyccel/commands/` folder. This allows a shortcut to be introduced for the import of the most commonly used `epyccel` function. It is now possible to do `from pyccel import epyccel`. Fixes #1836.

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b6803082..b6631d23 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -41,6 +41,7 @@ All notable changes to this project will be documented in this file.
 
 ### Changed
 
+-   #1836 : Move `epyccel` module to `pyccel.commands.epyccel` and add support for shortcut import `from pyccel import epyccel`.
 -   #1720 : functions with the `@inline` decorator are no longer exposed to Python in the shared library.
 -   #1720 : Error raised when incompatible arguments are passed to an `inlined` function is now fatal.
 -   \[TESTS\] Filter out cast warnings in cast tests.
diff --git a/docs/quickstart.md b/docs/quickstart.md
index 8abc7d04..ccdf786c 100644
--- a/docs/quickstart.md
+++ b/docs/quickstart.md
@@ -393,7 +393,7 @@ end module mod
 In addition to the `pyccel` command, the Pyccel library provides the `epyccel` Python function, whose name stands for "embedded Pyccel": given a pure Python function `f` with type annotations, `epyccel` returns a "pyccelised" function `f_fast` that can be used in the same Python session.
 For example:
 ```python
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 from mod import f
 
 f_fast = epyccel(f)
@@ -434,7 +434,7 @@ Finally we compare the timings obtained on an Intel Core 3 architecture.
 ```bash
 In [1]: from numpy.random import random
 In [2]: from mod import quicksort
-In [3]: from pyccel.epyccel import epyccel
+In [3]: from pyccel import epyccel
 
 In [4]: quicksort_fast = epyccel(quicksort)
 In [5]: x = random(100)
diff --git a/pyccel/__init__.py b/pyccel/__init__.py
index ecc56a03..4703d5cd 100644
--- a/pyccel/__init__.py
+++ b/pyccel/__init__.py
@@ -1,2 +1,3 @@
 from .version import __version__
+from .commands.epyccel import epyccel
 from .commands.lambdify import lambdify
diff --git a/pyccel/epyccel.py b/pyccel/commands/epyccel.py
similarity index 95%
rename from pyccel/epyccel.py
rename to pyccel/commands/epyccel.py
index 88861a26..e18a467c 100644
--- a/pyccel/epyccel.py
+++ b/pyccel/commands/epyccel.py
@@ -3,7 +3,8 @@
 # This file is part of Pyccel which is released under MIT License. See the LICENSE file or #
 # go to https://github.com/pyccel/pyccel/blob/master/LICENSE for full license details.     #
 #------------------------------------------------------------------------------------------#
-
+""" File containing functions for calling Pyccel interactively (epyccel and epyccel_seq)
+"""
 
 import inspect
 import importlib
@@ -24,23 +25,37 @@ __all__ = ['get_source_function', 'epyccel_seq', 'epyccel']
 
 #==============================================================================
 def get_source_function(func):
+    """
+    Get the source code from a function.
+
+    Get a string containing the source code of a function from a function
+    object. Excessive indenting is stripped away.
+
+    Parameters
+    ----------
+    func : Function
+        A Python function.
+
+    Returns
+    -------
+    str
+        A string containing the source code.
+
+    Raises
+    ------
+    TypeError
+        A type error is raised if the object passed to the function is not
+        callable.
+    """
     if not callable(func):
         raise TypeError('Expecting a callable function')
 
-    lines = inspect.getsourcelines(func)
-    lines = lines[0]
+    lines, _ = inspect.getsourcelines(func)
     # remove indentation if the first line is indented
     a = lines[0]
     leading_spaces = len(a) - len(a.lstrip())
-    code = ''
-    for a in lines:
-        if leading_spaces > 0:
-            line = a[leading_spaces:]
-        else:
-            line = a
-        code = '{code}{line}'.format(code=code, line=line)
 
-    return code
+    return ''.join(a[leading_spaces:] for a in lines)
 
 #==============================================================================
 def get_unique_name(prefix, path):
diff --git a/pyccel/commands/lambdify.py b/pyccel/commands/lambdify.py
index 4d60c831..510bb1ae 100644
--- a/pyccel/commands/lambdify.py
+++ b/pyccel/commands/lambdify.py
@@ -5,7 +5,7 @@ SymPy expression into a Pyccel-accelerated function.
 import sympy as sp
 from packaging import version
 
-from pyccel.epyccel import epyccel
+from pyccel.commands.epyccel import epyccel
 from pyccel.utilities.strings import random_string
 
 if version.parse(sp.__version__) >= version.parse('1.8'):


Test patch:
diff --git a/tests/epyccel/recognised_functions/test_cmath_funcs.py b/tests/epyccel/recognised_functions/test_cmath_funcs.py
index 6558424f..51b40fa9 100644
--- a/tests/epyccel/recognised_functions/test_cmath_funcs.py
+++ b/tests/epyccel/recognised_functions/test_cmath_funcs.py
@@ -7,7 +7,7 @@ import pytest
 from numpy.random import rand, uniform
 from numpy import isclose
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 from pyccel.decorators import template
 
 RTOL = sys.float_info.epsilon*1000
diff --git a/tests/epyccel/recognised_functions/test_epyccel_pyc_math.py b/tests/epyccel/recognised_functions/test_epyccel_pyc_math.py
index 56728d1e..a73155c0 100644
--- a/tests/epyccel/recognised_functions/test_epyccel_pyc_math.py
+++ b/tests/epyccel/recognised_functions/test_epyccel_pyc_math.py
@@ -4,7 +4,7 @@ import pytest
 from numpy.random import randint, uniform
 from numpy import isclose
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 RTOL = 2e-14
 ATOL = 1e-15
diff --git a/tests/epyccel/recognised_functions/test_math_funcs.py b/tests/epyccel/recognised_functions/test_math_funcs.py
index c2b6e437..c49453aa 100644
--- a/tests/epyccel/recognised_functions/test_math_funcs.py
+++ b/tests/epyccel/recognised_functions/test_math_funcs.py
@@ -6,7 +6,7 @@ import pytest
 from numpy.random import rand, randint, uniform
 from numpy import isclose
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 from pyccel.decorators import template
 
 
diff --git a/tests/epyccel/recognised_functions/test_numpy_funcs.py b/tests/epyccel/recognised_functions/test_numpy_funcs.py
index 930f48e3..2642ff22 100644
--- a/tests/epyccel/recognised_functions/test_numpy_funcs.py
+++ b/tests/epyccel/recognised_functions/test_numpy_funcs.py
@@ -7,7 +7,7 @@ from numpy import isclose, iinfo, finfo, complex64, complex128
 import numpy as np
 
 from pyccel.decorators import template, types
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 min_int8 = iinfo('int8').min
 max_int8 = iinfo('int8').max
diff --git a/tests/epyccel/recognised_functions/test_numpy_types.py b/tests/epyccel/recognised_functions/test_numpy_types.py
index 01a28532..0a410a39 100644
--- a/tests/epyccel/recognised_functions/test_numpy_types.py
+++ b/tests/epyccel/recognised_functions/test_numpy_types.py
@@ -10,7 +10,7 @@ from test_numpy_funcs import max_float, min_float, max_float32, min_float32,max_
 from test_numpy_funcs import matching_types
 
 from pyccel.decorators import template
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 numpy_basic_types_deprecated = tuple(int(v) for v in np.version.version.split('.'))>=(1,24,0)
 
diff --git a/tests/epyccel/test_array_as_func_args.py b/tests/epyccel/test_array_as_func_args.py
index 879eadb9..0b651933 100644
--- a/tests/epyccel/test_array_as_func_args.py
+++ b/tests/epyccel/test_array_as_func_args.py
@@ -6,7 +6,7 @@ in the function arguments.
 import numpy as np
 from numpy.random import randint, uniform
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 from pyccel.decorators import template
 
 int_types = ['int8', 'int16', 'int32', 'int64']
diff --git a/tests/epyccel/test_arrays.py b/tests/epyccel/test_arrays.py
index 37bab0f1..fdac39bb 100644
--- a/tests/epyccel/test_arrays.py
+++ b/tests/epyccel/test_arrays.py
@@ -4,7 +4,7 @@ import numpy as np
 from numpy import iinfo, finfo
 from numpy.random import randint, uniform
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 from modules        import arrays
 
 RTOL = 1e-12
diff --git a/tests/epyccel/test_arrays_multiple_assignments.py b/tests/epyccel/test_arrays_multiple_assignments.py
index b7be052a..264b2234 100644
--- a/tests/epyccel/test_arrays_multiple_assignments.py
+++ b/tests/epyccel/test_arrays_multiple_assignments.py
@@ -4,7 +4,7 @@ import sys
 import warnings
 import pytest
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 from pyccel.decorators import stack_array
 from pyccel.errors.errors import Errors, PyccelSemanticError
 from pyccel.errors.messages import (ARRAY_REALLOCATION,
diff --git a/tests/epyccel/test_bitwise.py b/tests/epyccel/test_bitwise.py
index aa37294d..f90cdee5 100644
--- a/tests/epyccel/test_bitwise.py
+++ b/tests/epyccel/test_bitwise.py
@@ -1,7 +1,7 @@
 # pylint: disable=missing-function-docstring, missing-module-docstring
 import pytest
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 from modules import bitwise
 
 @pytest.mark.parametrize("a, b",[(True, False),(True, True)])
diff --git a/tests/epyccel/test_builtins.py b/tests/epyccel/test_builtins.py
index 6acab05f..bf3f583b 100644
--- a/tests/epyccel/test_builtins.py
+++ b/tests/epyccel/test_builtins.py
@@ -4,7 +4,7 @@ from numpy.random import randint, uniform
 from numpy import iinfo, finfo
 import numpy as np
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 from pyccel.decorators import template
 
 ATOL = 1e-15
diff --git a/tests/epyccel/test_class_expressions.py b/tests/epyccel/test_class_expressions.py
index 09bb4243..f89d75a4 100644
--- a/tests/epyccel/test_class_expressions.py
+++ b/tests/epyccel/test_class_expressions.py
@@ -2,7 +2,7 @@
 import numpy as np
 import pytest
 from numpy.random import randint
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 def test_complex_imag(language):
     def f():
diff --git a/tests/epyccel/test_default_precision_template.py b/tests/epyccel/test_default_precision_template.py
index 222f1019..e6325f02 100644
--- a/tests/epyccel/test_default_precision_template.py
+++ b/tests/epyccel/test_default_precision_template.py
@@ -4,7 +4,7 @@ from numpy.random import randint
 from numpy import isclose
 import numpy as np
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 from pyccel.decorators import template
 
 RTOL = 1e-12
diff --git a/tests/epyccel/test_docstrings.py b/tests/epyccel/test_docstrings.py
index 54a6e0c8..8e990d7c 100644
--- a/tests/epyccel/test_docstrings.py
+++ b/tests/epyccel/test_docstrings.py
@@ -1,5 +1,5 @@
 # pylint: disable=missing-function-docstring, missing-module-docstring
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 def pad_docstrings(python_doc, pyccel_doc):
     # Remove empty lines as ast does not preserve them
diff --git a/tests/epyccel/test_epyccel_IfTernaryOperator.py b/tests/epyccel/test_epyccel_IfTernaryOperator.py
index 1b55a627..6bf56480 100644
--- a/tests/epyccel/test_epyccel_IfTernaryOperator.py
+++ b/tests/epyccel/test_epyccel_IfTernaryOperator.py
@@ -2,7 +2,7 @@
 
 import pytest
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 # wp suffix means With Parentheses
 #------------------------------------------------------------------------------
 def test_f1(language):
diff --git a/tests/epyccel/test_epyccel_augassign.py b/tests/epyccel/test_epyccel_augassign.py
index 931f75e2..66b5fd47 100644
--- a/tests/epyccel/test_epyccel_augassign.py
+++ b/tests/epyccel/test_epyccel_augassign.py
@@ -4,7 +4,7 @@ from numpy.random import random
 import pytest
 
 import modules.augassign as mod
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 # += tests
 RTOL = 1e-12
diff --git a/tests/epyccel/test_epyccel_classes.py b/tests/epyccel/test_epyccel_classes.py
index bbca99c2..39098a24 100644
--- a/tests/epyccel/test_epyccel_classes.py
+++ b/tests/epyccel/test_epyccel_classes.py
@@ -2,7 +2,7 @@
 import pytest
 import numpy as np
 import modules.expose_classes as mod
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 RTOL = 2e-14
 ATOL = 1e-15
diff --git a/tests/epyccel/test_epyccel_complex_func.py b/tests/epyccel/test_epyccel_complex_func.py
index bc2fbd0b..cf037ca3 100644
--- a/tests/epyccel/test_epyccel_complex_func.py
+++ b/tests/epyccel/test_epyccel_complex_func.py
@@ -5,7 +5,7 @@ import pytest
 from numpy.random import rand, randint
 
 import modules.complex_func as mod
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 ATOL = 1e-15
 RTOL = 2e-14
diff --git a/tests/epyccel/test_epyccel_decorators.py b/tests/epyccel/test_epyccel_decorators.py
index dd5f7057..2fe345c2 100644
--- a/tests/epyccel/test_epyccel_decorators.py
+++ b/tests/epyccel/test_epyccel_decorators.py
@@ -3,7 +3,7 @@
 
 import pytest
 import numpy as np
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 from pyccel.decorators import private, inline, template
 
 @pytest.mark.parametrize( 'lang', (
diff --git a/tests/epyccel/test_epyccel_default_args.py b/tests/epyccel/test_epyccel_default_args.py
index 40ae26a7..256dc8b9 100644
--- a/tests/epyccel/test_epyccel_default_args.py
+++ b/tests/epyccel/test_epyccel_default_args.py
@@ -3,7 +3,7 @@
 import pytest
 import numpy as np
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 #------------------------------------------------------------------------------
 def test_f1(language):
diff --git a/tests/epyccel/test_epyccel_division.py b/tests/epyccel/test_epyccel_division.py
index 4fc46806..11aec7a2 100644
--- a/tests/epyccel/test_epyccel_division.py
+++ b/tests/epyccel/test_epyccel_division.py
@@ -2,7 +2,7 @@
 from numpy.random import randint, uniform
 from numpy import isclose
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 RTOL = 2e-14
 ATOL = 1e-15
diff --git a/tests/epyccel/test_epyccel_functions.py b/tests/epyccel/test_epyccel_functions.py
index bdc8bd1d..1860bc2b 100644
--- a/tests/epyccel/test_epyccel_functions.py
+++ b/tests/epyccel/test_epyccel_functions.py
@@ -5,7 +5,7 @@ import sys
 import pytest
 import numpy as np
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 RTOL = 2e-14
 ATOL = 1e-15
diff --git a/tests/epyccel/test_epyccel_garbage_collection.py b/tests/epyccel/test_epyccel_garbage_collection.py
index fcb0d355..3340cf61 100644
--- a/tests/epyccel/test_epyccel_garbage_collection.py
+++ b/tests/epyccel/test_epyccel_garbage_collection.py
@@ -2,7 +2,7 @@
 import gc
 import sys
 import numpy as np
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 def test_return_pointer(language):
     def return_pointer(x : 'float[:]'):
diff --git a/tests/epyccel/test_epyccel_generators.py b/tests/epyccel/test_epyccel_generators.py
index b8ab7769..15f352dc 100644
--- a/tests/epyccel/test_epyccel_generators.py
+++ b/tests/epyccel/test_epyccel_generators.py
@@ -3,7 +3,7 @@ import pytest
 import numpy as np
 from numpy.random import randint, rand
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 def test_sum_range(language):
     def f(a0 : 'int[:]'):
diff --git a/tests/epyccel/test_epyccel_headers.py b/tests/epyccel/test_epyccel_headers.py
index 08dfb54f..8fdb86c6 100644
--- a/tests/epyccel/test_epyccel_headers.py
+++ b/tests/epyccel/test_epyccel_headers.py
@@ -6,7 +6,7 @@ Once headers are deprecated this file can be removed.
 
 import pytest
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 from pyccel.errors.errors import PyccelSemanticError, Errors
 from pyccel.decorators import allow_negative_index, stack_array
 
diff --git a/tests/epyccel/test_epyccel_lists.py b/tests/epyccel/test_epyccel_lists.py
index 5fe655cd..50d1a753 100644
--- a/tests/epyccel/test_epyccel_lists.py
+++ b/tests/epyccel/test_epyccel_lists.py
@@ -1,7 +1,7 @@
 # pylint: disable=missing-function-docstring, missing-module-docstring
 import pytest
 import numpy as np
-from  pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 @pytest.fixture( params=[
         pytest.param("fortran", marks = [
diff --git a/tests/epyccel/test_epyccel_mod.py b/tests/epyccel/test_epyccel_mod.py
index c7a5f72f..d84ec174 100644
--- a/tests/epyccel/test_epyccel_mod.py
+++ b/tests/epyccel/test_epyccel_mod.py
@@ -4,7 +4,7 @@ import sys
 from numpy.random import randint, uniform
 from numpy import allclose
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 # Relative and absolute tolerances for array comparisons in the form
 # numpy.isclose(a, b, rtol, atol). Windows has larger round-off errors.
diff --git a/tests/epyccel/test_epyccel_modules.py b/tests/epyccel/test_epyccel_modules.py
index 963219e6..445e8dc4 100644
--- a/tests/epyccel/test_epyccel_modules.py
+++ b/tests/epyccel/test_epyccel_modules.py
@@ -1,6 +1,6 @@
 # pylint: disable=missing-function-docstring, missing-module-docstring
 import numpy as np
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 RTOL = 2e-14
 ATOL = 1e-15
diff --git a/tests/epyccel/test_epyccel_multi_rank.py b/tests/epyccel/test_epyccel_multi_rank.py
index 49959a31..ccad90c4 100644
--- a/tests/epyccel/test_epyccel_multi_rank.py
+++ b/tests/epyccel/test_epyccel_multi_rank.py
@@ -4,7 +4,7 @@ import numpy as np
 from numpy.random import rand, randint
 
 from modules        import multi_rank
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 @pytest.mark.parametrize('f1',[multi_rank.add_mixed_order,
     multi_rank.mul_mixed_order,
diff --git a/tests/epyccel/test_epyccel_openmp.py b/tests/epyccel/test_epyccel_openmp.py
index d7b2b8fd..5da3446a 100644
--- a/tests/epyccel/test_epyccel_openmp.py
+++ b/tests/epyccel/test_epyccel_openmp.py
@@ -8,7 +8,7 @@ import modules.openmp as openmp
 
 from numpy import random
 from numpy import matmul
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 #==============================================================================
 
 
diff --git a/tests/epyccel/test_epyccel_optional_args.py b/tests/epyccel/test_epyccel_optional_args.py
index a0f5071d..8836a965 100644
--- a/tests/epyccel/test_epyccel_optional_args.py
+++ b/tests/epyccel/test_epyccel_optional_args.py
@@ -3,7 +3,7 @@
 import pytest
 import numpy as np
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 RTOL = 2e-14
 ATOL = 1e-15
diff --git a/tests/epyccel/test_epyccel_pow.py b/tests/epyccel/test_epyccel_pow.py
index f0a55056..6cfda797 100644
--- a/tests/epyccel/test_epyccel_pow.py
+++ b/tests/epyccel/test_epyccel_pow.py
@@ -3,7 +3,7 @@ import sys
 from numpy.random import rand, randint, uniform
 from numpy import isclose
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 from pyccel.decorators import template
 
 RTOL = 2e-14
diff --git a/tests/epyccel/test_epyccel_python_annotations.py b/tests/epyccel/test_epyccel_python_annotations.py
index dfe2915f..85a40ed2 100644
--- a/tests/epyccel/test_epyccel_python_annotations.py
+++ b/tests/epyccel/test_epyccel_python_annotations.py
@@ -2,7 +2,7 @@
 import numpy as np
 from numpy.random import randint
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 from modules import python_annotations
 
 def test_array_int32_1d_scalar_add(language):
diff --git a/tests/epyccel/test_epyccel_return_arrays.py b/tests/epyccel/test_epyccel_return_arrays.py
index 90380026..08bb06db 100644
--- a/tests/epyccel/test_epyccel_return_arrays.py
+++ b/tests/epyccel/test_epyccel_return_arrays.py
@@ -6,7 +6,7 @@ import pytest
 from recognised_functions.test_numpy_funcs import (min_int, max_int, min_int8, max_int8,
                                 min_int16, max_int16, min_int32, max_int32, max_int64, min_int64)
 from recognised_functions.test_numpy_funcs import max_float, min_float, max_float32, min_float32,max_float64, min_float64
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 from pyccel.decorators import template
 
 
diff --git a/tests/epyccel/test_epyccel_sets.py b/tests/epyccel/test_epyccel_sets.py
index d467e9bd..ecae59a8 100644
--- a/tests/epyccel/test_epyccel_sets.py
+++ b/tests/epyccel/test_epyccel_sets.py
@@ -1,6 +1,6 @@
 # pylint: disable=missing-function-docstring, missing-module-docstring
 import pytest
-from  pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 @pytest.fixture( params=[
         pytest.param("fortran", marks = [
diff --git a/tests/epyccel/test_epyccel_sign.py b/tests/epyccel/test_epyccel_sign.py
index da23555c..f9976cb6 100644
--- a/tests/epyccel/test_epyccel_sign.py
+++ b/tests/epyccel/test_epyccel_sign.py
@@ -3,7 +3,7 @@
 import numpy as np
 import modules.numpy_sign as mod
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 def test_sign_complex(language):
     f_nul = mod.complex_nul
diff --git a/tests/epyccel/test_epyccel_transpose.py b/tests/epyccel/test_epyccel_transpose.py
index e01f007e..023fa9f3 100644
--- a/tests/epyccel/test_epyccel_transpose.py
+++ b/tests/epyccel/test_epyccel_transpose.py
@@ -2,7 +2,7 @@
 from numpy import empty, array_equal
 from numpy.random import randint
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 
 def test_transpose_shape(language):
diff --git a/tests/epyccel/test_epyccel_types.py b/tests/epyccel/test_epyccel_types.py
index 1f4b2a99..eb8dd330 100644
--- a/tests/epyccel/test_epyccel_types.py
+++ b/tests/epyccel/test_epyccel_types.py
@@ -4,7 +4,7 @@ import numpy as np
 from numpy.random import randint, uniform
 
 from modules import types
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 def test_int_default(language):
     f1 = types.test_int_default
diff --git a/tests/epyccel/test_epyccel_variable_annotations.py b/tests/epyccel/test_epyccel_variable_annotations.py
index 52a39918..5927f583 100644
--- a/tests/epyccel/test_epyccel_variable_annotations.py
+++ b/tests/epyccel/test_epyccel_variable_annotations.py
@@ -6,7 +6,7 @@ Once headers are deprecated this file can be removed.
 
 import pytest
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 from pyccel.errors.errors import PyccelSemanticError, Errors
 from pyccel.decorators import allow_negative_index, stack_array
 
diff --git a/tests/epyccel/test_external_functions.py b/tests/epyccel/test_external_functions.py
index 42e8e9d5..e96f29de 100644
--- a/tests/epyccel/test_external_functions.py
+++ b/tests/epyccel/test_external_functions.py
@@ -4,7 +4,7 @@ import pytest
 import numpy as np
 import scipy.linalg.blas as sp_blas
 import modules.external_functions as mod
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 # ==============================================================================
 @pytest.mark.fortran
diff --git a/tests/epyccel/test_function_call_before_definition.py b/tests/epyccel/test_function_call_before_definition.py
index 8f3a12b7..a35116da 100644
--- a/tests/epyccel/test_function_call_before_definition.py
+++ b/tests/epyccel/test_function_call_before_definition.py
@@ -3,7 +3,7 @@ import pytest
 import modules.function_call_before_definition as mod1
 import modules.function_call_before_definition_2 as mod2
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 @pytest.mark.parametrize( 'language', (
         pytest.param("fortran", marks = pytest.mark.fortran),
diff --git a/tests/epyccel/test_functionals.py b/tests/epyccel/test_functionals.py
index 81c9381f..f30c7d22 100644
--- a/tests/epyccel/test_functionals.py
+++ b/tests/epyccel/test_functionals.py
@@ -2,7 +2,7 @@
 from numpy.random import randint
 from numpy import equal
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 from modules import functionals
 
 def compare_epyccel(f, language, *args):
diff --git a/tests/epyccel/test_generic_functions.py b/tests/epyccel/test_generic_functions.py
index 6031cc7e..f751964b 100644
--- a/tests/epyccel/test_generic_functions.py
+++ b/tests/epyccel/test_generic_functions.py
@@ -3,7 +3,7 @@ import pytest
 import numpy as np
 import modules.generic_functions as mod
 import modules.generic_functions_2 as mod2
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 @pytest.fixture(scope="module")
 def modnew(language):
diff --git a/tests/epyccel/test_higherorder_functions.py b/tests/epyccel/test_higherorder_functions.py
index e0b002b4..9b1a5c1f 100644
--- a/tests/epyccel/test_higherorder_functions.py
+++ b/tests/epyccel/test_higherorder_functions.py
@@ -2,7 +2,7 @@
 import pytest
 import numpy as np
 import modules.highorder_functions as mod
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 @pytest.fixture(scope="module")
 def modnew(language):
diff --git a/tests/epyccel/test_imports.py b/tests/epyccel/test_imports.py
index 5ff8dc57..364d29b1 100644
--- a/tests/epyccel/test_imports.py
+++ b/tests/epyccel/test_imports.py
@@ -3,7 +3,7 @@
 import pytest
 from numpy import ones
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 #------------------------------------------------------------------------------
 @pytest.fixture(params=[
diff --git a/tests/epyccel/test_kind.py b/tests/epyccel/test_kind.py
index b5ee1c5d..d3e7f1e1 100644
--- a/tests/epyccel/test_kind.py
+++ b/tests/epyccel/test_kind.py
@@ -1,6 +1,6 @@
 # pylint: disable=missing-function-docstring, missing-module-docstring
 import platform
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 def test_or_boolean(language):
     def or_bool(a : 'bool', b : 'bool'):
diff --git a/tests/epyccel/test_loops.py b/tests/epyccel/test_loops.py
index 85987a19..3b24578f 100644
--- a/tests/epyccel/test_loops.py
+++ b/tests/epyccel/test_loops.py
@@ -2,8 +2,9 @@
 import pytest
 import numpy as np
 
-from pyccel.epyccel import epyccel
-from modules        import loops
+from modules import loops
+
+from pyccel import epyccel
 
 #==============================================================================
 
diff --git a/tests/epyccel/test_mpi_collective.py b/tests/epyccel/test_mpi_collective.py
index eb4bd58d..0f3a8140 100644
--- a/tests/epyccel/test_mpi_collective.py
+++ b/tests/epyccel/test_mpi_collective.py
@@ -3,7 +3,7 @@ from mpi4py import MPI
 import numpy as np
 import pytest
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 from modules        import mpi_collective as pmod
 
 #==============================================================================
diff --git a/tests/epyccel/test_mpi_point_to_point.py b/tests/epyccel/test_mpi_point_to_point.py
index ad8c786d..bbd2bf44 100644
--- a/tests/epyccel/test_mpi_point_to_point.py
+++ b/tests/epyccel/test_mpi_point_to_point.py
@@ -3,8 +3,9 @@ from mpi4py import MPI
 import numpy as np
 import pytest
 
-from pyccel.epyccel import epyccel
-from modules        import mpi_point_to_point as pmod
+from modules import mpi_point_to_point as pmod
+
+from pyccel import epyccel
 
 #==============================================================================
 # IMPORT MODULE TO BE TESTED, EPYCCELIZE IT, AND MAKE IT AVAILABLE TO ALL PROCS
diff --git a/tests/epyccel/test_multiple_results.py b/tests/epyccel/test_multiple_results.py
index 4ed797c8..175964b4 100644
--- a/tests/epyccel/test_multiple_results.py
+++ b/tests/epyccel/test_multiple_results.py
@@ -1,6 +1,6 @@
 # pylint: disable=missing-function-docstring, missing-module-docstring
 from pyccel.decorators import pure
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 #==============================================================================
 def compare_epyccel(f1, *args, language):
diff --git a/tests/epyccel/test_parallel_epyccel.py b/tests/epyccel/test_parallel_epyccel.py
index 0711fb8c..403f4c6e 100644
--- a/tests/epyccel/test_parallel_epyccel.py
+++ b/tests/epyccel/test_parallel_epyccel.py
@@ -3,7 +3,7 @@ from mpi4py import MPI
 import pytest
 import numpy as np
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 RTOL = 2e-14
 ATOL = 1e-15
diff --git a/tests/epyccel/test_pointers.py b/tests/epyccel/test_pointers.py
index 2778fe9f..27fdc65d 100644
--- a/tests/epyccel/test_pointers.py
+++ b/tests/epyccel/test_pointers.py
@@ -5,7 +5,7 @@ import numpy as np
 
 from modules import pointers as pointers_module
 from modules import return_pointers
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 pointers_funcs = [(f, getattr(pointers_module,f)) for f in pointers_module.__all__ if inspect.isfunction(getattr(pointers_module,f))]
 
diff --git a/tests/epyccel/test_return.py b/tests/epyccel/test_return.py
index eb5c7fd4..ce0300b6 100644
--- a/tests/epyccel/test_return.py
+++ b/tests/epyccel/test_return.py
@@ -1,6 +1,6 @@
 # pylint: disable=missing-function-docstring, missing-module-docstring, reimported
 import numpy as np
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 def test_single_return_var_assign(language):
     def single_return_var_assign():
diff --git a/tests/epyccel/test_strings.py b/tests/epyccel/test_strings.py
index de642438..3e06bd59 100644
--- a/tests/epyccel/test_strings.py
+++ b/tests/epyccel/test_strings.py
@@ -2,7 +2,7 @@
 import inspect
 import pytest
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 from modules import strings as strings_module
 
 string_funcs = [(f, getattr(strings_module,f)) for f in strings_module.__all__ if inspect.isfunction(getattr(strings_module,f))]
diff --git a/tests/epyccel/test_tuples.py b/tests/epyccel/test_tuples.py
index 29b889aa..33a2bf83 100644
--- a/tests/epyccel/test_tuples.py
+++ b/tests/epyccel/test_tuples.py
@@ -3,7 +3,7 @@ import inspect
 import pytest
 import numpy as np
 
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 from modules import tuples as tuples_module
 
 def is_func_with_0_args(f):
diff --git a/tests/epyccel/utilities.py b/tests/epyccel/utilities.py
index f714a14f..ee4a9e79 100644
--- a/tests/epyccel/utilities.py
+++ b/tests/epyccel/utilities.py
@@ -1,6 +1,6 @@
 # pylint: disable=missing-function-docstring, missing-module-docstring
 import numpy as np
-from pyccel.epyccel import epyccel
+from pyccel import epyccel
 
 
 #==============================================================================
diff --git a/tests/warnings/test_warnings.py b/tests/warnings/test_warnings.py
index 8ce9b895..fd0b6e43 100644
--- a/tests/warnings/test_warnings.py
+++ b/tests/warnings/test_warnings.py
@@ -14,7 +14,7 @@ from wrapper import HIGH_ORDER_FUNCTIONS_IN_CLASS_FUNCS
 from pyccel.parser.parser   import Parser
 from pyccel.codegen.codegen import Codegen
 from pyccel.errors.errors   import Errors
-from pyccel.epyccel         import epyccel
+from pyccel                 import epyccel
 
 def get_files_from_folder(foldername):
     base_dir = os.path.dirname(os.path.realpath(__file__))