diff --git a/.github/workflows/test-template.yml b/.github/workflows/test-template.yml index 5a7d395..fe03466 100755 --- a/.github/workflows/test-template.yml +++ b/.github/workflows/test-template.yml @@ -75,6 +75,12 @@ jobs: test -f src/test_ml_project/data/datamodule.py test -d tests + - name: Verify pixi non-PyG platforms + if: matrix.package-manager == 'pixi' + working-directory: /tmp/test-project + run: | + grep -F 'platforms = ["linux-64", "osx-arm64"]' pyproject.toml + - name: Verify dependencies (uv) if: matrix.package-manager == 'uv' working-directory: /tmp/test-project @@ -108,3 +114,59 @@ jobs: pixi run ruff check . || true pixi run ruff format --check . || true pixi run pytest tests/ || true + + test-pyg-pixi-generation: + name: Test Pixi PyG Generation + runs-on: ubuntu-latest + + steps: + - name: Checkout template + uses: actions/checkout@v4 + + - name: Install uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Add uv to PATH + run: echo "$HOME/.local/bin" >> $GITHUB_PATH + + - name: Install pixi + run: curl -fsSL https://pixi.sh/install.sh | bash + + - name: Add pixi to PATH + run: echo "$HOME/.pixi/bin" >> $GITHUB_PATH + + - name: Generate pixi project with PyG enabled + run: | + uvx copier copy --trust \ + --data project_name="test-pyg-project" \ + --data package_name="test_pyg_project" \ + --data description="Test PyG project" \ + --data author_name="Test Author" \ + --data author_email="test@example.com" \ + --data python_version="3.11" \ + --data package_manager="pixi" \ + --data pytorch_cuda_preset="pytorch-2.8.0-cuda-12.6" \ + --data use_ruff=true \ + --data use_ty=true \ + --data use_pytest=true \ + --data use_torchvision=true \ + --data use_torchaudio=false \ + --data use_lightning=true \ + --data lightning_version="2.4" \ + --data use_hydra=true \ + --data hydra_version="1.3" \ + --data use_pytorch_geometric=true \ + --data logger_choice="tensorboard" \ + . /tmp/test-pyg-project + + - name: Verify pixi PyG template output + working-directory: /tmp/test-pyg-project + run: | + grep -F 'platforms = ["linux-64"]' pyproject.toml + grep -F '[tool.pixi.feature.pyg.pypi-options]' pyproject.toml + grep -F 'index-url = "https://pypi.org/simple"' pyproject.toml + grep -F 'find-links = [{ url = "https://data.pyg.org/whl/torch-2.8.0+cu126.html" }]' pyproject.toml + + - name: Verify dependencies (pixi PyG) + working-directory: /tmp/test-pyg-project + run: pixi install diff --git a/pyproject.toml.jinja b/pyproject.toml.jinja index 8378aab..b2b8c64 100755 --- a/pyproject.toml.jinja +++ b/pyproject.toml.jinja @@ -99,6 +99,11 @@ explicit = true name = "pytorch-geometric" url = "https://data.pyg.org/whl/torch-{{ pytorch_version }}+cu{{ cuda_version | replace('.', '') }}.html" explicit = true + +[tool.uv.sources] +torch-scatter = { index = "pytorch-geometric" } +torch-sparse = { index = "pytorch-geometric" } +torch-cluster = { index = "pytorch-geometric" } {% endif -%} # ============================================================================ @@ -167,7 +172,7 @@ name = "{{ project_name }}" version = "0.1.0" description = "{{ description }}" channels = ["nvidia", "pytorch", "conda-forge"] -platforms = ["linux-64", "osx-arm64"] +platforms = [{% if use_pytorch_geometric %}"linux-64"{% else %}"linux-64", "osx-arm64"{% endif %}] # System requirements for CUDA-enabled training # Note: These are advisory and only enforced on platforms where CUDA is available @@ -245,6 +250,12 @@ torch-geometric = "*" torch-scatter = "*" torch-sparse = "*" torch-cluster = "*" + +# pixi resolves PyPI packages via pypi-options; find-links makes pre-built +# wheels discoverable from the PyG wheel server instead of building from source +[tool.pixi.feature.pyg.pypi-options] +index-url = "https://pypi.org/simple" +find-links = [{ url = "https://data.pyg.org/whl/torch-{{ pytorch_version }}+cu{{ cuda_version | replace('.', '') }}.html" }] {% endif -%} # ============================================================================