Open tetsuo-cpp opened 2 years ago
@tetsuo-cpp Thanks! glad it can be of some help... yes, this is definitely worth having and adding and a PR would be mucho welcomed and swiftly merged!
Note that if tracking whitespaces requires some surgery in the underlying data model that's perfectly OK
Thanks for building
pip-requirements-parser
! I'm really happy with it.I noticed that if I parse a requirements file and then print it out with
dumps
, any leading whitespace before a requirement or comment gets removed. Example below:It seems that whitespace within the line is preserved, it's just when it exists at the beginning of the line that it gets stripped.
This matters to
pip-audit
because our use case involves parsing a requirements file and then rewriting it with some of the requirements modified. So any requirements files that have leading whitespace will have the whitespace removed when we rewrite a requirements file.The first example that comes to mind are automatic comments that are indented like those inserted by pip-compile.
Are you interested in having
pip-requirements-parser
support this use case? If so, I'm happy to take a stab at a PR.