3 ms·
pipx has merged, though not yet released, support for single-file scripts with dependencies (https://github.com/pypa/pipx/issues/913 https://github.com/pypa/pip
by networked 3y ago
pipx has merged, though not yet released, support for single-file scripts with dependencies (https://github.com/pypa/pipx/issues/913 https://github.com/pypa/pipx/issues/913). There is also pip-run (https://github.com/jaraco/pip-run https://github.com/jaraco/pip-run) with similar functionality to the new feature in pipx and other options. Their approach of listing dependencies in a comment at the top pf the script has been standardized (with minor differences) in a recent PEP: https://peps.python.org/pep-0722/ https://peps.python.org/pep-0722/. All of this looks good for the future of Python scripts.
I have already adopted pipx run script.py in a project: https://github.com/dbohdan/structured-text-tools/blob/d8dc1ac173ceb85776b3dc87c12acea234c96079/render-template.py https://github.com/dbohdan/structured-text-tools/blob/d8dc1a.... It has been convenient and has not caused me problems so far.