Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-33095: Add reference to isolated mode in -m and script option #7764

Merged
merged 2 commits into from
Sep 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Doc/using/cmdline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ source.
first element will be set to ``"-m"``). As with the :option:`-c` option,
the current directory will be added to the start of :data:`sys.path`.

:option:`-I` option can be used to run the script in isolated mode where
:data:`sys.path` contains neither the current directory nor the user's
site-packages directory. All :envvar:`PYTHON*` environment variables are
ignored, too.

Many standard library modules contain code that is invoked on their execution
as a script. An example is the :mod:`timeit` module::

Expand All @@ -121,6 +126,7 @@ source.
.. versionchanged:: 3.4
namespace packages are also supported

.. _cmdarg-dash:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible the : at the end of the name is not necessary and that is what's affecting the font?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you be little more specific on affecting the font part? On removing : at the end I get /home/cpython/Doc/using/cmdline.rst:127: WARNING: malformed hyperlink target. . To be honest my knowledge on Sphinx markdown is low. I took this syntax as an exact copy from https://bugs.python.org/issue33095#msg319812 . I was trying to make them hyperlinks so that they can be referenced I might be wrong on the syntax here.

Thanks

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially I was trying out .. cmdoption:: - and .. cmdoption:: script removing describe:: which works fine but there was an explicit note on the bpo message to use .. _cmdarg-dash: so that they are hyperlinkable like option ones without looking the same.

For making "-" and "<script>" hyperlinkable, you'll need to add a label definition to the Sphinx source code immediately before those description sections. I'd suggest ".. _cmdarg-dash:" and ".. _cmdarg-script:" so the resulting anchors look similar to the option ones, without being the same.


.. describe:: -

Expand All @@ -133,6 +139,8 @@ source.

.. audit-event:: cpython.run_stdin "" ""

.. _cmdarg-script:

.. describe:: <script>

Execute the Python code contained in *script*, which must be a filesystem
Expand All @@ -151,6 +159,11 @@ source.
added to the start of :data:`sys.path` and the ``__main__.py`` file in
that location is executed as the :mod:`__main__` module.

:option:`-I` option can be used to run the script in isolated mode where
:data:`sys.path` contains neither the script's directory nor the user's
site-packages directory. All :envvar:`PYTHON*` environment variables are
ignored, too.

.. audit-event:: cpython.run_file filename

.. seealso::
Expand Down