Skip to content

Commit

Permalink
Bugfix: support packages that only have manylinux 2 wheels
Browse files Browse the repository at this point in the history
Currently onnxruntime==1.19.2 cannot be analyzed with python-inspector, because get_supported_wheels() is unable to process packages that only have manylinux wheels. E.g. https://pypi.org/project/onnxruntime/#files only contains the file '
onnxruntime-1.19.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl' for the x86_64 architecture.

Signed-off-by: Mathias Burger <mathias.burger@gmail.com>
  • Loading branch information
mathiasburger committed Sep 26, 2024
1 parent 869c412 commit 2ddd952
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/python_inspector/utils_pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ def get_python_dot_version(version):
"manylinux1_x86_64",
"manylinux2010_x86_64",
"manylinux2014_x86_64",
"manylinux_2_27_x86_64",
"manylinux_2_28_x86_64",
],
"macos": [
"macosx_10_6_intel",
Expand Down
22 changes: 22 additions & 0 deletions tests/test_utils_pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

import pytest

from python_inspector import utils_pypi
from python_inspector.utils_pypi import Distribution
from python_inspector.utils_pypi import PypiPackage
from python_inspector.utils_pypi import Sdist
from python_inspector.utils_pypi import Wheel

Expand Down Expand Up @@ -138,6 +140,15 @@ def check(self, using=Distribution):
),
]

linux_platforms = [
"linux_x86_64",
"manylinux1_x86_64",
"manylinux2010_x86_64",
"manylinux2014_x86_64",
"manylinux_2_27_x86_64",
"manylinux_2_28_x86_64",
]


@pytest.mark.parametrize("dist_test", sdist_tests + wheel_tests)
def test_Distribution_from_filename(dist_test):
Expand All @@ -152,3 +163,14 @@ def test_Sdist_from_filename(dist_test):
@pytest.mark.parametrize("dist_test", wheel_tests)
def test_Wheel_from_filename(dist_test):
dist_test.check(using=Wheel)


@pytest.mark.parametrize("linux_platform", linux_platforms)
def test_PypiPackage_get_supported_wheels(linux_platform):
whl = Wheel.from_filename(f"onnxruntime-1.19.2-cp311-cp311-{linux_platform}.whl")
pkg = PypiPackage.package_from_dists(dists=[whl])
env = utils_pypi.Environment.from_pyver_and_os(python_version="311", operating_system="linux")

supported_wheels = list(pkg.get_supported_wheels(environment=env))

assert supported_wheels == [whl]

0 comments on commit 2ddd952

Please sign in to comment.