-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unclear how to evaluate a marker for a set of extras #452
Comments
Well, that's definitely the best way to do it, as of today. Here's the relevant part in pip: |
Does PEP 508 forbid e.g. |
It does not, but it is also very unclear what the expression means. PEP 508 is very vague about extra in markers, and both the name |
I agree, one of the reasons I found it hard to work out how to do this is that extras are conceptually a set, but I doubt there's much hope of redesigning the semantics without a very extended debate, though, so we're probably stuck with what we have. I don't know if |
I’ve been planning a PEP in my head to “fix” extras once and for all. There’s no draft, but I’m thinking about doing three things:
BTW since this is going to bump the major version, I’m also thinking about doing two more things not strictly relavant here (but also related to extras):
Nothing concrete at this time though. Also anyone please feel free to steal any of the above idea if you have time to write a PEP 😄 |
https://peps.python.org/pep-0685/ takes care of the normalization problem (once it's accepted). |
I proposed the rest of the comment above to discuss at the Packaging Summit next week. |
nit: Call it |
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:
I want to check whether
a_dep
should apply, given that I am looking at it in the context ofa_req
. So, I have a set of extras, and I want to evaluatea_dep.marker
to see if any apply. In the given case, I expect to getTrue
.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 doa_dep.marker.evaluate(extras=a_req.extras)
which seems more natural.The text was updated successfully, but these errors were encountered: