You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2023-01-15T17:07:54.5426090Z _________________________ test_api_with_specifier_pdt __________________________
2023-01-15T17:07:54.5427340Z [gw0] darwin -- Python 3.7.15 /Users/runner/work/1/s/venv/bin/python
2023-01-15T17:07:54.5427640Z
2023-01-15T17:07:54.5428050Z def test_api_with_specifier_pdt():
2023-01-15T17:07:54.5428530Z result_file = test_env.get_temp_file("json")
2023-01-15T17:07:54.5429740Z expected_file = test_env.get_test_loc("test-api-pdt-expected.json", must_exist=False)
2023-01-15T17:07:54.5430460Z with open(result_file, "w") as result:
2023-01-15T17:07:54.5430880Z result.write(
2023-01-15T17:07:54.5431290Z json.dumps(
2023-01-15T17:07:54.5431710Z resolver_api(
2023-01-15T17:07:54.5432490Z specifiers=["flask==2.1.2"],
2023-01-15T17:07:54.5433370Z python_version="3.10",
2023-01-15T17:07:54.5433870Z operating_system="linux",
2023-01-15T17:07:54.5434290Z > pdt_output=True,
2023-01-15T17:07:54.5435350Z ).to_dict()
2023-01-15T17:07:54.5435690Z )
2023-01-15T17:07:54.5436080Z )
2023-01-15T17:07:54.5436210Z
2023-01-15T17:07:54.5436610Z tests/test_api.py:55:
2023-01-15T17:07:54.5437100Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2023-01-15T17:07:54.5437660Z src/python_inspector/api.py:160: in resolve_dependencies
2023-01-15T17:07:54.5438300Z dep = dependencies.get_dependency(specifier=specifier)
2023-01-15T17:07:54.5438890Z src/python_inspector/dependencies.py:69: in get_dependency
2023-01-15T17:07:54.5439390Z requirement_line=specifier,
2023-01-15T17:07:54.5439940Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2023-01-15T17:07:54.5440220Z
2023-01-15T17:07:54.5441510Z self = <[AttributeError("'InstallRequirement' object has no attribute 'req'") raised in repr()] InstallRequirement object at 0x10f3de290>
2023-01-15T17:07:54.5442820Z req = <Requirement('flask==2.1.2')>, requirement_line = 'flask==2.1.2'
2023-01-15T17:07:54.5443510Z link = None, marker = None, install_options = None, global_options = None
2023-01-15T17:07:54.5444250Z hash_options = None, is_constraint = False, extras = (), invalid_options = None
2023-01-15T17:07:54.5444560Z
2023-01-15T17:07:54.5444930Z def __init__(
2023-01-15T17:07:54.5445260Z self,
2023-01-15T17:07:54.5445640Z req: Optional[Requirement],
2023-01-15T17:07:54.5446130Z requirement_line: RequirementLine,
2023-01-15T17:07:54.5446590Z link: Optional[Link] = None,
2023-01-15T17:07:54.5447030Z marker: Optional[Marker] = None,
2023-01-15T17:07:54.5447490Z install_options: Optional[List[str]] = None,
2023-01-15T17:07:54.5448060Z global_options: Optional[List[str]] = None,
2023-01-15T17:07:54.5448570Z hash_options: Optional[List[str]] = None,
2023-01-15T17:07:54.5449020Z is_constraint: bool = False,
2023-01-15T17:07:54.5449500Z extras: Collection[str] = (),
2023-01-15T17:07:54.5450030Z invalid_options: Optional[Dict[str, Any]] = None,
2023-01-15T17:07:54.5450910Z ) -> None:
2023-01-15T17:07:54.5451280Z """
2023-01-15T17:07:54.5451720Z Initialize a new pip requirement
2023-01-15T17:07:54.5452090Z
2023-01-15T17:07:54.5453010Z - ``req`` is a packaging Requirement object that may be None
2023-01-15T17:07:54.5454170Z - ``requirement_line`` is the original line this requirement was found
2023-01-15T17:07:54.5455330Z - ``link`` is a Link object provided when the requirement is a path or URL
2023-01-15T17:07:54.5456560Z - ``marker`` is a packaging Marker object.
2023-01-15T17:07:54.5457160Z This is provided when a marker is used and there is no ``req`` Requirement.
2023-01-15T17:07:54.5458380Z - ``install_options``, ``global_options`` and ``hash_options`` are the
2023-01-15T17:07:54.5459550Z CLI-style pip options for this specifc requirement.
2023-01-15T17:07:54.5460630Z - ``is_constraint`` is True if this requirement came from loading a
2023-01-15T17:07:54.5461650Z nested ``-c/--constraint`` file.
2023-01-15T17:07:54.5462740Z - ``extras`` is a list of [extra] strings for this package.
2023-01-15T17:07:54.5463360Z This is provided when extras are used and there is no ``req`` Requirement.
2023-01-15T17:07:54.5464690Z - ``invalid_options`` are global pip options that are mistakenly set at the line-level.
2023-01-15T17:07:54.5465350Z This is an error.
2023-01-15T17:07:54.5465690Z """
2023-01-15T17:07:54.5466170Z > assert req is None or isinstance(req, Requirement), req
2023-01-15T17:07:54.5467210Z E AssertionError: <Requirement('flask==2.1.2')>
2023-01-15T17:07:54.5468660Z E assert (<Requirement('flask==2.1.2')> is None or False)
2023-01-15T17:07:54.5470340Z E + where False = isinstance(<Requirement('flask==2.1.2')>, Requirement)
2023-01-15T17:07:54.5470670Z
2023-01-15T17:07:54.5471700Z venv/lib/python3.7/site-packages/pip_requirements_parser.py:1970: AssertionError
is because packvers and packaging have different class hierarchies and it would be better to adopt a different approach.
packvers is a hard fork of packaging and is therefore not using the packaging.version base classes and does not benefit of packaging updates.
None of these two approached is satisfying. We should go a different way, which would be making packavers a lightweight fork of packaging.version that WOULD USE the packaging.version base classes.
The text was updated successfully, but these errors were encountered:
@benjamb yes either something like this, or just extracting the LegacyVersion only and only provide support for this. packaging as evolved massively since this fork was done.
This error at https://dev.azure.com/nexB/2b40e32d-2a30-4c1b-b0f0-7fb807f657bb/_apis/build/builds/9618/logs/48
is because packvers and packaging have different class hierarchies and it would be better to adopt a different approach.
https://github.com/nexB/pip-requirements-parser/blob/main/src/packaging_legacy_version.py is a lightweight fork of packaging.version but it does not use the packaging.version base classes
packvers is a hard fork of packaging and is therefore not using the packaging.version base classes and does not benefit of packaging updates.
None of these two approached is satisfying. We should go a different way, which would be making packavers a lightweight fork of packaging.version that WOULD USE the packaging.version base classes.
The text was updated successfully, but these errors were encountered: