-
Notifications
You must be signed in to change notification settings - Fork 107
docs/how-to: Shipping Dependency Sets as a Single File #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
BTW, the duplication of the stdlib directory in |
|
@jhermann this is awesome, thanks!! I'll try and get some eyes on this and your other PRs over the weekend. And yeah, if you have more documentation to add, bring it on!! |
| If you have ``coreutils`` with at least version 8.30 on your Linux system, | ||
| then you can use env shebangs *and* pass arguments to Python, like in this example: | ||
|
|
||
| .. code-block:: shell | ||
| shiv -p '/usr/bin/env -S python3 -I -S' … | ||
| The magic ingredient is the new ``-S`` (split) option, but as of 2020 | ||
| you have to target very new stable releases like Debian Buster | ||
| or rolling distributions for it to actually work. | ||
| Check for the option by calling ``env --help``. | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we omit this entry for this change? I appreciate that we want to educate users about what is possible with shebangs, but given that the tool in question (shiv) has no opinion about the shebang, I'd rather not introduce this concept in our documentation.
| and their deployment workflows. | ||
|
|
||
|
|
||
| Shipping Dependency Sets as a Single File |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about referring to these as "frozen environments" rather than "dependency sets". This is usually how we refer to them internally, but I want to know if it makes sense in the broader Python community.
| The ``-IS`` options in ``-p`` ensure this zipapp runs isolated (for increased security), | ||
| with neither the current working directory | ||
| nor the host's site packages in the Python path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's omit this (and the flags) in the example, to not confuse users and discourage copy-pasted boilerplate.
| .. tip:: | ||
|
|
||
| Replace the ``.`` at the end of the ``shiv`` call | ||
| by a literal list of PyPI packages, | ||
| or load them from a requirements file (``-r lib-requirements.txt``), | ||
| and you don't need an extra project for getting your base set defined. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good tip, can you call out the . earlier than this tip as well? I can imagine someone reading this doc may gloss right over the . on line 28 and be confused when they see this tip, but if you call it out (after the note about not providing an entry point, maybe) the reader will have proper context. Which is also a good opportunity to let them know that any non-shiv arguments/flags get delegated to pip.
| The underscore prefix in the zipapp name indicates this is not a command | ||
| humans would normally use – alternatively you can deploy into e.g. | ||
| ``/usr/local/lib/python3.6/`` and then use an absolute path instead of | ||
| an ``env`` call in the script's shebang. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can omit this, don't want to overload the reader with info that's not critical.
If you want more of those, I have a few in the queue…