Skip to content

Conversation

algal
Copy link
Contributor

@algal algal commented Oct 6, 2025

This updates IPython so that it respects the value of the Python flag sys.flags.safe_path, which is usually controlled by the environment variable PYTHONSAFEPATH, and which stops Python from adding the current working directory to the sys.path.

So now a user can do this by relying on that standard Python env var, or Python's -P command line flag, rather than relying on IPython's own --ignore_cwd command line flag.

algal added 2 commits October 6, 2025 15:41
Update init_path so that if sys.flags.safe_path is set, it will not
include the current working directory.

sys.flags.safe_path is python's equivalent to of the ipython flag
ignore_cwd. It is most often set by PYTHONSAFEPATH or by running
python with -P.
Copy link
Member

@ivanov ivanov left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

@algal
Copy link
Contributor Author

algal commented Oct 6, 2025

@ivanov I committed the suggested changed to the empty str literal and to the version in the docstring.

@ivanov
Copy link
Member

ivanov commented Oct 7, 2025

Thanks for taking the time to improve IPython, @algal

@ivanov ivanov merged commit 51dc045 into ipython:main Oct 7, 2025
19 checks passed
@krassowski krassowski added this to the 9.7 milestone Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants