-
Notifications
You must be signed in to change notification settings - Fork 16
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
Preserve comments and pre-evaluated markers when parsing requirements #120
Comments
I started to write a comment here about the long-term future of this function but turned it into #121 instead. Short term, I think we should add this to the existing parsing logic here. |
FWIW, I am preserving comments in this experiment at https://github.com/nexB/pip-requirements |
@woodruffw @di |
I've been revisiting this today. I think there's a bit of complexity here and if we want to implement this, we're going to need the following changes:
And ensure that it doesn't turn into:
Perhaps the solution is to add an optional trailing comment field to I've been looking at @pombredanne's |
Given #121, I'd say that any downstream library that wants to parse requirements files and preserve comments should probably take a dependency on |
@di @tetsuo-cpp I would be honored and I look forward to help with Also FWIW |
@di @pombredanne |
pip-api
currently (and very reasonably) strips these as part of itsparse_requirements
API, removing all comments and any requirement lines whose environment markers are not satisfied.This is the correct and ideal behavior for nearly all usecases, but pypa/pip-audit#225 requires slightly different behavior from the parser: in particular,
pip-audit -r ... --fix
should preserve all comments in the input requirements, as well as any requirement lines (and environment markers) that weren't evaluated.cc @tetsuo-cpp for thoughts on implementation here.
The text was updated successfully, but these errors were encountered: