diff options
author | Saniya Maheshwari <55744224+codeandfire@users.noreply.github.com> | 2022-06-09 21:38:48 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-09 21:38:48 +0530 |
commit | bf7da8b333184dbf163e129567efffa58837965c (patch) | |
tree | 6e104db77bb2b3fe8bad0306b1c9b322b2b3b629 /docs/userguide | |
parent | 82bea11ebf5736b425b1a422c711d71d1a87a7d0 (diff) | |
download | python-setuptools-git-bf7da8b333184dbf163e129567efffa58837965c.tar.gz |
Apply suggestions from code review
Co-authored-by: Anderson Bravalheri <andersonbravalheri+github@gmail.com>
Diffstat (limited to 'docs/userguide')
-rw-r--r-- | docs/userguide/entry_point.rst | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/docs/userguide/entry_point.rst b/docs/userguide/entry_point.rst index f30326ac..5d1ed977 100644 --- a/docs/userguide/entry_point.rst +++ b/docs/userguide/entry_point.rst @@ -51,9 +51,8 @@ module: $ python -m timmins Hello world -Instead of this approach using ``__main__.py``, a better way is to add -a console script entry point, which allows the package to define a -user-friendly name for installers of the package to execute. +Instead of this approach using ``__main__.py``, you can also create a +user-friendly CLI executable that can be called directly without ``python -m``. In the above example, to create a command ``hello-world`` that invokes ``timmins.hello_world``, add a console script entry point to your configuration: @@ -101,7 +100,7 @@ Note that any function configured as a console script, i.e. ``hello_world()`` in this example, should not accept any arguments. If your function requires any input from the user, you can use regular command-line argument parsing utilities like `argparse <https://docs.python.org/3/library/argparse.html>`_ within the body of -the function to parse user input. +the function to parse user input given via :obj:`sys.argv`. The syntax for entry points is specified as follows: @@ -185,7 +184,7 @@ body of the function. .. note:: - Console and GUI scripts work because behind the scenes, installers like Pip + Console and GUI scripts work because behind the scenes, installers like :pypi:`pip` create wrapper scripts around the function(s) being invoked. For example, the ``hello-world`` entry point in the above two examples would create a command ``hello-world`` launching a script like this: [#packaging_guide]_ |