Skip to content

Prevent duplicated package versions #110

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/python_inspector/resolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,20 +367,20 @@ def get_versions_for_package_from_repo(
get_python_version_from_env_tag(python_version=self.environment.python_version)
)
wheels = list(package.get_supported_wheels(environment=self.environment))
valid_wheel_present = False
pypi_valid_python_version = False
if wheels:
valid_wheel_present = False
for wheel in wheels:
if utils_pypi.valid_python_version(
python_requires=wheel.python_requires, python_version=python_version
):
valid_wheel_present = True
if valid_wheel_present:
versions.append(version)
if package.sdist:
if utils_pypi.valid_python_version(
pypi_valid_python_version = utils_pypi.valid_python_version(
python_requires=package.sdist.python_requires, python_version=python_version
):
versions.append(version)
)
if valid_wheel_present or pypi_valid_python_version:
versions.append(version)
return versions

def get_versions_for_package_from_pypi_json_api(self, name: str) -> List[Version]:
Expand Down
262 changes: 131 additions & 131 deletions tests/data/azure-devops.req-310-expected.json

Large diffs are not rendered by default.

262 changes: 131 additions & 131 deletions tests/data/azure-devops.req-38-expected.json

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions tests/data/insecure-setup-2/setup.py-expected.json

Large diffs are not rendered by default.

80 changes: 40 additions & 40 deletions tests/data/single-url-except-simple-expected.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions tests/test_resolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ def test_get_resolved_dependencies_with_tilde_requirement_using_json_api():
assert plist == [
"pkg:pypi/[email protected]",
"pkg:pypi/[email protected]",
"pkg:pypi/importlib-metadata@5.0.0",
"pkg:pypi/importlib-metadata@6.0.0",
"pkg:pypi/[email protected]",
"pkg:pypi/[email protected]",
"pkg:pypi/[email protected]",
"pkg:pypi/[email protected]",
"pkg:pypi/zipp@3.10.0",
"pkg:pypi/zipp@3.11.0",
]


Expand All @@ -146,11 +146,11 @@ def test_without_supported_wheels():
assert plist == [
"pkg:pypi/[email protected]",
"pkg:pypi/[email protected]",
"pkg:pypi/cryptography@38.0.3",
"pkg:pypi/cryptography@39.0.0",
"pkg:pypi/[email protected]",
"pkg:pypi/[email protected]",
"pkg:pypi/[email protected]",
"pkg:pypi/setuptools@65.5.1",
"pkg:pypi/setuptools@65.7.0",
"pkg:pypi/[email protected]",
]

Expand Down