# array-api-compat -- the Python array API standard as a thin compatibility layer over # NumPy, PyTorch, CuPy and Dask: array_namespace(x) returns a namespace with the # standard's function names whatever library x came from. Pure Python. # # WHY IT IS HERE: DeepInverse's PET operator (deepinv.physics.PET) drives parallelproj # through array_api_compat.torch. It is also what scikit-learn, SciPy and parallelproj # use to accept torch tensors, so it is useful beyond DeepInverse. # # Class 1 under docs/PACKAGING-POLICY.md: Fedora ships no package by this source # name and nothing provides python3dist(array-api-compat). Verified 2026-10-12: # dnf repoquery --whatprovides 'python3dist(array-api-compat)' -> empty # (SciPy vendors its own copy inside scipy._lib; that copy is private.) %global pypi_name array-api-compat %global import_name array_api_compat Name: python-%{pypi_name} Version: 1.15.0 Release: 1%{?dist} Summary: Array API standard compatibility layer for NumPy, PyTorch, CuPy and Dask License: MIT URL: https://github.com/data-apis/array-api-compat # The GitHub tag, not the PyPI sdist: the sdist ships no tests/. Upstream tags # this release "1.15". src/ is byte-identical between the two (diff -rq). Source0: %{url}/archive/1.15/array-api-compat-1.15.tar.gz BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3dist(pytest) # The libraries the tests wrap. Each test module importorskip()s its library, # so every one listed here turns skips into real runs. jax, cupy, ndonnx and # pydata-sparse are not in Fedora; their cases skip. BuildRequires: python3dist(numpy) BuildRequires: python3dist(torch) BuildRequires: python3dist(dask) BuildRequires: python3dist(array-api-strict) %global _description %{expand: array-api-compat is a small wrapper around NumPy, PyTorch, CuPy and Dask that gives each of them the function names and semantics of the Python array API standard (data-apis.org). Library code calls array_namespace(x) and then uses the returned namespace, so one implementation accepts NumPy arrays and PyTorch tensors alike. It wraps; it does not copy data or add dependencies on the array libraries themselves.} %description %_description %package -n python3-%{pypi_name} Summary: %{summary} %description -n python3-%{pypi_name} %_description %prep %autosetup -p1 -n array-api-compat-1.15 %generate_buildrequires # meson-python cannot report metadata before a build; -p reads the runtime # requirements from pyproject.toml's [project] table instead (there are none). %pyproject_buildrequires -p %build # Upstream's meson build installs tests/ and vendor_tests/ into the package as # array_api_compat.tests and array_api_compat.vendor_tests (install tag # "tests"). The installed vendor_tests cannot work: they import a vendored # ./array_api_compat copy that exists only as a symlink in the source tree. # Build the wheel from the runtime sources only; the tests run from the source # tree in %%check. %pyproject_wheel -Cinstall-args=--tags=python-runtime %install %pyproject_install # meson-python writes no PEP 639 License-File here; LICENSE is listed in # %%files by hand. %pyproject_save_files -L %{import_name} %check # The cupy wrappers import cupy at module scope; cupy is not in Fedora. %pyproject_check_import -e 'array_api_compat.cupy*' test ! -e %{buildroot}%{python3_sitelib}/array_api_compat/tests test ! -e %{buildroot}%{python3_sitelib}/array_api_compat/vendor_tests # test_no_dependencies.py runs a subprocess that asserts importing # array_api_compat pulls in no array library; it uses sys.executable and the # installed package, so it runs as is. # Deselected, all because of what Fedora ships rather than array-api-compat: # - array_api_strict 2024.12 namespace and conj/real view-or-copy (4 cases): # Fedora's python3-array-api-strict is 2.0.1, which predates the 2024.12 # standard ("Unsupported standard version '2024.12'"; conj/real still # reject real dtypes). The 2023.12 cases for the same library run. # - test_dynamo_array_namespace: calls torch.compile, which torch 2.9 refuses # on Python 3.14 ("torch.compile is not supported on Python 3.14+"). %pytest -c /dev/null --rootdir=. tests -p no:cacheprovider -q -rs \ --deselect 'tests/test_array_namespace.py::test_array_namespace[array_api_strict-2024.12-False]' \ --deselect 'tests/test_array_namespace.py::test_array_namespace[array_api_strict-2024.12-None]' \ --deselect 'tests/test_copies_or_views.py::test_view_or_copy[conj-array_api_strict]' \ --deselect 'tests/test_copies_or_views.py::test_view_or_copy[real-array_api_strict]' \ --deselect tests/test_torch.py::test_dynamo_array_namespace %files -n python3-%{pypi_name} -f %{pyproject_files} %license LICENSE %doc README.md CHANGELOG.md %changelog * Mon Oct 12 2026 Morgan Hough - 1.15.0-1 - Initial package: needed by DeepInverse's PET operator (with parallelproj).