Loading docs/source/ch03_packaging.rst +8 −4 Original line number Diff line number Diff line Loading @@ -59,11 +59,15 @@ Relative import --------------- When import a class / function within the same package, a ``relative import`` should be used instead of ``absolute import``. An example is below (``top_level_interface.py``): An example is below (``api.py``): .. code-block:: python from .flip_image import flip_image, read_test_image from .demo import a_demo_function, ADemoClass __all__ = ["flip_image", "read_test_image", "a_demo_function", "ADemoClass"] .. literalinclude:: ../../csst_proto/top_level_interface.py :linenos: :language: python .. note:: Note the ``.`` means it's a relative import. Loading Loading
docs/source/ch03_packaging.rst +8 −4 Original line number Diff line number Diff line Loading @@ -59,11 +59,15 @@ Relative import --------------- When import a class / function within the same package, a ``relative import`` should be used instead of ``absolute import``. An example is below (``top_level_interface.py``): An example is below (``api.py``): .. code-block:: python from .flip_image import flip_image, read_test_image from .demo import a_demo_function, ADemoClass __all__ = ["flip_image", "read_test_image", "a_demo_function", "ADemoClass"] .. literalinclude:: ../../csst_proto/top_level_interface.py :linenos: :language: python .. note:: Note the ``.`` means it's a relative import. Loading