diff options
author | Saniya Maheshwari <saniya.mah@gmail.com> | 2022-06-09 00:36:53 +0530 |
---|---|---|
committer | Saniya Maheshwari <saniya.mah@gmail.com> | 2022-06-09 17:36:11 +0530 |
commit | 51041e1b63058ba73163c380bad8f094c78898c8 (patch) | |
tree | 61924ff7685571ff1677c95f4d8a81a4d765cce4 | |
parent | c005bff3b1478234b59119b5cc43d7da93c5a422 (diff) | |
download | python-setuptools-git-51041e1b63058ba73163c380bad8f094c78898c8.tar.gz |
Function configured as console/GUI script should not take arguments
Added two lines to make this clear to users. Also added that any parsing
of user input can take place within the body of the function using
regular command-line parsing utilities.
-rw-r--r-- | docs/userguide/entry_point.rst | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/docs/userguide/entry_point.rst b/docs/userguide/entry_point.rst index 568132cc..9c17f035 100644 --- a/docs/userguide/entry_point.rst +++ b/docs/userguide/entry_point.rst @@ -93,6 +93,12 @@ After installing the package, a user may invoke that function by simply calling $ hello-world Hello world +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 syntax for entry points is specified as follows: .. code-block:: ini @@ -159,6 +165,10 @@ Now, running: will open a small application window with the title 'Hello world'. +Note that just as with console scripts, any function configured as a GUI script +should not accept any arguments, and any user input can be parsed within the +body of the function. + .. note:: The difference between ``console_scripts`` and ``gui_scripts`` only affects |