Community Packages

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#52477 - [python-entrypoints] install from PyPI for distribution info

Attached to Project: Community Packages
Opened by Phil Schaf (flying-sheep) - Tuesday, 10 January 2017, 16:49 GMT
Last edited by Kyle Keen (keenerd) - Wednesday, 08 March 2017, 13:08 GMT
Task Type Feature Request
Category Packages
Status Closed
Assigned To Kyle Keen (keenerd)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Python packages should always contain distribution info so that PIP and other tools know about them.

E.g. I get this when trying to update jupyter_contrib_nbextensions:

> The 'entrypoints>=0.2.2' distribution was not found and is required by nbconvert

You can use this URL template, which saves you from always having to adapt hashes in the PyPI URL:

_name=entrypoints
source=("https://files.pythonhosted.org/packages/py2.py3/${_name::1}/$_name/$_name-$pkgver-$_name-$pkgver-py2.py3-none-any.whl")

For completeness’ sake; this is how a version- and arch-specific URL template would look:

_py=cp36
source_x86_64=("https://files.pythonhosted.org/packages/$_py/${_name::1}/$_name/$_name-$pkgver-$_py-${_py}m-manylinux1_x86_64.whl")
This task depends upon

Closed by  Kyle Keen (keenerd)
Wednesday, 08 March 2017, 13:08 GMT
Reason for closing:  Fixed
Additional comments about closing:  python-entrypoints-0.2.2-3
Comment by Phil Schaf (flying-sheep) - Tuesday, 10 January 2017, 17:02 GMT
Oh, I forgot. You also have to add makedepends=(pip) and change the build step to:

pip install --compile --no-deps --ignore-installed --root="$pkgdir" "$_name-$pkgver-$_name-$pkgver-py2.py3-none-any.whl"

and the real url is:

_name=entrypoints
source=("https://files.pythonhosted.org/packages/py2.py3/${_name::1}/$_name/$_name-$pkgver-py2.py3-none-any.whl")

here’s an updated PKGBUILD:

# $Id$
# Maintainer: Kyle Keen <keenerd@gmail.com>

_name=entrypoints
pkgname=python-entrypoints
pkgver=0.2.2
pkgrel=3
pkgdesc="https://pypi.python.org/pypi/entrypoints"
arch=('any')
url="https://github.com/takluyver/entrypoints"
license=('MIT')
depends=('python')
_wheel="$_name-$pkgver-py2.py3-none-any.whl"
source=("https://files.pythonhosted.org/packages/py2.py3/${_name::1}/$_name/$_wheel")
noextract=("$_wheel")
md5sums=('73bd7ce92c19b25dc5a20aff41be996a')

package() {
pip install --compile --no-deps --ignore-installed --root="$pkgdir" "$_wheel"
}
Comment by Kyle Keen (keenerd) - Thursday, 12 January 2017, 11:58 GMT
I kind of want to close this wontfix. Your attention to detail is appreciated, but we don't use pip and don't encourage it. And I'm not sure what you mean about "saves you from always having to adapt hashes in the PyPI URL"? We had that problem for one week, and then PyPI fixed it after maintainers from every distro complained.
Comment by Phil Schaf (flying-sheep) - Thursday, 12 January 2017, 12:30 GMT
> I kind of want to close this wontfix

It’s an actual bug, so please don’t. PKG-INFO and friends is missing from the package the way it’s installed now.

> we don't use pip and don't encourage it

Hmm, in this case it’s easy: This .whl file’s contents can probably just be extracted to:

$pkgdir$(python3 -c 'import site; print(site.getsitepackages()[-1])')

which will create the necessary directory entrypoints-0.2.2.dist-info/

There’s probably more to do for packages containing scripts and so on.

> We had that problem for one week, and then PyPI fixed it after maintainers from every distro complained.

exactly, so we can now use the files.pythonhosted.org URLs.
Comment by Phil Schaf (flying-sheep) - Thursday, 12 January 2017, 12:39 GMT
or just

python3 -m wheel install "$_wheel"

since build() is chrooted into $pkgdir, this will do the right thing.
Comment by Sebastian Pinnau (spinnau) - Tuesday, 17 January 2017, 16:44 GMT
Jupyter nbconvert uses the pkg_resources module to access Python packages. As
the package metadata (egg-info file or dist-info directory) is missing, using
"jupyter nbconvert" with a notebook file fails with this error:

$ pkg_resources.DistributionNotFound: The 'entrypoints>=0.2.2' distribution was not found and is required by nbconvert



The author of python-entrypoints is using flit ( https://github.com/takluyver/flit )
as a simpler alternative to setuptools for packaging. Thus, I don't think upstream
is willing to add a setup.py file.


The debian package maintainer for python-entrypoints has created an egg-file,
that will be included in the package alongside the Python file. Please see the rules file in
https://anonscm.debian.org/cgit/python-modules/packages/entrypoints.git/tree/debian/



I think there are 3 possibilities for fixing this:

* Creating a python-flit package and using it in the PKGBUILD. This could then
also be used for python-testpath, which is by now a missing dependency for
jupyter-nbconvert

* Manually adding an egg-info file to the package as done in debian

* Using python-wheel in the PKGBUILD for installing package as suggested by Phil
in his last comment
Comment by Phil Schaf (flying-sheep) - Wednesday, 18 January 2017, 14:19 GMT
oh, yeah. so this bug is actually about nbconvert being broken.

and i need nbconvert for work.

> * Creating a python-flit package and using it in the PKGBUILD.

you mean using flit to create a non-wheel package file? can it do that?

> * Manually adding an egg-info file to the package as done in debian

this is silly, as the dist-info inside of the wheel file is equivalent, but newer metadata

> * Using python-wheel in the PKGBUILD for installing package

i think i was wrong. it still says the files in /usr/lib exist… so there is no chroot done automatically(?)

and if we only extract it, it won’t contain __pycache__

so i guess our real options are (if flit can’t create a non-wheel package from it):

1. just use pip. the way i call it above it simply unpacks the files and creates __pycache__
2. extract the wheel and manually create __pycache__ using python -m compileall (which is very manual)
Comment by Sebastian Pinnau (spinnau) - Wednesday, 18 January 2017, 19:16 GMT
I have meant using flit as a makedepend in the PKGBUILD. Flit allows direct installation from source. With the --env argument the package will be installed inside of Pythons site-package directory. But I have found no option to change the root or target path to $pkgdir:

$ flit install --env



If you want to install the wheel file inside the PKGBUILD, than you have to change the root directory to $pkgdir. The files will then be copied to $pkdir/usr/lib/pythonx.y/site-packages

$ pip install entrypoints-0.2.2-py2.py3-none-any.whl --root="$pkgdir"
Comment by Phil Schaf (flying-sheep) - Thursday, 19 January 2017, 09:18 GMT
OK, so all we have left is pip or extract+compileall.

the former seems much cleaner and more error-proof to me. for reference here’s the correct set of options again:

pip install --compile --no-deps --ignore-installed --root="$pkgdir" "$_wheel"

--compile adds __pycache__ as we want
--no-deps prevents installing dependencies (as we manage them)
--ignore-installed makes it not complain if it finds the module already in PYTHONPATH
--root is obvious
Comment by Kyle Keen (keenerd) - Wednesday, 08 March 2017, 03:30 GMT
Does python-entrypoints-0.2.2-3 work for you?
Comment by Antonio Rojas (arojas) - Wednesday, 08 March 2017, 12:28 GMT
sagenb-export works fine with this version (after installing the other missing nbconvert dependencies), thanks for the fix.

Loading...