You are not logged in.

#1 2016-06-12 18:08:32

antony
Member
Registered: 2011-07-14
Posts: 43

Suggested new PKGBUILD template for python wheel-only packages

A number of Python packages start to be distributed as wheel-only on PyPI (e.g. https://bbs.archlinux.org/viewtopic.php?id=207891), which means that they must be installed using pip.  I would like to suggest a new "official" (i.e., to be provided by the abs package) template PKGBUILD for such projects:

pkgname=python-NAME
pkgver=VERSION
pkgrel=1
pkgdesc=''
url=''
depends=('python')
makedepends=('python-pip')
checkdepends=()
license=()
arch=()
source=()
sha256sums=()

package() {
  cd "$srcdir"
  PIP_CONFIG_FILE=/dev/null pip install --isolated --root="$pkgdir" --ignore-installed --no-deps *.whl
}

Here's the reason for each of the flags:

PIP_CONFIG_FILE=/dev/null ignores {/etc,~/.config}/pip.conf while --isolated ignores environment variables (and again ~/.config/pip/pip.conf) that may otherwise be appending arbitrary flags to the pip command.

--ignore-installed is necessary until https://github.com/pypa/pip/issues/3063 is resolved, otherwise pip would be influenced by the result of an earlier --user install.

--no-deps ensures, well, that dependencies do not get packaged together with the main package.

Unfortunately wheels typically do not include license files (https://bitbucket.org/pypa/wheel/issues … se-file-or), so I guess the best for now would be to include a copy of the file itself (taken from wherever available) and include it in the source array.

Thoughts?

Last edited by antony (2016-07-02 23:12:25)

Offline

#2 2016-06-12 19:47:29

pypi
Wiki Maintainer
Registered: 2014-04-22
Posts: 250

Re: Suggested new PKGBUILD template for python wheel-only packages

You're better off putting this on the wiki - the prototypes provided by the ABS package are well out of date anyway, see eg https://bugs.archlinux.org/task/34485.
You could also consider looking at the makepkg-template - perhaps providing a template might be a better solution?

Offline

#3 2016-07-10 22:02:05

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: Suggested new PKGBUILD template for python wheel-only packages

Hi antony,

For the last few months I have been working on an extensible pacman wrapper named Pacboy that I have now uploaded for testing and development here. I made a note of your thread when I first saw it because I thought that if you are regularly packaging PyPI packages then you may have the desire and skills to develop a PyPI extension for Pacboy. It would enable users to transparently build and install PyPI packages using pacman commands. If you are interested, please take a look at the thread.

Regards,
Xyne


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#4 2016-07-10 23:32:55

antony
Member
Registered: 2011-07-14
Posts: 43

Re: Suggested new PKGBUILD template for python wheel-only packages

In practice I have completely switched to using PyPI2PKGBUILD (https://bbs.archlinux.org/viewtopic.php?id=213740), which lets me easily keep a fully updated list of Python packages: for nearly all packages, I can now do `pypi2pkgbuild.py $pyname && sudo pacman -U python-$pyname/*.tar.xz` (or a variant thereof), including for complex layouts such as IPython (for which the Arch package "vendors" a couple of smaller packages too), and for packages with binary dependencies (I need to first install them as `--asdeps`, but they are then correctly registered as dependencies by the Python package).  The only missing cases are packages that don't declare their runtime dependencies, use ctypes for dynamically loading so's, or rely extensively on setuptools' `extra_requires` feature (which is difficult to introspect).  License files are mostly handled correctly too.

I'll look more in depth at what pacboy provides; perhaps it may make sense to integrate PyPI2PKGBUILD as a repo wrapper.

Offline

Board footer

Powered by FluxBB