requirements-parser icon indicating copy to clipboard operation
requirements-parser copied to clipboard

Support for platform specific dependencies.

Open Erotemic opened this issue 6 years ago • 3 comments

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

Erotemic avatar Jun 30 '18 21:06 Erotemic

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?

kayhayen avatar Nov 23 '19 09:11 kayhayen

This would be helpful!

kousu avatar May 17 '20 08:05 kousu

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.

nanonyme avatar Dec 06 '20 20:12 nanonyme