PBR

markers are incompatible with pip < 6 and sdists

Bug #1502692 reported by Robert Collins
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PBR
Fix Released
High
Sachi King

Bug Description

This originated from https://github.com/testing-cabal/mock/issues/316 and https://github.com/pypa/pip/issues/3111

- Markers in deps *in sdists* (whether extras or install_requires) are not interpreted by pip <6.
- pip < 1.5 chooses sdists over wheels.
- Ubuntu LTS has pip 1.1, and RHEL 7 has 1.5

Thus anything that:
 - uses markers
 - is going to be installed on Ubuntu LTS or RHEL 7 (e.g. another decade or two!)
 - and publishes sdists

will fail to install correctly

Donald stufft suggests the following approach as a workaround:

 - in egg_info generation export unconditional metadata (e.g. use pkg_resources to evaluate the markers immediately)
 - in bdist_wheel export the markers as markers for evaluation by the installing system.

This is used by a number of packages - e.g. https://github.com/pypa/twine/blob/master/setup.cfg#L9-L15 and https://github.com/pypa/twine/blob/master/setup.py#L28-L31 - and apparently works ok with pip.

We'd want careful testing to ensure we don't accidentally export unconditional deps to the wheel, I suggest at least one integration test of a test package that does pip install ., pip install -e ., pip wheel ., parameterised over pip 1.4, 1.5 and latest.

Tags: markers
Sachi King (nakato)
Changed in pbr:
assignee: nobody → Sachi King (nakato)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to pbr (master)

Fix proposed to branch: master
Review: https://review.openstack.org/253289

Changed in pbr:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to pbr (master)

Reviewed: https://review.openstack.org/253289
Committed: https://git.openstack.org/cgit/openstack-dev/pbr/commit/?id=7898882fa5316bf85ffd5617340e69df2129e923
Submitter: Jenkins
Branch: master

commit 7898882fa5316bf85ffd5617340e69df2129e923
Author: Sachi King <email address hidden>
Date: Thu Oct 29 12:17:56 2015 +0900

    Handle markers to support sdist on pip < 6

    Old versions of pip do not properly evaluate blank envmarkers such as
    ':python_version>=2.7', so as long as we are not creating a bdist_wheel
    we evaluate these immediately to support these old installations

    Change-Id: I94a5f9bccd658a2529a727d99f5a2b79e6b00aa8
    Closes-Bug: 1502692

Changed in pbr:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to pbr (master)

Fix proposed to branch: master
Review: https://review.openstack.org/278210

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on pbr (master)

Change abandoned by Sachi King (<email address hidden>) on branch: master
Review: https://review.openstack.org/278210
Reason: Alt implementation https://review.openstack.org/#/c/289628/

Can this one

Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote : Fix included in openstack-dev/pbr 1.9.0

This issue was fixed in the openstack-dev/pbr 1.9.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.