pip2pi

Builds a PyPI-compatible package repository from pip requirements
Download

pip2pi Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Other/Proprietary Li...
  • Price:
  • FREE
  • Publisher Name:
  • David Wolever
  • Publisher web site:
  • https://github.com/wolever/

pip2pi Tags


pip2pi Description

pip2pi is a Python module that builds a PyPI-compatible package repository from pip requirements.PyPI can go down, package maintainers can remove old tarballs, and downloading tarballs can take a long time. pip2pi helps to alleviate these problems by making it blindingly simple to maintain a PyPI-compatible repository of packages your software depends on.StatusThese tools were developed to be used internally, and they appear to work for me. A quick glance at the code will make it obvious that they are far from robust (ex, they probably won't work on Windows and they make a few calls to shell commands that could be implemented in Python)... But they should work, and they shouldn't eat your data or steal private keys or anything.SetupCreate the directory which will contain the tarballs of required packages, preferably somewhere under your web server's document root: mkdir /var/www/packages/Mirroring PackagesTo mirror a package and all of its requirements, use pip2tgz: pip2tgz packages/ foo==1.2...$ ls packages/foo-1.2.tar.gzbar-0.8.tar.gzNote that pip2tgz passes package arguments directly to pip, so packages can be specified in any format that pip recognizes: cat requirements.txtfoo==1.2http://example.com/baz-0.3.tar.gz$ pip2tgz packages/ -r requirements.txt bam-2.3/...$ ls packages/foo-1.2.tar.gzbar-0.8.tar.gzbaz-0.3.tar.gzbam-2.3.tar.gzBuilding a Package IndexA directory full of .tar.gz files can be turned into PyPI-compatible "simple" package index using the dir2pi command: ls packages/bar-0.8.tar.gzbaz-0.3.tar.gzfoo-1.2.tar.gz$ dir2pi packages/$ find packages/packages/packages/bar-0.8.tar.gzpackages/baz-0.3.tar.gzpackages/foo-1.2.tar.gzpackages/simplepackages/simple/barpackages/simple/bar/bar-0.8.tar.gzpackages/simple/bazpackages/simple/baz/baz-0.3.tar.gzpackages/simple/foopackages/simple/foo/foo-1.2.tar.gzBut that's a lot of work...If running two commands seems like too much work... Take heart! The pip2pi command will run both of them for you... And it will use rsync to copy the new packages and index to a remote host! pip2pi example.com:/var/www/packages/ foo==1.2... curl -I http://example.com/packages/simple/foo/foo-1.2.tar.gz | head -n1HTTP/1.1 200 OKBut that's still too much work...Take heart! Your shell's alias command can help. Add an alias like this to your shell's runtime configuration file (hint: ~/.bashrc or similar):alias pip2acmeco="pip2pi dev.acmeco.com:/var/www/packages/Now updating your package index will be as simple as: pip2acmeco foo==1.2 -r bar/requirements.txtUsing Your New Package IndexTo use the new package index, pass the --use-index= argument to pip: pip install --use-index=http://example.com/packages/simple/ fooOr, once it has been mirrored, prefix you requirements.txt with --use-index=...: cat requirements.txt--use-index=http://example.com/packages/simple/foo==1.2Product's homepage


pip2pi Related Software