-
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
Expose Marker tree structure in the API #496
Comments
FWIW, if you know the supported set of environments, you can pass your own values for the environment, to evaluate the markers in those contexts.
This might make sense; although I'd want to make sure that we don't increase the API surface area, if there's an alternative solution possible on your end. |
(I'm aware that the example I've pointed to doesn't match your use case) |
Yeah, I tried to imagine how I'd do something similar, generating all the combinations of supported environments and passing them to I don't think that result would be much less hacky than our current regex-based parsing, which simply ignores any marker with more than 1 part. |
So I'd like to second the request for exposing the parsed marker AST. Evaluating the marker expression with an environment is not an option in my use case, enforcing a-priori restrictions on markers. Since the tool I'm working on already makes extensive use of this package, I did the expedient, accessing Having said that, I ran into a typing bug in my code that traces back to |
I'd like to be able to use a library like packaging in Debian's dh-python, to parse environment markers, rather than having to maintain our own hacky parser.
The use-case is parsing
.dist-info
metadata from a built package, during the build, to generate Debian package dependencies based on the Python module's declared dependencies.Similarly to #448, this means we're evaluating the markers for all supported environments, not just the current environment. So instead of a boolean
evaluate()
, we need to:Examples:
Requires-Dist: foo; (os_name == 'posix')
should result in a dependency onpython3-foo
.Requires-Dist: bar; python_version < '3.5'
should result in a dependency onpython3-bar | python3 (>= 3.5)
This means
evaluate()
is insufficient, for our needs. I really need to be able to walk the tree.Can we make more of the tree structure public API?
The text was updated successfully, but these errors were encountered: