pypa / virtualenv

Virtual Python Environment builder
https://virtualenv.pypa.io
MIT License
4.78k stars 1.02k forks source link

Update activate_this.py documentation to use runpy instead of exec #2716

Closed FredStober closed 3 months ago

FredStober commented 3 months ago

runpy.run_path was added in python 2.7 and 3.2 - and every python that is not EOL supports it.

It is arguably nicer to read and the path is only given once in the command.

At least right now, runpy - unlike exec with S102 - is not flagged by bandit or bandit-derived (eg. ruff) checks. (I guess because it loads from a file instead of a simple string...)

Because of the import, it is also not a one-liner anymore.

Thanks for contributing, make sure you address all the checklists (for details on how see development documentation)