[arch-general] PyPI2PKGBUILD: Automated PKGBUILD creation for PyPI packages

Antony Lee anntzer.lee at gmail.com
Thu Jun 30 19:16:53 UTC 2016

I'd like to present PyPI2PKGBUILD (https://github.com/anntzer/pypi2pkgbuild),
a new tool for automated PKGBUILD creation for PyPI packages.  It is
similar in spirit to the venerable pip2arch (
https://github.com/bluepeppers/pip2arch), but with a few improvements:

- Python dependencies are found by installation in a temporary virtualenv
(as far as I know, this is the simplest way to handle environment markers
correctly (https://www.python.org/dev/peps/pep-0496/)); moreover,
PyPI2PKGBUILD calls itself recursively for dependencies that are not
available as official packages (i.e., you can call `pypi2pkgbuild.py
$pkgname` and get all the necessary packages created and built for you).
Many packages do not correctly declare `cython` and `numpy` as dependencies
so special handling is provided for them.

- Non-python (binary) dependencies that are dynamically linked are resolved
via `namcap` and `pkgfile`, and added to the `depends` array.  Say, for
example, that you want to create a package for `pyfftw`, which needs to
link against `fftw`, which is provided by the official `fftw` package.  You
can run `pacman -S --asdeps fftw`, then run `pypi2pkgbuild.py pyfftw`; the
PKGBUILD will correctly declare `fftw` as `depends`.

- Missing license files are retrieved from Github/Bitbucket if possible.

The general intent is to 1) allow one to install packages that are not
available on the Arch (official or AUR) repos (I don't think the
proliferation of "trivial" PKGUBILDs that simply do `python setup.py build`
/ `python setup.py install --root="$pkgdir"` on the AUR is a particularly
good thing) and 2) allow one to update packages for which a new version is
present on PyPI but not on the arch repos yet (by default, the packages are
built with a pkgrel of 00, so that they'd be upgraded to official/AUR
packages when those become available).


PS: Original announcement on the forum at

More information about the arch-general mailing list