pypa / pypa/setuptools

allow Distribution.requires be evaluated with arbitrary environment markers

Open
#353 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement major Needs Triage
Dominant language
Python
Stars
2.9k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

Originally reported by: wickman (Bitbucket: wickman, GitHub: wickman)


Right now Distribution has a requires() method that just takes an 'extras' keyword argument. Under the covers, it refers to a _dep_map whose environment markers are precomputed against the current interpreter.

In pants and pex we'd like to be able to correctly bundle multi-interpreter multi-architecture pex files from a single machine (e.g. a developer's OS X laptop.) In order to do this, we'd like to be able to pass a collection of serialized environment markers from other interpreters into requires().

One way to do this is to create a PEP426Marker namedtuple or dict (see the pex link above for an example) and have it as an optional kwarg for requires(). If present, recompute dependencies against those markers instead and use in lieu of the default _dep_map which is relative to the current environment.

This relates to #122. We could use the pep426 implementation from the pex branch pasted above to help do evaluation (it should be portable back to 2.4.x with a trivial amount of work.)


Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Distribution.requires and inspect how its _dep_map is precomputed from the current interpreter. Compare the proposed PEP426Marker approach with the linked pex implementation and related issue #122; done means requires() can accept serialized markers and evaluate dependencies for another environment without changing current-environment behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.