Allow requirement.Marker.evaluate() with arbitrary environment
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 751
- Forks
- 324
- Avg merge
- 12h 58m
- Merged PRs (30d)
- 3
Description
One of the use case of the packaging library is to support tooling that may run in a different environment than the processed packages are intended for. For instance, I may want to process a Requirement.marker and evaluate() it on a different platform environment that is not the environment of the current Python interpreter. However, the evaluate() method environment arg can only update the environment and can never override/replace it entirely.
https://github.com/pypa/packaging/blob/8c78c35bc20fc7b4aacb7a71ad5f5db9817630c1/packaging/markers.py#L302
It would be useful for tools to be able to entirely override the environment rather than just updating it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in packaging/markers.py around the evaluate() method at the linked line, and inspect how the supplied environment is combined with the interpreter environment. Trace the existing marker evaluation coverage, then define and test behavior where a caller-provided environment fully replaces the default environment.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100