python-inspector 0.15.0__tar.gz → 0.15.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_inspector-0.15.0 → python_inspector-0.15.2}/CHANGELOG.rst +11 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/PKG-INFO +7 -7
- {python_inspector-0.15.0 → python_inspector-0.15.2}/requirements-dev.txt +2 -2
- {python_inspector-0.15.0 → python_inspector-0.15.2}/requirements.txt +1 -1
- {python_inspector-0.15.0 → python_inspector-0.15.2}/setup.cfg +7 -7
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/api.py +5 -1
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/package_data.py +85 -7
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/resolve_cli.py +2 -1
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/utils_pypi.py +16 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector.egg-info/PKG-INFO +7 -7
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector.egg-info/requires.txt +6 -6
- {python_inspector-0.15.0 → python_inspector-0.15.2}/tests/test_api.py +34 -16
- {python_inspector-0.15.0 → python_inspector-0.15.2}/.gitignore +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/.readthedocs.yml +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/AUTHORS.rst +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/CODE_OF_CONDUCT.rst +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/MANIFEST.in +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/Makefile +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/NOTICE +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/README.rst +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/apache-2.0.LICENSE +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/azure-pipelines.yml +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/configure +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/configure.bat +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/docs/Makefile +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/docs/make.bat +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/docs/source/_static/theme_overrides.css +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/docs/source/conf.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/docs/source/contribute/contrib_doc.rst +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/docs/source/dependencies-design.rst +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/docs/source/index.rst +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/docs/source/test-protocol.rst +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/ci/azure-container-deb.yml +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/ci/azure-container-rpm.yml +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/ci/azure-posix.yml +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/ci/azure-win.yml +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/ci/install_sudo.sh +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/ci/macports-ci +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/ci/macports-ci.ABOUT +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/ci/mit.LICENSE +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/README.rst +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/check_thirdparty.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/fetch_thirdparty.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/gen_pypi_simple.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/gen_pypi_simple.py.ABOUT +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/gen_pypi_simple.py.NOTICE +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/gen_requirements.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/gen_requirements_dev.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/requirements.txt +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/test_utils_pip_compatibility_tags.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/test_utils_pip_compatibility_tags.py.ABOUT +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/test_utils_pypi_supported_tags.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/test_utils_pypi_supported_tags.py.ABOUT +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/update_skeleton.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/utils_dejacode.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/utils_pip_compatibility_tags.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/utils_pip_compatibility_tags.py.ABOUT +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/utils_pypi_supported_tags.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/utils_pypi_supported_tags.py.ABOUT +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/utils_requirements.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/utils_thirdparty.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/utils_thirdparty.py.ABOUT +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/pyproject.toml +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/requirements_builder.ABOUT +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/setup.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/_packagedcode/__init__.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/_packagedcode/models.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/_packagedcode/pypi.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/_packagedcode/pypi.py.ABOUT +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/_packagedcode/pypi.py.NOTICE +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/_packagedcode/pypi_setup_py.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/_packagedcode/pypi_setup_py.py.ABOUT +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/_packagedcode/pypi_setup_py.py.LICENSE +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/_packagedcode/utils.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/__init__.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/cli_utils.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/dependencies.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/error.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/lockfile.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/resolution.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/resolution.py.ABOUT +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/resolution.py.LICENSE +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/settings.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/setup_py_live_eval.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/setup_py_live_eval.py.ABOUT +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/setup_py_live_eval.py.LICENSE +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/utils.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/utils_pip_compatibility_tags.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/utils_pip_compatibility_tags.py.ABOUT +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/utils_pypi.py.ABOUT +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/utils_pypi_supported_tags.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/utils_pypi_supported_tags.py.ABOUT +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector.egg-info/SOURCES.txt +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector.egg-info/dependency_links.txt +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector.egg-info/entry_points.txt +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector.egg-info/not-zip-safe +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector.egg-info/top_level.txt +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/tests/test_cli.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/tests/test_packagecode_pypi.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/tests/test_pypi.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/tests/test_requirement_parsing.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/tests/test_resolution.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/tests/test_setup_py_live_eval.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/tests/test_setup_py_parsing.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/tests/test_utils.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/tests/test_utils_pip_compatibility_tags.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/tests/test_utils_pypi.py +0 -0
- {python_inspector-0.15.0 → python_inspector-0.15.2}/tests/test_utils_pypi_supported_tags.py +0 -0
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
+
v0.15.2
|
|
5
|
+
-----------
|
|
6
|
+
- Correct the version number in the CLI and setup.cfg.
|
|
7
|
+
|
|
8
|
+
v0.15.1
|
|
9
|
+
-----------
|
|
10
|
+
|
|
11
|
+
- Fetch package metadata from private artifactory if specified https://github.com/aboutcode-org/python-inspector/pull/261
|
|
12
|
+
- Add zip file cache validation https://github.com/aboutcode-org/python-inspector/pull/256
|
|
13
|
+
|
|
14
|
+
|
|
4
15
|
v0.15.0
|
|
5
16
|
-----------
|
|
6
17
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-inspector
|
|
3
|
-
Version: 0.15.
|
|
3
|
+
Version: 0.15.2
|
|
4
4
|
Summary: python-inspector is is a collection of utilities to collect PyPI package metadata and resolve packages dependencies.
|
|
5
5
|
Home-page: https://github.com/aboutcode-org/python-inspector
|
|
6
6
|
Author: nexB. Inc. and others
|
|
@@ -49,13 +49,13 @@ Requires-Dist: twine; extra == "dev"
|
|
|
49
49
|
Requires-Dist: ruff; extra == "dev"
|
|
50
50
|
Requires-Dist: pytest-rerunfailures; extra == "dev"
|
|
51
51
|
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
|
|
52
|
-
Requires-Dist: Sphinx
|
|
53
|
-
Requires-Dist:
|
|
54
|
-
Requires-Dist: sphinx-
|
|
55
|
-
Requires-Dist:
|
|
56
|
-
Requires-Dist:
|
|
52
|
+
Requires-Dist: Sphinx<9,>=7.3; extra == "dev"
|
|
53
|
+
Requires-Dist: sphinx_rtd_theme<4,>=3; extra == "dev"
|
|
54
|
+
Requires-Dist: sphinx-autobuild>=2024.10.3; extra == "dev"
|
|
55
|
+
Requires-Dist: sphinx_reredirects; extra == "dev"
|
|
56
|
+
Requires-Dist: doc8>=1.1.2; extra == "dev"
|
|
57
57
|
Requires-Dist: sphinx-rtd-dark-mode>=1.3.0; extra == "dev"
|
|
58
|
-
Requires-Dist: sphinx-copybutton; extra == "dev"
|
|
58
|
+
Requires-Dist: sphinx-copybutton>=0.5; extra == "dev"
|
|
59
59
|
Dynamic: license-file
|
|
60
60
|
|
|
61
61
|
python-inspector - inspect Python package dependencies and metadata
|
|
@@ -5,7 +5,7 @@ boolean.py==4.0
|
|
|
5
5
|
cffi==1.15.0
|
|
6
6
|
cryptography==37.0.2
|
|
7
7
|
dataclasses==0.8
|
|
8
|
-
docutils
|
|
8
|
+
docutils>=0.20,<0.22
|
|
9
9
|
et-xmlfile==1.1.0
|
|
10
10
|
execnet==2.1.1
|
|
11
11
|
importlib-resources==5.4.0
|
|
@@ -25,7 +25,7 @@ pluggy==1.6.0
|
|
|
25
25
|
py==1.11.0
|
|
26
26
|
pycodestyle==2.8.0
|
|
27
27
|
pycparser==2.21
|
|
28
|
-
pygments==2.
|
|
28
|
+
pygments==2.17.0
|
|
29
29
|
pytest==8.4.0
|
|
30
30
|
pytest-xdist==3.7.0
|
|
31
31
|
pytest-forked==1.6.0
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
name = python-inspector
|
|
3
3
|
license = Apache-2.0
|
|
4
|
-
version = 0.15.
|
|
4
|
+
version = 0.15.2
|
|
5
5
|
description = python-inspector is is a collection of utilities to collect PyPI package metadata and resolve packages dependencies.
|
|
6
6
|
long_description = file:README.rst
|
|
7
7
|
long_description_content_type = text/x-rst
|
|
@@ -83,13 +83,13 @@ dev =
|
|
|
83
83
|
ruff
|
|
84
84
|
pytest-rerunfailures
|
|
85
85
|
pytest-asyncio >= 0.21
|
|
86
|
-
Sphinx>=
|
|
87
|
-
|
|
88
|
-
sphinx-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
Sphinx>=7.3,<9
|
|
87
|
+
sphinx_rtd_theme>=3,<4
|
|
88
|
+
sphinx-autobuild>=2024.10.3
|
|
89
|
+
sphinx_reredirects
|
|
90
|
+
doc8>=1.1.2
|
|
91
91
|
sphinx-rtd-dark-mode>=1.3.0
|
|
92
|
-
sphinx-copybutton
|
|
92
|
+
sphinx-copybutton>=0.5
|
|
93
93
|
|
|
94
94
|
[egg_info]
|
|
95
95
|
tag_build =
|
|
@@ -296,7 +296,11 @@ def resolve_dependencies(
|
|
|
296
296
|
async def gather_pypi_data():
|
|
297
297
|
async def get_pypi_data(package):
|
|
298
298
|
data = await get_pypi_data_from_purl(
|
|
299
|
-
package,
|
|
299
|
+
package,
|
|
300
|
+
repos=repos,
|
|
301
|
+
environment=environment,
|
|
302
|
+
prefer_source=prefer_source,
|
|
303
|
+
index_urls=list(repos_by_url.keys()),
|
|
300
304
|
)
|
|
301
305
|
|
|
302
306
|
if verbose:
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
# See https://aboutcode.org for more information about nexB OSS projects.
|
|
10
10
|
#
|
|
11
11
|
|
|
12
|
+
import os
|
|
13
|
+
from urllib.parse import urlparse, urlunparse
|
|
14
|
+
|
|
12
15
|
from typing import Dict
|
|
13
16
|
from typing import List
|
|
14
17
|
from typing import Optional
|
|
@@ -27,7 +30,11 @@ from python_inspector.utils_pypi import PypiSimpleRepository
|
|
|
27
30
|
|
|
28
31
|
|
|
29
32
|
async def get_pypi_data_from_purl(
|
|
30
|
-
purl: str,
|
|
33
|
+
purl: str,
|
|
34
|
+
environment: Environment,
|
|
35
|
+
repos: List[PypiSimpleRepository],
|
|
36
|
+
prefer_source: bool,
|
|
37
|
+
index_urls: List[str],
|
|
31
38
|
) -> Optional[PackageData]:
|
|
32
39
|
"""
|
|
33
40
|
Generate `Package` object from the `purl` string of pypi type
|
|
@@ -43,7 +50,22 @@ async def get_pypi_data_from_purl(
|
|
|
43
50
|
version = parsed_purl.version
|
|
44
51
|
if not version:
|
|
45
52
|
raise Exception("Version is not specified in the purl")
|
|
46
|
-
|
|
53
|
+
|
|
54
|
+
# Todo: address the case where several index URLs are passed
|
|
55
|
+
if index_urls:
|
|
56
|
+
# Backward compatibility: If pypi.org is passed as index url, always resolve against it.
|
|
57
|
+
# When multiple index URLs are supported and the todo above is fixed, then this hack can be removed.
|
|
58
|
+
if "https://pypi.org/simple" in index_urls:
|
|
59
|
+
index_url = None
|
|
60
|
+
else:
|
|
61
|
+
index_url = index_urls[0]
|
|
62
|
+
else:
|
|
63
|
+
index_url = None
|
|
64
|
+
|
|
65
|
+
base_path = (
|
|
66
|
+
index_url.removesuffix("/simple") + "/pypi" if index_url else "https://pypi.org/pypi"
|
|
67
|
+
)
|
|
68
|
+
|
|
47
69
|
api_url = f"{base_path}/{name}/{version}/json"
|
|
48
70
|
|
|
49
71
|
from python_inspector.utils import get_response_async
|
|
@@ -62,10 +84,32 @@ async def get_pypi_data_from_purl(
|
|
|
62
84
|
sdist_url = await get_sdist_download_url(
|
|
63
85
|
purl=parsed_purl, repos=repos, python_version=python_version
|
|
64
86
|
)
|
|
87
|
+
|
|
88
|
+
def canonicalize_url(url: str):
|
|
89
|
+
# Parse the URL into its components
|
|
90
|
+
parsed = urlparse(url)
|
|
91
|
+
|
|
92
|
+
# Canonicalize the path component to resolve ".."
|
|
93
|
+
# os.path.normpath will handle segments like '.' and '..'
|
|
94
|
+
canonical_path = os.path.normpath(parsed.path)
|
|
95
|
+
|
|
96
|
+
# On Windows, normpath uses backslashes ('\\').
|
|
97
|
+
# We must replace them with forward slashes ('/') for a valid URL path.
|
|
98
|
+
if os.path.sep == "\\":
|
|
99
|
+
canonical_path = canonical_path.replace("\\", "/")
|
|
100
|
+
|
|
101
|
+
# Rebuild the URL with the canonicalized path
|
|
102
|
+
# We replace the original path with the new one
|
|
103
|
+
parsed = parsed._replace(path=canonical_path)
|
|
104
|
+
canonical_url = urlunparse(parsed)
|
|
105
|
+
|
|
106
|
+
return canonical_url
|
|
107
|
+
|
|
65
108
|
if sdist_url:
|
|
66
109
|
valid_distribution_urls.append(sdist_url)
|
|
67
110
|
|
|
68
111
|
valid_distribution_urls = [url for url in valid_distribution_urls if url]
|
|
112
|
+
valid_distribution_urls = list(map(canonicalize_url, valid_distribution_urls))
|
|
69
113
|
|
|
70
114
|
# if prefer_source is True then only source distribution is used
|
|
71
115
|
# in case of no source distribution available then wheel is used
|
|
@@ -81,28 +125,60 @@ async def get_pypi_data_from_purl(
|
|
|
81
125
|
]
|
|
82
126
|
wheel_url = choose_single_wheel(wheel_urls)
|
|
83
127
|
if wheel_url:
|
|
84
|
-
valid_distribution_urls.insert(0, wheel_url)
|
|
128
|
+
valid_distribution_urls.insert(0, canonicalize_url(wheel_url))
|
|
85
129
|
|
|
86
130
|
urls = {url.get("url"): url for url in response.get("urls") or []}
|
|
131
|
+
|
|
132
|
+
# Sanitize all URLs that are relative and canonicalize them
|
|
133
|
+
urls_sanitized = {}
|
|
134
|
+
for url in urls:
|
|
135
|
+
value = urls.get(url)
|
|
136
|
+
|
|
137
|
+
# remove the URL anchor fragment
|
|
138
|
+
url_parsed = urlparse(url)
|
|
139
|
+
url = urlunparse(url_parsed._replace(fragment=""))
|
|
140
|
+
|
|
141
|
+
if url.startswith("https"):
|
|
142
|
+
url_sanitized = canonicalize_url(url)
|
|
143
|
+
else:
|
|
144
|
+
url_sanitized = canonicalize_url(base_path + url)
|
|
145
|
+
|
|
146
|
+
urls_sanitized[url_sanitized] = value
|
|
147
|
+
|
|
148
|
+
def remove_credentials_from_url(url: str):
|
|
149
|
+
# Parse the URL into its components
|
|
150
|
+
parsed = urlparse(url)
|
|
151
|
+
|
|
152
|
+
new_netloc = parsed.hostname
|
|
153
|
+
if parsed.port:
|
|
154
|
+
new_netloc += f":{parsed.port}"
|
|
155
|
+
|
|
156
|
+
# Create a new parsed result object, replacing the old netloc
|
|
157
|
+
# with our new one that has no credentials.
|
|
158
|
+
parsed = parsed._replace(netloc=new_netloc)
|
|
159
|
+
url_without_credentials = urlunparse(parsed)
|
|
160
|
+
|
|
161
|
+
return url_without_credentials
|
|
162
|
+
|
|
87
163
|
# iterate over the valid distribution urls and return the first
|
|
88
164
|
# one that is matching.
|
|
89
165
|
for dist_url in valid_distribution_urls:
|
|
90
|
-
if dist_url not in
|
|
166
|
+
if dist_url not in urls_sanitized:
|
|
91
167
|
continue
|
|
92
168
|
|
|
93
|
-
url_data =
|
|
169
|
+
url_data = urls_sanitized.get(dist_url)
|
|
94
170
|
digests = url_data.get("digests") or {}
|
|
95
171
|
|
|
96
172
|
return PackageData(
|
|
97
173
|
primary_language="Python",
|
|
98
174
|
description=get_description(info),
|
|
99
175
|
homepage_url=homepage_url,
|
|
100
|
-
api_data_url=api_url,
|
|
176
|
+
api_data_url=remove_credentials_from_url(api_url),
|
|
101
177
|
bug_tracking_url=bug_tracking_url,
|
|
102
178
|
code_view_url=code_view_url,
|
|
103
179
|
license_expression=info.get("license_expression"),
|
|
104
180
|
declared_license=get_declared_license(info),
|
|
105
|
-
download_url=dist_url,
|
|
181
|
+
download_url=remove_credentials_from_url(dist_url),
|
|
106
182
|
size=url_data.get("size"),
|
|
107
183
|
md5=digests.get("md5") or url_data.get("md5_digest"),
|
|
108
184
|
sha256=digests.get("sha256"),
|
|
@@ -122,6 +198,8 @@ async def get_pypi_data_from_purl(
|
|
|
122
198
|
|
|
123
199
|
|
|
124
200
|
def choose_single_wheel(wheel_urls: List[str]) -> Optional[str]:
|
|
201
|
+
# fix Issue 240 - TypeError: '<' not supported between instances of 'str' and 'NoneType'
|
|
202
|
+
wheel_urls = [url for url in wheel_urls if url is not None]
|
|
125
203
|
"""
|
|
126
204
|
Sort wheel urls descendingly and return the first one
|
|
127
205
|
"""
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
#
|
|
11
11
|
|
|
12
12
|
from typing import Dict
|
|
13
|
+
from importlib.metadata import version
|
|
13
14
|
|
|
14
15
|
import click
|
|
15
16
|
|
|
@@ -21,7 +22,7 @@ from python_inspector.utils import write_output_in_file
|
|
|
21
22
|
|
|
22
23
|
TRACE = False
|
|
23
24
|
|
|
24
|
-
__version__ = "
|
|
25
|
+
__version__ = version("python-inspector")
|
|
25
26
|
|
|
26
27
|
DEFAULT_PYTHON_VERSION = settings.DEFAULT_PYTHON_VERSION
|
|
27
28
|
PYPI_SIMPLE_URL = settings.PYPI_SIMPLE_URL
|
|
@@ -34,6 +34,7 @@ import aiohttp
|
|
|
34
34
|
import attr
|
|
35
35
|
import packageurl
|
|
36
36
|
import requests
|
|
37
|
+
import zipfile
|
|
37
38
|
from bs4 import BeautifulSoup
|
|
38
39
|
from commoncode import fileutils
|
|
39
40
|
from commoncode.hash import multi_checksums
|
|
@@ -1698,6 +1699,21 @@ class Cache:
|
|
|
1698
1699
|
|
|
1699
1700
|
cache_valid = os.path.exists(cached) and os.path.getsize(cached) > 0
|
|
1700
1701
|
|
|
1702
|
+
# Validate cached wheel/egg files.
|
|
1703
|
+
if cache_valid and not as_text:
|
|
1704
|
+
if path_or_url.endswith((".whl", ".egg", ".zip")):
|
|
1705
|
+
try:
|
|
1706
|
+
cached_resolved = os.path.realpath(cached)
|
|
1707
|
+
if not zipfile.is_zipfile(cached_resolved):
|
|
1708
|
+
if TRACE_DEEP:
|
|
1709
|
+
print(f" FILE CACHE INVALID (corrupted zip): {path_or_url}")
|
|
1710
|
+
cache_valid = False
|
|
1711
|
+
except (FileNotFoundError, OSError):
|
|
1712
|
+
# File was deleted/modified by another task - treat as cache miss
|
|
1713
|
+
if TRACE_DEEP:
|
|
1714
|
+
print(f" FILE CACHE VANISHED during validation: {path_or_url}")
|
|
1715
|
+
cache_valid = False
|
|
1716
|
+
|
|
1701
1717
|
if force or not cache_valid:
|
|
1702
1718
|
if not cache_valid and os.path.exists(cached):
|
|
1703
1719
|
if TRACE_DEEP:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-inspector
|
|
3
|
-
Version: 0.15.
|
|
3
|
+
Version: 0.15.2
|
|
4
4
|
Summary: python-inspector is is a collection of utilities to collect PyPI package metadata and resolve packages dependencies.
|
|
5
5
|
Home-page: https://github.com/aboutcode-org/python-inspector
|
|
6
6
|
Author: nexB. Inc. and others
|
|
@@ -49,13 +49,13 @@ Requires-Dist: twine; extra == "dev"
|
|
|
49
49
|
Requires-Dist: ruff; extra == "dev"
|
|
50
50
|
Requires-Dist: pytest-rerunfailures; extra == "dev"
|
|
51
51
|
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
|
|
52
|
-
Requires-Dist: Sphinx
|
|
53
|
-
Requires-Dist:
|
|
54
|
-
Requires-Dist: sphinx-
|
|
55
|
-
Requires-Dist:
|
|
56
|
-
Requires-Dist:
|
|
52
|
+
Requires-Dist: Sphinx<9,>=7.3; extra == "dev"
|
|
53
|
+
Requires-Dist: sphinx_rtd_theme<4,>=3; extra == "dev"
|
|
54
|
+
Requires-Dist: sphinx-autobuild>=2024.10.3; extra == "dev"
|
|
55
|
+
Requires-Dist: sphinx_reredirects; extra == "dev"
|
|
56
|
+
Requires-Dist: doc8>=1.1.2; extra == "dev"
|
|
57
57
|
Requires-Dist: sphinx-rtd-dark-mode>=1.3.0; extra == "dev"
|
|
58
|
-
Requires-Dist: sphinx-copybutton; extra == "dev"
|
|
58
|
+
Requires-Dist: sphinx-copybutton>=0.5; extra == "dev"
|
|
59
59
|
Dynamic: license-file
|
|
60
60
|
|
|
61
61
|
python-inspector - inspect Python package dependencies and metadata
|
{python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector.egg-info/requires.txt
RENAMED
|
@@ -27,10 +27,10 @@ twine
|
|
|
27
27
|
ruff
|
|
28
28
|
pytest-rerunfailures
|
|
29
29
|
pytest-asyncio>=0.21
|
|
30
|
-
Sphinx
|
|
31
|
-
|
|
32
|
-
sphinx-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
Sphinx<9,>=7.3
|
|
31
|
+
sphinx_rtd_theme<4,>=3
|
|
32
|
+
sphinx-autobuild>=2024.10.3
|
|
33
|
+
sphinx_reredirects
|
|
34
|
+
doc8>=1.1.2
|
|
35
35
|
sphinx-rtd-dark-mode>=1.3.0
|
|
36
|
-
sphinx-copybutton
|
|
36
|
+
sphinx-copybutton>=0.5
|
|
@@ -21,20 +21,24 @@ from python_inspector.api import resolver_api
|
|
|
21
21
|
test_env = FileDrivenTesting()
|
|
22
22
|
test_env.test_data_dir = os.path.join(os.path.dirname(__file__), "data")
|
|
23
23
|
|
|
24
|
+
REGEN_TEST_FIXTURES = os.getenv("PYINSP_REGEN_TEST_FIXTURES", False)
|
|
25
|
+
|
|
24
26
|
|
|
25
27
|
@pytest.mark.online
|
|
26
|
-
def test_api_with_specifier():
|
|
28
|
+
def test_api_with_specifier(regen=REGEN_TEST_FIXTURES):
|
|
27
29
|
expected_file = test_env.get_test_loc("test-api-expected.json", must_exist=False)
|
|
28
30
|
results = resolver_api(
|
|
29
31
|
specifiers=["flask==2.1.2"],
|
|
30
32
|
python_version="3.10",
|
|
31
33
|
operating_system="linux",
|
|
32
34
|
)
|
|
33
|
-
check_data_results(
|
|
35
|
+
check_data_results(
|
|
36
|
+
results=results.to_dict(generic_paths=True), expected_file=expected_file, regen=regen
|
|
37
|
+
)
|
|
34
38
|
|
|
35
39
|
|
|
36
40
|
@pytest.mark.online
|
|
37
|
-
def test_api_with_specifier_pdt():
|
|
41
|
+
def test_api_with_specifier_pdt(regen=REGEN_TEST_FIXTURES):
|
|
38
42
|
expected_file = test_env.get_test_loc("test-api-pdt-expected.json", must_exist=False)
|
|
39
43
|
results = resolver_api(
|
|
40
44
|
specifiers=["flask==2.1.2"],
|
|
@@ -42,22 +46,26 @@ def test_api_with_specifier_pdt():
|
|
|
42
46
|
operating_system="linux",
|
|
43
47
|
pdt_output=True,
|
|
44
48
|
)
|
|
45
|
-
check_data_results(
|
|
49
|
+
check_data_results(
|
|
50
|
+
results=results.to_dict(generic_paths=True), expected_file=expected_file, regen=regen
|
|
51
|
+
)
|
|
46
52
|
|
|
47
53
|
|
|
48
54
|
@pytest.mark.online
|
|
49
|
-
def test_api_with_requirement_file():
|
|
55
|
+
def test_api_with_requirement_file(regen=REGEN_TEST_FIXTURES):
|
|
50
56
|
expected_file = test_env.get_test_loc("test-api-with-requirement-file.json", must_exist=False)
|
|
51
57
|
results = resolver_api(
|
|
52
58
|
python_version="3.10",
|
|
53
59
|
operating_system="linux",
|
|
54
60
|
requirement_files=[test_env.get_test_loc("frozen-requirements.txt")],
|
|
55
61
|
)
|
|
56
|
-
check_data_results(
|
|
62
|
+
check_data_results(
|
|
63
|
+
results=results.to_dict(generic_paths=True), expected_file=expected_file, regen=regen
|
|
64
|
+
)
|
|
57
65
|
|
|
58
66
|
|
|
59
67
|
@pytest.mark.online
|
|
60
|
-
def test_api_with_prefer_source():
|
|
68
|
+
def test_api_with_prefer_source(regen=REGEN_TEST_FIXTURES):
|
|
61
69
|
expected_file = test_env.get_test_loc("test-api-with-prefer-source.json", must_exist=False)
|
|
62
70
|
results = resolver_api(
|
|
63
71
|
specifiers=["flask==2.1.2"],
|
|
@@ -65,11 +73,13 @@ def test_api_with_prefer_source():
|
|
|
65
73
|
operating_system="linux",
|
|
66
74
|
prefer_source=True,
|
|
67
75
|
)
|
|
68
|
-
check_data_results(
|
|
76
|
+
check_data_results(
|
|
77
|
+
results=results.to_dict(generic_paths=True), expected_file=expected_file, regen=regen
|
|
78
|
+
)
|
|
69
79
|
|
|
70
80
|
|
|
71
81
|
@pytest.mark.online
|
|
72
|
-
def test_api_with_recursive_requirement_file():
|
|
82
|
+
def test_api_with_recursive_requirement_file(regen=REGEN_TEST_FIXTURES):
|
|
73
83
|
requirement_file = test_env.get_test_loc("recursive_requirements/r.txt")
|
|
74
84
|
expected_file = test_env.get_test_loc(
|
|
75
85
|
"test-api-with-recursive-requirement-file.json", must_exist=False
|
|
@@ -79,7 +89,9 @@ def test_api_with_recursive_requirement_file():
|
|
|
79
89
|
operating_system="linux",
|
|
80
90
|
requirement_files=[requirement_file],
|
|
81
91
|
)
|
|
82
|
-
check_data_results(
|
|
92
|
+
check_data_results(
|
|
93
|
+
results=results.to_dict(generic_paths=True), expected_file=expected_file, regen=regen
|
|
94
|
+
)
|
|
83
95
|
|
|
84
96
|
|
|
85
97
|
def test_api_with_no_os():
|
|
@@ -103,7 +115,7 @@ def test_api_with_wrong_pyver():
|
|
|
103
115
|
|
|
104
116
|
|
|
105
117
|
@pytest.mark.online
|
|
106
|
-
def test_api_with_python_311():
|
|
118
|
+
def test_api_with_python_311(regen=REGEN_TEST_FIXTURES):
|
|
107
119
|
expected_file = test_env.get_test_loc("test-api-with-python-311.json", must_exist=False)
|
|
108
120
|
results = resolver_api(
|
|
109
121
|
specifiers=["flask==2.1.2"],
|
|
@@ -111,11 +123,13 @@ def test_api_with_python_311():
|
|
|
111
123
|
operating_system="linux",
|
|
112
124
|
prefer_source=True,
|
|
113
125
|
)
|
|
114
|
-
check_data_results(
|
|
126
|
+
check_data_results(
|
|
127
|
+
results=results.to_dict(generic_paths=True), expected_file=expected_file, regen=regen
|
|
128
|
+
)
|
|
115
129
|
|
|
116
130
|
|
|
117
131
|
@pytest.mark.online
|
|
118
|
-
def test_api_with_lief_python_312():
|
|
132
|
+
def test_api_with_lief_python_312(regen=REGEN_TEST_FIXTURES):
|
|
119
133
|
expected_file = test_env.get_test_loc("test-api-with-lief-python-312.json", must_exist=False)
|
|
120
134
|
results = resolver_api(
|
|
121
135
|
specifiers=["lief==0.15.1"],
|
|
@@ -123,11 +137,13 @@ def test_api_with_lief_python_312():
|
|
|
123
137
|
operating_system="linux",
|
|
124
138
|
prefer_source=True,
|
|
125
139
|
)
|
|
126
|
-
check_data_results(
|
|
140
|
+
check_data_results(
|
|
141
|
+
results=results.to_dict(generic_paths=True), expected_file=expected_file, regen=regen
|
|
142
|
+
)
|
|
127
143
|
|
|
128
144
|
|
|
129
145
|
@pytest.mark.online
|
|
130
|
-
def test_api_with_partial_setup_py():
|
|
146
|
+
def test_api_with_partial_setup_py(regen=REGEN_TEST_FIXTURES):
|
|
131
147
|
expected_file = test_env.get_test_loc("test-api-with-partial-setup-py.json", must_exist=False)
|
|
132
148
|
results = resolver_api(
|
|
133
149
|
python_version="3.11",
|
|
@@ -136,7 +152,9 @@ def test_api_with_partial_setup_py():
|
|
|
136
152
|
prefer_source=True,
|
|
137
153
|
analyze_setup_py_insecurely=True,
|
|
138
154
|
)
|
|
139
|
-
check_data_results(
|
|
155
|
+
check_data_results(
|
|
156
|
+
results=results.to_dict(generic_paths=True), expected_file=expected_file, regen=regen
|
|
157
|
+
)
|
|
140
158
|
|
|
141
159
|
|
|
142
160
|
def test_get_index_urls():
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/test_utils_pip_compatibility_tags.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/test_utils_pypi_supported_tags.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/utils_pip_compatibility_tags.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/utils_pypi_supported_tags.py
RENAMED
|
File without changes
|
{python_inspector-0.15.0 → python_inspector-0.15.2}/etc/scripts/utils_pypi_supported_tags.py.ABOUT
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_inspector-0.15.0 → python_inspector-0.15.2}/src/_packagedcode/pypi_setup_py.py.ABOUT
RENAMED
|
File without changes
|
{python_inspector-0.15.0 → python_inspector-0.15.2}/src/_packagedcode/pypi_setup_py.py.LICENSE
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/resolution.py.ABOUT
RENAMED
|
File without changes
|
{python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/resolution.py.LICENSE
RENAMED
|
File without changes
|
|
File without changes
|
{python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/setup_py_live_eval.py
RENAMED
|
File without changes
|
{python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/setup_py_live_eval.py.ABOUT
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector/utils_pypi.py.ABOUT
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector.egg-info/not-zip-safe
RENAMED
|
File without changes
|
{python_inspector-0.15.0 → python_inspector-0.15.2}/src/python_inspector.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_inspector-0.15.0 → python_inspector-0.15.2}/tests/test_utils_pip_compatibility_tags.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|