Support combining markers?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 751
- Forks
- 324
- Avg merge
- 12h 58m
- Merged PRs (30d)
- 3
Description
I'm trying to write a PEP 621 consumer, and I'm having trouble with the optional-dependencies item. The issue is that I could potentially need to combine markers, and I don't see a particularly reliable way of doing so. Consider:
[project.optional-dependencies]
test = [
"pytest < 5.0.0",
"pytest-cov[all]",
"pywin32; os_name == 'nt'"
]
To construct Requires-Dist from this, I need to add a dependency pywin32; os_name == 'nt' and extra == 'test'.
The best way I can see of doing this is
req = Requirement(req_str)
if req.marker is None:
req.marker = Marker(f"extra == '{extra_name}'")
else:
req.marker = Marker(f"({req.marker}) and extra == '{extra_name}'")
requires_dist.append(str(req))
Is that the best way of doing this? It would be extremely useful in this situation if markers supported & and | operations, to avoid the error-prone conversion to and from strings.
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 the Requirement and Marker entry points referenced in the issue, then inspect how marker strings are parsed and rendered. Determine the intended semantics and API for combining markers, including precedence and parentheses, and validate the design against the PEP 621 optional-dependencies example.
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
- Mostly clear
- Newbie friendliness
- 25/100