pip
Table of Contents
pip
Environment Variables reference
pip
's command line options can be set with environment variables using the format PIP_<UPPER_LONG_NAME>
. Dashes (-
) have to be replaced with underscores (_
).
Vendor(Embed) dependencies howto
Updating vendored dependencies is based on how pip
does. For more details about vendoring, SEE Vendoring Policy.
First, install target dependencies within a
_vedor/
(or the name you like) folder.- (Optional) To make vendored packages compact, delete unnecessary things like
*.dist-info
,*.egg-info
,bin/
, etc. - Decide how to expose vendored packages:
If you are vendoring for only a specific application you write, the easiest way is to append the
_vendor
path tosys.path
- If you need completely insulated vendored dependencies, you need to rewrite imports in vendored code and use absolute imports:
- Rewrite imports;
import <name>
,from <name>(.*) import
toimport _vendor.<name>
,from _vendor.<name>(.*) import
. - Import vendored dependencies
from _vendor import library1
.
- Rewrite imports;
(Optional) Apply some patches for specific packages, like requests.patch.
- https://stackoverflow.com/questions/52538252/import-vendored-dependencies-in-python-package-without-modifying-sys-path-or-3rd
- https://stackoverflow.com/questions/18812614/embedding-a-python-library-in-my-own-package
- https://github.com/pypa/pip/blob/master/tasks/vendoring/__init__.py
- https://github.com/pypa/pip/blob/master/src/pip/_vendor/README.rst