From bc6377c8049e22371453e54535fb78d643a79382 Mon Sep 17 00:00:00 2001 From: Evan Kohilas Date: Mon, 18 Nov 2024 23:18:37 +1100 Subject: [PATCH 1/3] note an alternative for running src packages locally. --- source/discussions/src-layout-vs-flat-layout.rst | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/source/discussions/src-layout-vs-flat-layout.rst b/source/discussions/src-layout-vs-flat-layout.rst index c38968345..f13dac54c 100644 --- a/source/discussions/src-layout-vs-flat-layout.rst +++ b/source/discussions/src-layout-vs-flat-layout.rst @@ -86,9 +86,18 @@ Running a command-line interface from source with src-layout ============================================================ Due to the firstly mentioned specialty of the src layout, a command-line -interface can not be run directly from the :term:`source tree `, -but requires installation of the package in -:doc:`Development Mode ` +interface can not be run directly from the :term:`source tree `. + +To run a command-line interface directly, you can either: + +Run :file:`__main__.py` via: + +.. code-block:: bash + + cd src/ + python -m awesome_package + +Or install the package in :doc:`Development Mode ` for testing purposes. Since this can be unpractical in some situations, a workaround could be to prepend the package folder to Python's :py:data:`sys.path` when called via its :file:`__main__.py` file: From 0ad91e0c4d2c056949cd74f589201883c53014b8 Mon Sep 17 00:00:00 2001 From: Evan Kohilas Date: Tue, 19 Nov 2024 12:08:51 +1100 Subject: [PATCH 2/3] make clear that the recommended approach is dev installing --- source/discussions/src-layout-vs-flat-layout.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/source/discussions/src-layout-vs-flat-layout.rst b/source/discussions/src-layout-vs-flat-layout.rst index f13dac54c..faf90b5c8 100644 --- a/source/discussions/src-layout-vs-flat-layout.rst +++ b/source/discussions/src-layout-vs-flat-layout.rst @@ -88,7 +88,10 @@ Running a command-line interface from source with src-layout Due to the firstly mentioned specialty of the src layout, a command-line interface can not be run directly from the :term:`source tree `. -To run a command-line interface directly, you can either: +To run a command-line interface directly, you can install the package in +:doc:`Development Mode ` for testing purposes. + +Since this can be unpractical in some situations, you can also either: Run :file:`__main__.py` via: @@ -97,10 +100,8 @@ Run :file:`__main__.py` via: cd src/ python -m awesome_package -Or install the package in :doc:`Development Mode ` -for testing purposes. Since this can be unpractical in some situations, -a workaround could be to prepend the package folder to Python's -:py:data:`sys.path` when called via its :file:`__main__.py` file: +Or prepend the package folder to Python's :py:data:`sys.path` when called via its +:file:`__main__.py` file: .. code-block:: python From 251e8beaf242182e6a4f222a871533cb0174f2c2 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 01:08:58 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- source/discussions/src-layout-vs-flat-layout.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/discussions/src-layout-vs-flat-layout.rst b/source/discussions/src-layout-vs-flat-layout.rst index faf90b5c8..b6bce86ca 100644 --- a/source/discussions/src-layout-vs-flat-layout.rst +++ b/source/discussions/src-layout-vs-flat-layout.rst @@ -89,7 +89,7 @@ Due to the firstly mentioned specialty of the src layout, a command-line interface can not be run directly from the :term:`source tree `. To run a command-line interface directly, you can install the package in -:doc:`Development Mode ` for testing purposes. +:doc:`Development Mode ` for testing purposes. Since this can be unpractical in some situations, you can also either: