You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I propose that we extend pipx to run scripts with inline metadata, as:
pipx run-script ./my-script.py
How would this feature be useful?
Inline script metadata lets script authors specify dependency metadata inline in a script. Presently, this is intended to be used by IDEs when interacting with the script.
At the time of writing, there is no convenient way to run a script with inline metadata, even though all the required information is there. If I have a script, my-script.py, with inline metadata, I would have to:
Create a virtual environment.
Activate the virtual environment.
Manually read the metadata from the script.
Manually install each dependency, or create a requirements.txt or pyproject.toml file.
Install the dependencies into the virtual environment.
Run my script.
Describe the solution you'd like
I suggest that we extend pipx to perform the steps I outlined above, either when running pipx run ./my-script.py (which extends the behaviour of the existing run commandi) or when running pipx run-script my-script.py (which creates a new command to ensure backwards compatibility).
All the necessary information is present in the inline metadata block and there is a reference implementation for extracting that metadata from the script.
This would significantly ease the use of scripts with inline metadata and would allow us to use a shebang such as #!/usr/bin/env pipx run-script.
Describe alternatives you've considered
Since pipx is the canonical tool for executing Python scripts in on-the-fly virtual environments, I believe this is the correct tool to support this feature.
The text was updated successfully, but these errors were encountered:
I propose that we extend pipx to run scripts with inline metadata, as:
How would this feature be useful?
Inline script metadata lets script authors specify dependency metadata inline in a script. Presently, this is intended to be used by IDEs when interacting with the script.
At the time of writing, there is no convenient way to run a script with inline metadata, even though all the required information is there. If I have a script,
my-script.py
, with inline metadata, I would have to:requirements.txt
orpyproject.toml
file.Describe the solution you'd like
I suggest that we extend pipx to perform the steps I outlined above, either when running
pipx run ./my-script.py
(which extends the behaviour of the existingrun
commandi) or when runningpipx run-script my-script.py
(which creates a new command to ensure backwards compatibility).All the necessary information is present in the inline metadata block and there is a reference implementation for extracting that metadata from the script.
This would significantly ease the use of scripts with inline metadata and would allow us to use a shebang such as
#!/usr/bin/env pipx run-script
.Describe alternatives you've considered
Since
pipx
is the canonical tool for executing Python scripts in on-the-fly virtual environments, I believe this is the correct tool to support this feature.The text was updated successfully, but these errors were encountered: