%global pypi_name torch_geometric Name: python-torch-geometric Version: 2.8.0.post1 Release: 1%{?dist} Summary: Graph neural network library for PyTorch License: MIT URL: https://github.com/pyg-team/pytorch_geometric # The sdist and the import name both use an underscore; only the rpm name and # the PyPI project name are hyphenated. Source0: %{pypi_source %{pypi_name}} BuildArch: noarch BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros # Needed for %%check: torch_geometric/__init__.py line 3 is a bare `import # torch` at module scope, so nothing in this package imports without it. See # the Requires below -- upstream's metadata says otherwise and is wrong. BuildRequires: python3-torch # torch_geometric.nn.models.dimenet_utils imports scipy at module scope. Like # torch, it is not in upstream's metadata, so nothing is generated for it. BuildRequires: python3-scipy %global _description %{expand: PyTorch Geometric (PyG) builds and trains graph neural networks on irregularly structured data: point clouds, meshes, molecules and general graphs. It provides message-passing layers, graph pooling, batching of variable-sized graphs, and a large collection of published GNN architectures and benchmark datasets. The import name is "torch_geometric", not "torch-geometric".} %description %{_description} %package -n python3-torch-geometric Summary: %{summary} # UNDECLARED UPSTREAM DEPENDENCY, added by hand. PyPI metadata lists torch only # under optional extras, so nothing is generated for it -- but # torch_geometric/__init__.py line 3 is a bare `import torch` at module scope, # and EVERY module in the package fails without it. Found by %%check: the first # build had this as a Recommends and died with ModuleNotFoundError on all ~200 # modules. Same shape as the lapy/matplotlib report in docs/upstream: metadata # says optional, the code imports it unconditionally. Requires: python3-torch # Also undeclared upstream: dimenet_utils imports scipy at module scope. Only # that one module needs it, so it is a Recommends rather than a hard Requires -- # the other ~200 modules import without scipy. Recommends: python3-scipy %description -n python3-torch-geometric %{_description} %prep %autosetup -n %{pypi_name}-%{version} %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install %pyproject_save_files torch_geometric %check # Import only. PyG's own test suite needs torch plus several optional backends # (torch-sparse, torch-cluster, pyg-lib) that are not packaged, so running it # here would test the absent extras rather than this package. # # Three modules are excluded because they import packages that do not exist in # Fedora at all, not because they are broken. Each was identified from the # failing check rather than guessed: # graphgym.benchmark -> torch_geometric_benchmark, a separate upstream repo # that is not published on PyPI at all # llm.models.qa_gen -> faiss, not packaged for Fedora # testing.distributed -> pytest, a test-only helper module # Everything else -- ~200 modules -- must import, and does. %pyproject_check_import -e torch_geometric.graphgym.benchmark -e torch_geometric.llm.models.qa_gen -e torch_geometric.testing.distributed %files -n python3-torch-geometric -f %{pyproject_files} %license LICENSE %doc README.md %changelog * Tue Sep 29 2026 Morgan Hough - 2.8.0.post1-1 - Initial package: torch-geometric 2.8.0.post1, a dependency of Project-MONAI/monai-physio. - Pure Python (flit_core), noarch, no bundled sources and nothing compiled: verified there are no .c/.cpp/.cu/.pyx files in the sdist. requires-python is ">=3.10" with no upper bound, so f45's Python 3.15 is in range -- worth stating because the same check is what disqualified nvidia-physicsnemo from this dependency set (capped <3.15). - All nine runtime dependencies were already in f45 before this package: aiohttp, fsspec, jinja2, numpy, psutil, pyparsing, requests, tqdm, xxhash. - torch IS required, despite upstream's metadata. PyPI lists torch only under optional extras, so no dependency is generated for it, but torch_geometric/__init__.py line 3 imports it at module scope and every module in the package fails without it. Caught by %%check, which failed on ~200 modules with ModuleNotFoundError; added as an explicit Requires and BuildRequires. Worth reporting upstream. - Two undeclared dependencies found by %%check, not by reading metadata: torch (every module) and scipy (dimenet_utils only). Three further modules are excluded from the import check because they need packages Fedora does not have: torch_geometric_benchmark (a separate upstream repo, not on PyPI), faiss, and pytest. The remaining ~200 modules import cleanly. - torch-scatter and torch-sparse really are optional and are NOT pulled in, so packaging this does not drag in torch-scatter -- the only compiled package in the monai-physio dependency set, whose last release (October 2023) predates f45's torch 2.12 by eight minor versions.