masdeseiscaracteres
11/17/2017 - 9:04 AM

The definitive guide to Python private package dependencies

The definitive guide to Python private package dependencies

pip install

From a setup.py file

Specifiers

Complete grammar of version specifiers: https://www.python.org/dev/peps/pep-0508/

Version specifiers format: https://www.python.org/dev/peps/pep-0440/

Dependency links

Make pip parse the dependency_links section in setup.py: --process-dependency-links

Dependency links for packages not in PyPi http://setuptools.readthedocs.io/en/latest/setuptools.html#dependencies-that-aren-t-in-pypi

Sometimes egg version is required, put 0 if none: https://github.com/pypa/pip/issues/3610#issuecomment-283578756

From a requirements file (usually requirements.txt)

Done by doing pip install -r <requirements_file>

According to pip install --help

  -i, --index-url <url>       Base URL of Python Package Index (default
                              https://pypi.python.org/simple). This should
                              point to a repository compliant with PEP 503
                              (the simple repository API) or a local directory
                              laid out in the same format.
  --extra-index-url <url>     Extra URLs of package indexes to use in addition
                              to --index-url. Should follow the same rules as
                              --index-url.
  --no-index                  Ignore package index (only looking at --find-
                              links URLs instead).
  -f, --find-links <url>      If a url or path to an html file, then parse for
                              links to archives. If a local path or file://
                              url that's a directory, then look for archives
                              in the directory listing.

(define what is understood by an archive, whl, tar.gz?)

Other considerations

Self-signed certificates or no certificates at all (??): --trusted-host <hostname>

External files, scripts, tests, etc.??