requirements-parser
requirements-parser copied to clipboard
Support for platform specific dependencies.
The current version does not seem to store platform specific dependency information (although it seems to parse it just fine).
This is to handle lines like
jaraco.windows >= 3.9.1;platform_system=="Windows"
currently parsing this line returns an object with the data:
{'editable': False,
'extras': [],
'hash': None,
'hash_name': None,
'line': 'jaraco.windows >= 3.9.1;platform_system=="Windows"',
'local_file': False,
'name': 'jaraco.windows',
'path': None,
'revision': None,
'specifier': True,
'specs': [('>=', '3.9.1')],
'subdirectory': None,
'uri': None,
'vcs': None}
References on the spec are here: http://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-platform-specific-dependencies
In a similar fashion, versioned Python requirements are ignored too. I was looking into parsing code like this:
pylint == 1.9.5 ; python_version == '2.7' pylint == 2.4.4 ; python_version >= '3.6'
Sadly this means, I am doing a filtering for Python version on my own, because also pipenv ignores these. I take it, they are only comments, but obviously ones that pip attaches meanings to?
This would be helpful!
https://www.python.org/dev/peps/pep-0508/
search for
Environment markers allow making a specification only take effect in some environments:
This is a formally specified thing but not really straightforward unless you just want simple eval() with prefilling which isn't entirely safe.