madpah / requirements-parser

A Pip requirements file parser.
https://requirements-parser.readthedocs.io
Apache License 2.0
125 stars 41 forks source link

Handle compress archive URLs #12

Closed treyhunner closed 11 years ago

treyhunner commented 11 years ago

Example with django master:

$ pep438 -r requirements.txt
Traceback (most recent call last):
  File "/usr/local/bin/pep438", line 9, in <module>
    load_entry_point('pep438==0.5.0', 'console_scripts', 'pep438')()
  File "/usr/local/lib/python2.7/dist-packages/pep438/main.py", line 84, in main
    packages += process_options(opts)
  File "/usr/local/lib/python2.7/dist-packages/pep438/main.py", line 54, in process_options
    packages += get_pypi_packages(f)
  File "/usr/local/lib/python2.7/dist-packages/pep438/core.py", line 33, in get_pypi_packages
    return [p['name'] for p in parse(fileobj) if not p.get('uri')]
  File "/usr/local/lib/python2.7/dist-packages/requirements/parser.py", line 84, in parse
    raise ValueError('Invalid requirement line "%s"' %line)
ValueError: Invalid requirement line "https://github.com/django/django/tarball/stable/1.6.x"
davidfischer commented 11 years ago

The latest requirement file format makes it seem like -e or --editable is totally optional which I don't believe used to be the case. That makes a requirement line that is just a URI valid. The name will just be None in the case the name can't be discovered.

davidfischer commented 11 years ago

This works now:

>>> list(parse('https://github.com/django/django/tarball/stable/1.6.x'))[0].uri
'https://github.com/django/django/tarball/stable/1.6.x'

Time to add more docs and release it.