-
Notifications
You must be signed in to change notification settings - Fork 2
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
Comment in requirements file cause failed check #5
Comments
You are totally correct. I haven't been working on my projects lately. I see that some of them are starting to show their age. I'll see what I can do this week to rectify some of that. Also, I always accept pull requests that don't break backward compatibility. Thank you for the report. |
Thanks! Will keep that in mind. |
I managed to look into this today, and it seems the problem is in Traceback (most recent call last):
File "/home/cj/scripts/requirementz/requirementz/__main__.py", line 275, in entry_point
mainret = main(docopt(USAGESTR, version=VERSIONSTR, script=SCRIPT))
File "/home/cj/scripts/requirementz/requirementz/__main__.py", line 175, in main
location=argd['--location'],
File "/home/cj/scripts/requirementz/requirementz/__main__.py", line 225, in check_requirements
reqs = Requirementz.from_file(filename=filename)
File "/home/cj/scripts/requirementz/requirementz/tools.py", line 543, in from_file
reqs = cls.from_lines(f.readlines())
File "/home/cj/scripts/requirementz/requirementz/tools.py", line 553, in from_lines
for l in sorted(lines) if l.strip()
File "/home/cj/scripts/requirementz/requirementz/tools.py", line 482, in __init__
super(Requirementz, self).__init__(requirements or tuple())
File "/usr/lib/python3.6/collections/__init__.py", line 1039, in __init__
self.data = list(initlist)
File "/home/cj/scripts/requirementz/requirementz/tools.py", line 553, in <genexpr>
for l in sorted(lines) if l.strip()
File "/home/cj/.local/lib/python3.6/site-packages/requirements/requirement.py", line 220, in parse
return cls.parse_line(line)
File "/home/cj/.local/lib/python3.6/site-packages/requirements/requirement.py", line 198, in parse_line
pkg_req = Req.parse(line)
File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 3155, in parse
req, = parse_requirements(s)
ValueError: not enough values to unpack (expected 1, got 0) I'm depending on |
Thanks for having a look, yes it does appear that requirements-parser have a problem and its not likely that it will get updated, but you can of course ask the maintainer :) I also regularly use a tool called "pur" https://pypi.org/project/pur/ but it seems they implemented their own parser You could also consider creating a new file object in memory and just strip all comment lines, not exactly elegant approach but easy and should fix the problem for now. But personally I dont like to depend on unmaintained projects, its just pushing some unavoidable work ahead of you. I also had a quick look in pip |
Checking a requirements file with a comment (e.g. #comment) causes the following error:
not enough values to unpack (expected 1, got 0)
Comments should be allowed according to this:
https://pip.pypa.io/en/latest/reference/pip_install/#requirements-file-format
And it looks like the official example files also currently fails
https://pip.pypa.io/en/latest/reference/pip_install/#example-requirements-file
The text was updated successfully, but these errors were encountered: