-
Notifications
You must be signed in to change notification settings - Fork 0
Description
When a requirement line have a comment after the specifier like this:
django-axes[ipware]==6.3.0 # django-ipware==6.0.3
The comment part (from # to the end of line) is not stripped when given to version parser and it is invalid and this return a InvalidRequirement object as the package data.
And when analyzer try to serialize data to JSON it leads to an exception:
TypeError: Object of type InvalidRequirement is not JSON serializable
This break the command operation and program aborts.
This kind of requirement line format (with a comment) is working in pip probably because it remove the comment part when parsing version but packaging module that comb uses to parse version does not allow it so it return the InvalidRequirement with message:
Expected end or semicolon (after version specifier ...)
The first thing to do is to ensure requirement line given to version parser has been cleaned from comment part, this should be easy on itself because # is only for comment so we can just split string and keep only the part before the #.
Then we should assert each version parsing result to ensure it is a valid Version object and not an invalid Requirement, which should trigger an humanized error and stop operation.