Unclear how to evaluate a marker for a set of extras
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 751
- Forks
- 324
- Avg merge
- 12h 58m
- Merged PRs (30d)
- 3
Description
This is possibly similar to #448, but I think it's a different use case. I'm not completely clear on what "operations" #448 is meant to cover, so apologies if I missed that this is already part of that discussion.
I have two requirements:
a_req = Requirement("a[b,c]")
a_dep = Requirement("foo; extra == 'b'")
I want to check whether a_dep should apply, given that I am looking at it in the context of a_req. So, I have a set of extras, and I want to evaluate a_dep.marker to see if any apply. In the given case, I expect to get True.
The simplest way I can see is any(a_dep.marker.evaluate(environment={"extra": e}) for e in a_req.extras).
Is that the best way of doing this? Would it be useful to have an additional argument to Marker.evaluate() that specified a set of extras to check - then I could do a_dep.marker.evaluate(extras=a_req.extras) which seems more natural.
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 by reading Marker.evaluate and the related discussion in issue #448; the issue does not name implementation files or tests. Determine whether evaluating a marker against a set of extras is already supported or needs an API decision, and consider the issue resolved when that behavior and its expected result are clearly established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100