Live data from Hacker News

Pip.wtf: Inline dependencies for small Python scripts

pip.wtf

11–13 of 13 posts

Re: Pip.wtf: Inline dependencies for small Python scripts

#11
post #9
post #5

Earlier quoted context omitted.

There was (and is) no reason for it to exist since python supports running .zip files that contain all the dependencies.

I had never heard of that, reading up on it now. Thanks for posting!

pex is a build tool built on the top of the zip trick. A pex file doesn't contain a bundled interpreter, but it zips up the entire virtualenv. Also no Windows support.

https://pex.readthedocs.io/en/latest/

Re: Pip.wtf: Inline dependencies for small Python scripts

#13
post #7

A development version of pipx supports a feature that address this pain point. See pull request #916 [1] In your script example.py , you would specify your dependencies in a special comment like this: # Requirements: # requests import requests ... Then you could run the script like this: pipx run file:example.py This would install the dependencies in a temporary virtual environment, and run the script in that virtual…

There is also fades (https://github.com/PyAr/fades) and pip-run (https://github.com/jaraco/pip-run). Debian and Ubuntu package fades.
Post reply on HN