Skip to content
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

"Unsupported URL scheme" exception when analyzing requirements file #173

Open
sschuberth opened this issue Feb 29, 2024 · 1 comment
Open

Comments

@sschuberth
Copy link
Contributor

sschuberth commented Feb 29, 2024

Using PI 0.11.0 to analyze the following requirements.txt file

-i https://pypi.org/simple
click==6.7
flask==1.0
itsdangerous==0.24
jinja2==2.10.1
markupsafe==1.1
werkzeug==0.15.3

gives

Traceback (most recent call last):
  File "/home/sebastian/.local/lib/python3.12/site-packages/python_inspector/resolve_cli.py", line 257, in resolve_dependencies
    resolution_result: Dict = resolver_api(
                              ^^^^^^^^^^^^^
  File "/home/sebastian/.local/lib/python3.12/site-packages/python_inspector/api.py", line 280, in resolve_dependencies
    resolution, purls = resolve(
                        ^^^^^^^^
  File "/home/sebastian/.local/lib/python3.12/site-packages/python_inspector/api.py", line 344, in resolve
    resolved_dependencies, packages = get_resolved_dependencies(
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sebastian/.local/lib/python3.12/site-packages/python_inspector/api.py", line 385, in get_resolved_dependencies
    resolver_results = resolver.resolve(requirements=requirements, max_rounds=max_rounds)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sebastian/.local/lib/python3.12/site-packages/resolvelib/resolvers.py", line 546, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sebastian/.local/lib/python3.12/site-packages/resolvelib/resolvers.py", line 397, in resolve
    self._add_to_criteria(self.state.criteria, r, parent=None)
  File "/home/sebastian/.local/lib/python3.12/site-packages/resolvelib/resolvers.py", line 148, in _add_to_criteria
    matches = self._p.find_matches(
              ^^^^^^^^^^^^^^^^^^^^^
  File "/home/sebastian/.local/lib/python3.12/site-packages/python_inspector/resolution.py", line 612, in find_matches
    candidates = sorted(
                 ^^^^^^^
  File "/home/sebastian/.local/lib/python3.12/site-packages/python_inspector/resolution.py", line 588, in _iter_matches
    versions.extend(self.get_versions_for_package(name=name, repo=repo))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sebastian/.local/lib/python3.12/site-packages/python_inspector/resolution.py", line 398, in get_versions_for_package
    return self.get_versions_for_package_from_repo(name, repo)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sebastian/.local/lib/python3.12/site-packages/python_inspector/resolution.py", line 409, in get_versions_for_package_from_repo
    for version, package in repo.get_package_versions(name).items():
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sebastian/.local/lib/python3.12/site-packages/python_inspector/utils_pypi.py", line 1548, in get_package_versions
    self._get_package_versions_map(
  File "/home/sebastian/.local/lib/python3.12/site-packages/python_inspector/utils_pypi.py", line 1516, in _get_package_versions_map
    links = self.fetch_links(
            ^^^^^^^^^^^^^^^^^
  File "/home/sebastian/.local/lib/python3.12/site-packages/python_inspector/utils_pypi.py", line 1594, in fetch_links
    text = CACHE.get(
           ^^^^^^^^^^
  File "/home/sebastian/.local/lib/python3.12/site-packages/python_inspector/utils_pypi.py", line 1685, in get
    content = get_file_content(
              ^^^^^^^^^^^^^^^^^
  File "/home/sebastian/.local/lib/python3.12/site-packages/python_inspector/utils_pypi.py", line 1734, in get_file_content
    raise Exception(f"Unsupported URL scheme: {path_or_url}")
Exception: Unsupported URL scheme: h/click

when run as

python-inspector --python-version 311 --operating-system linux --json-pdt /tmp/ort-PythonInspector17686323287359798582/python-inspector4677810856317566029.json --analyze-setup-py-insecurely --requirement requirements.txt

It used to work with PI 0.10.0, so this seems to be a regression.

This was discovered as part of running ORT tests.

sschuberth added a commit to oss-review-toolkit/ort that referenced this issue Feb 29, 2024
This reverts commit 46ecd08 as the new version causes [1].

[1]: aboutcode-org/python-inspector#173

Signed-off-by: Sebastian Schuberth <[email protected]>
sschuberth added a commit to oss-review-toolkit/ort that referenced this issue Feb 29, 2024
This reverts commit 46ecd08 as the new version causes [1].

[1]: aboutcode-org/python-inspector#173

Signed-off-by: Sebastian Schuberth <[email protected]>
sschuberth added a commit to oss-review-toolkit/ort that referenced this issue Feb 29, 2024
This reverts commit 46ecd08 as the new version causes [1].

[1]: aboutcode-org/python-inspector#173

Signed-off-by: Sebastian Schuberth <[email protected]>
mnonnenmacher added a commit to boschglobal/ort-server that referenced this issue Jun 18, 2024
Version 0.11.0 suffers from [1] which is why ORT is also still using
0.10.0 [2] by default.

[1]: aboutcode-org/python-inspector#173
[2]: oss-review-toolkit/ort#8363

Signed-off-by: Martin Nonnenmacher <[email protected]>
github-merge-queue bot pushed a commit to eclipse-apoapsis/ort-server that referenced this issue Jun 19, 2024
Version 0.11.0 suffers from [1] which is why ORT is also still using
0.10.0 [2] by default.

[1]: aboutcode-org/python-inspector#173
[2]: oss-review-toolkit/ort#8363

Signed-off-by: Martin Nonnenmacher <[email protected]>
@sschuberth
Copy link
Contributor Author

sschuberth commented Aug 9, 2024

Just to confirm the issue is still present in version 0.12.1, which prevents us from upgrading from version 0.10.0 in ORT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant