From 19c09f36d6ec9790f60f4cf44c116d6a65941562 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Fri, 20 Sep 2024 16:47:20 -0500 Subject: [PATCH 01/63] Create pypi-distribution.yaml --- .github/workflows/pypi-distribution.yaml | 121 +++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 .github/workflows/pypi-distribution.yaml diff --git a/.github/workflows/pypi-distribution.yaml b/.github/workflows/pypi-distribution.yaml new file mode 100644 index 0000000..e121af4 --- /dev/null +++ b/.github/workflows/pypi-distribution.yaml @@ -0,0 +1,121 @@ +on: + push: + workflow_dispatch: + +jobs: + build: + name: Build distribution 📦 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + + - name: Install Protoc Ubuntu + run: sudo apt install protobuf-compiler + + - name: Install Python dependencies + uses: py-actions/py-dependency-install@v4 + with: + path: "PyTorch_requirements.txt" + + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + + - name: Build a binary wheel and a source tarball + run: python3 -m build + + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + + publish-to-testpypi: + name: Publish Python 🐍 distribution 📦 to TestPyPI + needs: + - build + runs-on: ubuntu-latest + + environment: + name: testpypi + url: https://test.pypi.org/p/nuTens + + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + + publish-to-pypi: + name: >- + Publish Python 🐍 distribution 📦 to PyPI + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/nuTens # Replace with your PyPI project name + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + github-release: + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + name: >- + Sign the Python 🐍 distribution 📦 with Sigstore + and upload them to GitHub Release + needs: + - publish-to-pypi + runs-on: ubuntu-latest + + permissions: + contents: write # IMPORTANT: mandatory for making GitHub Releases + id-token: write # IMPORTANT: mandatory for sigstore + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Sign the dists with Sigstore + uses: sigstore/gh-action-sigstore-python@v2.1.1 + with: + inputs: >- + ./dist/*.tar.gz + ./dist/*.whl + - name: Create GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + run: >- + gh release create + '${{ github.ref_name }}' + --repo '${{ github.repository }}' + --notes "" + - name: Upload artifact signatures to GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + # Upload to GitHub Release using the `gh` CLI. + # `dist/` contains the built packages, and the + # sigstore-produced signatures and certificates. + run: >- + gh release upload + '${{ github.ref_name }}' dist/** + --repo '${{ github.repository }}' From 31437a15da4465f540432fe0ef7ca6ab2e85636d Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Fri, 20 Sep 2024 17:00:56 -0500 Subject: [PATCH 02/63] Update pypi-distribution.yaml --- .github/workflows/pypi-distribution.yaml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi-distribution.yaml b/.github/workflows/pypi-distribution.yaml index e121af4..955e27b 100644 --- a/.github/workflows/pypi-distribution.yaml +++ b/.github/workflows/pypi-distribution.yaml @@ -1,3 +1,5 @@ +name: Publish to PyPi + on: push: workflow_dispatch: @@ -46,7 +48,7 @@ jobs: runs-on: ubuntu-latest environment: - name: testpypi + name: testPyPi-distribution url: https://test.pypi.org/p/nuTens permissions: @@ -71,10 +73,19 @@ jobs: - build runs-on: ubuntu-latest environment: - name: pypi + name: PyPi-distribution url: https://pypi.org/p/nuTens # Replace with your PyPI project name permissions: id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 github-release: if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes From 36bf503fe250209dc1d2755125c852ea3f81875f Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Fri, 20 Sep 2024 17:02:16 -0500 Subject: [PATCH 03/63] Update pypi-distribution.yaml --- .github/workflows/pypi-distribution.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi-distribution.yaml b/.github/workflows/pypi-distribution.yaml index 955e27b..106861e 100644 --- a/.github/workflows/pypi-distribution.yaml +++ b/.github/workflows/pypi-distribution.yaml @@ -14,7 +14,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.x" + python-version: "3.11" - name: Install Protoc Ubuntu run: sudo apt install protobuf-compiler From f7299cede7a2b44db588c4544c85cd067378af61 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Fri, 20 Sep 2024 17:12:36 -0500 Subject: [PATCH 04/63] Have separate forks for cpu and gpu distribution --- .github/workflows/pypi-distribution.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/pypi-distribution.yaml b/.github/workflows/pypi-distribution.yaml index 106861e..2ea6533 100644 --- a/.github/workflows/pypi-distribution.yaml +++ b/.github/workflows/pypi-distribution.yaml @@ -6,11 +6,23 @@ on: jobs: build: + strategy: + fail-fast: false + matrix: + include: + - build_type: cpu + - build_type: cuda + name: Build distribution 📦 runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + + - name: cuda-toolkit + if: ${{ startsWith(matrix.build_type, 'cuda') }} + uses: Jimver/cuda-toolkit@v0.2.17 + - name: Set up Python uses: actions/setup-python@v5 with: From 19df3ac245bee22179edda4ab9f85918df7c0f1c Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Fri, 20 Sep 2024 17:30:12 -0500 Subject: [PATCH 05/63] Update pyproject.toml to try to only allow cpu versions of torch for now --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b0a7ae0..381d1c0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["scikit-build-core", "pybind11", "torch"] +requires = ["scikit-build-core", "pybind11", "torch*cpu"] build-backend = "scikit_build_core.build" [project] @@ -12,4 +12,4 @@ authors = [ ] [tool.scikit-build] -cmake.args = ["-DNT_ENABLE_PYTHON=ON"] \ No newline at end of file +cmake.args = ["-DNT_ENABLE_PYTHON=ON"] From ec7350a3ac393f076836c1620790ab4ade818d11 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Fri, 20 Sep 2024 17:32:09 -0500 Subject: [PATCH 06/63] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 381d1c0..d048374 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["scikit-build-core", "pybind11", "torch*cpu"] +requires = ["scikit-build-core", "pybind11", "torch == *cpu"] build-backend = "scikit_build_core.build" [project] From c4119b2c0065528be99d47b755becd17718c6be6 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Fri, 20 Sep 2024 17:53:17 -0500 Subject: [PATCH 07/63] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d048374..2c4b018 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["scikit-build-core", "pybind11", "torch == *cpu"] +requires = ["scikit-build-core", "pybind11", "torch == 2.0.1+cpu] build-backend = "scikit_build_core.build" [project] From 9d5294380150a692e6d77891b8ecbe81333235c8 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Fri, 20 Sep 2024 17:53:34 -0500 Subject: [PATCH 08/63] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2c4b018..199592b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["scikit-build-core", "pybind11", "torch == 2.0.1+cpu] +requires = ["scikit-build-core", "pybind11", "torch == 2.0.1+cpu"] build-backend = "scikit_build_core.build" [project] From 278c929963df7d26f7ec24983894771b94158717 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Fri, 20 Sep 2024 18:03:47 -0500 Subject: [PATCH 09/63] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 199592b..cc19895 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["scikit-build-core", "pybind11", "torch == 2.0.1+cpu"] +requires = ["scikit-build-core", "pybind11", "torch"] build-backend = "scikit_build_core.build" [project] From 840050d7c7f08ff6dec25f1f636c50dfc23bed65 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Fri, 20 Sep 2024 18:16:47 -0500 Subject: [PATCH 10/63] Try to turn off cuda for now --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index cc19895..71272b3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,4 +12,4 @@ authors = [ ] [tool.scikit-build] -cmake.args = ["-DNT_ENABLE_PYTHON=ON"] +cmake.args = ["-DNT_ENABLE_PYTHON=ON -DUSE_CUDA=OFF"] From f07afd337b0143e7842c2bcb2e7f9756298295c9 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Fri, 20 Sep 2024 22:10:08 -0500 Subject: [PATCH 11/63] Update pypi-distribution.yaml --- .github/workflows/pypi-distribution.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi-distribution.yaml b/.github/workflows/pypi-distribution.yaml index 2ea6533..9a82d1f 100644 --- a/.github/workflows/pypi-distribution.yaml +++ b/.github/workflows/pypi-distribution.yaml @@ -44,7 +44,7 @@ jobs: --user - name: Build a binary wheel and a source tarball - run: python3 -m build + run: python3 -m build -v - name: Store the distribution packages uses: actions/upload-artifact@v4 From af44fbd08f924f4b72c5b5beac7362d7f08bf10b Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Fri, 20 Sep 2024 22:20:38 -0500 Subject: [PATCH 12/63] Update pypi-distribution.yaml --- .github/workflows/pypi-distribution.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pypi-distribution.yaml b/.github/workflows/pypi-distribution.yaml index 9a82d1f..61b18d4 100644 --- a/.github/workflows/pypi-distribution.yaml +++ b/.github/workflows/pypi-distribution.yaml @@ -18,7 +18,15 @@ jobs: steps: - uses: actions/checkout@v4 - + + ## runner will run out of space if we don't clear some up by removing some unused tools + - name: Clear space + run: >- + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + sudo rm -rf "/usr/local/share/boost" + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + - name: cuda-toolkit if: ${{ startsWith(matrix.build_type, 'cuda') }} uses: Jimver/cuda-toolkit@v0.2.17 From ad495e21f2908f3fd45543eb7619707a1612d9c9 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Fri, 20 Sep 2024 22:52:17 -0500 Subject: [PATCH 13/63] Create pypi-distribution-reusable.yaml --- .../workflows/pypi-distribution-reusable.yaml | 150 ++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 .github/workflows/pypi-distribution-reusable.yaml diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml new file mode 100644 index 0000000..76b8e5c --- /dev/null +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -0,0 +1,150 @@ +on: + workflow_call: + inputs: + build_type: + required: true + type: string + platform: + required: true + type: string + +jobs: + build: + + name: Build ${{ inputs.platform }} ${{ inputs.build_type }} distribution 📦 + runs-on: ${{ inputs.platform }} + + steps: + - uses: actions/checkout@v4 + + ## runner will run out of space if we don't clear some up by removing some unused tools + - name: Clear space + run: >- + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + sudo rm -rf "/usr/local/share/boost" + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + + - name: cuda-toolkit + if: ${{ startsWith( inputs.build_type, 'cuda' ) }} + uses: Jimver/cuda-toolkit@v0.2.17 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install Protoc + run: sudo apt install protobuf-compiler + + - name: Install Python dependencies + uses: py-actions/py-dependency-install@v4 + with: + path: "PyTorch_requirements.txt" + + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + + - name: Build a binary wheel and a source tarball + run: python3 -m build -v + + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + + publish-to-testpypi: + name: Publish Python 🐍 distribution 📦 to TestPyPI + needs: + - build + runs-on: ${{ inputs.platform }} + + environment: + name: testPyPi-distribution + url: https://test.pypi.org/p/nuTens + + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + + publish-to-pypi: + name: >- + Publish Python 🐍 distribution 📦 to PyPI + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + needs: + - build + runs-on: ${{ inputs.platform }} + environment: + name: PyPi-distribution + url: https://pypi.org/p/nuTens # Replace with your PyPI project name + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + github-release: + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + name: >- + Sign the Python 🐍 distribution 📦 with Sigstore + and upload them to GitHub Release + needs: + - publish-to-pypi + runs-on: ${{ inputs.platform }} + + permissions: + contents: write # IMPORTANT: mandatory for making GitHub Releases + id-token: write # IMPORTANT: mandatory for sigstore + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Sign the dists with Sigstore + uses: sigstore/gh-action-sigstore-python@v2.1.1 + with: + inputs: >- + ./dist/*.tar.gz + ./dist/*.whl + - name: Create GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + run: >- + gh release create + '${{ github.ref_name }}' + --repo '${{ github.repository }}' + --notes "" + - name: Upload artifact signatures to GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + # Upload to GitHub Release using the `gh` CLI. + # `dist/` contains the built packages, and the + # sigstore-produced signatures and certificates. + run: >- + gh release upload + '${{ github.ref_name }}' dist/** + --repo '${{ github.repository }}' From fb47340136226d112d07d32401cf664881242ab1 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Fri, 20 Sep 2024 23:06:00 -0500 Subject: [PATCH 14/63] Update pypi-distribution.yaml --- .github/workflows/pypi-distribution.yaml | 148 ++--------------------- 1 file changed, 10 insertions(+), 138 deletions(-) diff --git a/.github/workflows/pypi-distribution.yaml b/.github/workflows/pypi-distribution.yaml index 61b18d4..22dbfb0 100644 --- a/.github/workflows/pypi-distribution.yaml +++ b/.github/workflows/pypi-distribution.yaml @@ -5,148 +5,20 @@ on: workflow_dispatch: jobs: - build: - strategy: + pypi_distribution: + strategy: fail-fast: false matrix: include: - build_type: cpu + platform: ubuntu-latest + - build_type: cuda - - name: Build distribution 📦 - runs-on: ubuntu-latest + platform: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - ## runner will run out of space if we don't clear some up by removing some unused tools - - name: Clear space - run: >- - sudo rm -rf /usr/share/dotnet - sudo rm -rf /opt/ghc - sudo rm -rf "/usr/local/share/boost" - sudo rm -rf "$AGENT_TOOLSDIRECTORY" - - - name: cuda-toolkit - if: ${{ startsWith(matrix.build_type, 'cuda') }} - uses: Jimver/cuda-toolkit@v0.2.17 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - - name: Install Protoc Ubuntu - run: sudo apt install protobuf-compiler - - - name: Install Python dependencies - uses: py-actions/py-dependency-install@v4 - with: - path: "PyTorch_requirements.txt" - - - name: Install pypa/build - run: >- - python3 -m - pip install - build - --user - - - name: Build a binary wheel and a source tarball - run: python3 -m build -v - - - name: Store the distribution packages - uses: actions/upload-artifact@v4 - with: - name: python-package-distributions - path: dist/ - - - publish-to-testpypi: - name: Publish Python 🐍 distribution 📦 to TestPyPI - needs: - - build - runs-on: ubuntu-latest - - environment: - name: testPyPi-distribution - url: https://test.pypi.org/p/nuTens - - permissions: - id-token: write # IMPORTANT: mandatory for trusted publishing - - steps: - - name: Download all the dists - uses: actions/download-artifact@v4 - with: - name: python-package-distributions - path: dist/ - - name: Publish distribution 📦 to TestPyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - repository-url: https://test.pypi.org/legacy/ - - publish-to-pypi: - name: >- - Publish Python 🐍 distribution 📦 to PyPI - if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes - needs: - - build - runs-on: ubuntu-latest - environment: - name: PyPi-distribution - url: https://pypi.org/p/nuTens # Replace with your PyPI project name - permissions: - id-token: write # IMPORTANT: mandatory for trusted publishing + ## ./ At start of reusable workflow indicates to use the one in current repo i.e. the from the current branch + uses: ./.github/workflows/pypi-distribution-reusable.yaml + with: + platform: ${{ matrix.platform }} + build_type: ${{ matrix.build_type }} - steps: - - name: Download all the dists - uses: actions/download-artifact@v4 - with: - name: python-package-distributions - path: dist/ - - name: Publish distribution 📦 to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - - github-release: - if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes - name: >- - Sign the Python 🐍 distribution 📦 with Sigstore - and upload them to GitHub Release - needs: - - publish-to-pypi - runs-on: ubuntu-latest - - permissions: - contents: write # IMPORTANT: mandatory for making GitHub Releases - id-token: write # IMPORTANT: mandatory for sigstore - - steps: - - name: Download all the dists - uses: actions/download-artifact@v4 - with: - name: python-package-distributions - path: dist/ - - name: Sign the dists with Sigstore - uses: sigstore/gh-action-sigstore-python@v2.1.1 - with: - inputs: >- - ./dist/*.tar.gz - ./dist/*.whl - - name: Create GitHub Release - env: - GITHUB_TOKEN: ${{ github.token }} - run: >- - gh release create - '${{ github.ref_name }}' - --repo '${{ github.repository }}' - --notes "" - - name: Upload artifact signatures to GitHub Release - env: - GITHUB_TOKEN: ${{ github.token }} - # Upload to GitHub Release using the `gh` CLI. - # `dist/` contains the built packages, and the - # sigstore-produced signatures and certificates. - run: >- - gh release upload - '${{ github.ref_name }}' dist/** - --repo '${{ github.repository }}' From 6fbadae709750d1d453959c569ad0080a5708136 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Fri, 20 Sep 2024 23:08:19 -0500 Subject: [PATCH 15/63] Update pypi-distribution.yaml --- .github/workflows/pypi-distribution.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/pypi-distribution.yaml b/.github/workflows/pypi-distribution.yaml index 22dbfb0..ca186a3 100644 --- a/.github/workflows/pypi-distribution.yaml +++ b/.github/workflows/pypi-distribution.yaml @@ -6,6 +6,10 @@ on: jobs: pypi_distribution: + + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + strategy: fail-fast: false matrix: From e10eff176e2c92469b8b073021e7c971859f6552 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Fri, 20 Sep 2024 23:10:57 -0500 Subject: [PATCH 16/63] Update pypi-distribution.yaml --- .github/workflows/pypi-distribution.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pypi-distribution.yaml b/.github/workflows/pypi-distribution.yaml index ca186a3..a61593c 100644 --- a/.github/workflows/pypi-distribution.yaml +++ b/.github/workflows/pypi-distribution.yaml @@ -9,6 +9,8 @@ jobs: permissions: id-token: write # IMPORTANT: mandatory for trusted publishing + + secrets: inherit strategy: fail-fast: false From 509bc15111ddb38c66725a60ff3efe4e7306f321 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Fri, 20 Sep 2024 23:14:44 -0500 Subject: [PATCH 17/63] Update pypi-distribution.yaml --- .github/workflows/pypi-distribution.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pypi-distribution.yaml b/.github/workflows/pypi-distribution.yaml index a61593c..605d6b7 100644 --- a/.github/workflows/pypi-distribution.yaml +++ b/.github/workflows/pypi-distribution.yaml @@ -8,6 +8,7 @@ jobs: pypi_distribution: permissions: + contents: write id-token: write # IMPORTANT: mandatory for trusted publishing secrets: inherit From 22a28e07b5fe36cf7df0f4d66c7d12bc47c17c29 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Fri, 20 Sep 2024 23:43:54 -0500 Subject: [PATCH 18/63] change name to just nuTens --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 71272b3..2a77284 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["scikit-build-core", "pybind11", "torch"] build-backend = "scikit_build_core.build" [project] -name = "pyNuTens" +name = "nuTens" version = "0.0.1" description="Library to calculate neutrino oscillation probabilities using tensors" readme = "README.md" From bcc313e0d487ae717b6958006a6df282a8e38b73 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Sat, 21 Sep 2024 00:20:14 -0500 Subject: [PATCH 19/63] Update pypi-distribution-reusable.yaml --- .../workflows/pypi-distribution-reusable.yaml | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index 76b8e5c..abf21d5 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -37,20 +37,26 @@ jobs: - name: Install Protoc run: sudo apt install protobuf-compiler - - name: Install Python dependencies - uses: py-actions/py-dependency-install@v4 - with: - path: "PyTorch_requirements.txt" + #- name: Install Python dependencies + # uses: py-actions/py-dependency-install@v4 + # with: + # path: "PyTorch_requirements.txt" - - name: Install pypa/build - run: >- - python3 -m - pip install - build - --user + #- name: Install pypa/build + # run: >- + # python3 -m + # pip install + # build + # --user - - name: Build a binary wheel and a source tarball - run: python3 -m build -v + #- name: Build a binary wheel and a source tarball + # run: python3 -m build -v + + - name: Build manylinux Python wheels + uses: RalfG/python-wheels-manylinux-build@v0.7.1-manylinux2014_x86_64 + with: + python-versions: 'cp39-cp311' + build-requirements: 'scikit-build-core pybind11 torch' - name: Store the distribution packages uses: actions/upload-artifact@v4 From a4363a08c2188e8712a5ae14bccc365df35524e2 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Sat, 21 Sep 2024 00:27:22 -0500 Subject: [PATCH 20/63] Update pypi-distribution-reusable.yaml --- .github/workflows/pypi-distribution-reusable.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index abf21d5..bdc617a 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -37,10 +37,10 @@ jobs: - name: Install Protoc run: sudo apt install protobuf-compiler - #- name: Install Python dependencies - # uses: py-actions/py-dependency-install@v4 - # with: - # path: "PyTorch_requirements.txt" + - name: Install Python dependencies + uses: py-actions/py-dependency-install@v4 + with: + path: "PyTorch_requirements.txt" #- name: Install pypa/build # run: >- @@ -55,7 +55,7 @@ jobs: - name: Build manylinux Python wheels uses: RalfG/python-wheels-manylinux-build@v0.7.1-manylinux2014_x86_64 with: - python-versions: 'cp39-cp311' + python-versions: 'cp39-cp39 cp310-cp310 cp311-cp311' build-requirements: 'scikit-build-core pybind11 torch' - name: Store the distribution packages From e443b76c93530e0eef134fd0fdf359cf68505eb8 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Sat, 21 Sep 2024 00:43:00 -0500 Subject: [PATCH 21/63] Update pypi-distribution-reusable.yaml --- .github/workflows/pypi-distribution-reusable.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index bdc617a..ecc73d4 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -25,7 +25,7 @@ jobs: sudo rm -rf "/usr/local/share/boost" sudo rm -rf "$AGENT_TOOLSDIRECTORY" - - name: cuda-toolkit + - name: cuda-toolkit if: ${{ startsWith( inputs.build_type, 'cuda' ) }} uses: Jimver/cuda-toolkit@v0.2.17 @@ -56,7 +56,7 @@ jobs: uses: RalfG/python-wheels-manylinux-build@v0.7.1-manylinux2014_x86_64 with: python-versions: 'cp39-cp39 cp310-cp310 cp311-cp311' - build-requirements: 'scikit-build-core pybind11 torch' + build-requirements: 'scikit-build-core pybind11 torch cuda-python' - name: Store the distribution packages uses: actions/upload-artifact@v4 From d41cda8d204adf480e2548658694bc8f880ce170 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Sat, 21 Sep 2024 09:16:15 -0500 Subject: [PATCH 22/63] Update pypi-distribution-reusable.yaml --- .github/workflows/pypi-distribution-reusable.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index ecc73d4..6929d24 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -56,7 +56,8 @@ jobs: uses: RalfG/python-wheels-manylinux-build@v0.7.1-manylinux2014_x86_64 with: python-versions: 'cp39-cp39 cp310-cp310 cp311-cp311' - build-requirements: 'scikit-build-core pybind11 torch cuda-python' + build-requirements: 'scikit-build-core pybind11 pytorch-cpu torchvision-cpu pytorch' + pre-build-command: 'sudo apt install cuda' - name: Store the distribution packages uses: actions/upload-artifact@v4 From abf531e1f5ff019d77bc463d55ed34602e530e8c Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Sat, 21 Sep 2024 09:18:03 -0500 Subject: [PATCH 23/63] Update pypi-distribution-reusable.yaml --- .../workflows/pypi-distribution-reusable.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index 6929d24..124b522 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -25,22 +25,22 @@ jobs: sudo rm -rf "/usr/local/share/boost" sudo rm -rf "$AGENT_TOOLSDIRECTORY" - - name: cuda-toolkit - if: ${{ startsWith( inputs.build_type, 'cuda' ) }} - uses: Jimver/cuda-toolkit@v0.2.17 + #- name: cuda-toolkit + # if: ${{ startsWith( inputs.build_type, 'cuda' ) }} + # uses: Jimver/cuda-toolkit@v0.2.17 - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.11" - - name: Install Protoc - run: sudo apt install protobuf-compiler + #- name: Install Protoc + # run: sudo apt install protobuf-compiler - - name: Install Python dependencies - uses: py-actions/py-dependency-install@v4 - with: - path: "PyTorch_requirements.txt" + #- name: Install Python dependencies + # uses: py-actions/py-dependency-install@v4 + # with: + # path: "PyTorch_requirements.txt" #- name: Install pypa/build # run: >- From e29dd27e5ffad790536cae74b1beeafda9ef5e76 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Sat, 21 Sep 2024 09:19:50 -0500 Subject: [PATCH 24/63] Update pypi-distribution-reusable.yaml --- .github/workflows/pypi-distribution-reusable.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index 124b522..1d3fe09 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -57,7 +57,6 @@ jobs: with: python-versions: 'cp39-cp39 cp310-cp310 cp311-cp311' build-requirements: 'scikit-build-core pybind11 pytorch-cpu torchvision-cpu pytorch' - pre-build-command: 'sudo apt install cuda' - name: Store the distribution packages uses: actions/upload-artifact@v4 From 13b5821f232cfe2f95c7c5a1ce85fe9361501190 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Sat, 21 Sep 2024 09:23:23 -0500 Subject: [PATCH 25/63] Update pypi-distribution.yaml --- .github/workflows/pypi-distribution.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi-distribution.yaml b/.github/workflows/pypi-distribution.yaml index 605d6b7..10dcd46 100644 --- a/.github/workflows/pypi-distribution.yaml +++ b/.github/workflows/pypi-distribution.yaml @@ -20,8 +20,8 @@ jobs: - build_type: cpu platform: ubuntu-latest - - build_type: cuda - platform: ubuntu-latest + #- build_type: cuda + # platform: ubuntu-latest ## ./ At start of reusable workflow indicates to use the one in current repo i.e. the from the current branch uses: ./.github/workflows/pypi-distribution-reusable.yaml From cc254c37b1f7724dce121967f0a93eb522142492 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Sat, 21 Sep 2024 09:23:49 -0500 Subject: [PATCH 26/63] Update pypi-distribution-reusable.yaml --- .github/workflows/pypi-distribution-reusable.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index 1d3fe09..e4a1f1b 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -56,7 +56,7 @@ jobs: uses: RalfG/python-wheels-manylinux-build@v0.7.1-manylinux2014_x86_64 with: python-versions: 'cp39-cp39 cp310-cp310 cp311-cp311' - build-requirements: 'scikit-build-core pybind11 pytorch-cpu torchvision-cpu pytorch' + build-requirements: 'scikit-build-core pybind11 torch==2.0.1+cpu' - name: Store the distribution packages uses: actions/upload-artifact@v4 From e48eb56754ecc213d17fb9a9d107957065bbd6ea Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Sat, 21 Sep 2024 09:32:18 -0500 Subject: [PATCH 27/63] Update pypi-distribution-reusable.yaml --- .../workflows/pypi-distribution-reusable.yaml | 38 +++++++------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index e4a1f1b..3aecc42 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -25,39 +25,29 @@ jobs: sudo rm -rf "/usr/local/share/boost" sudo rm -rf "$AGENT_TOOLSDIRECTORY" - #- name: cuda-toolkit - # if: ${{ startsWith( inputs.build_type, 'cuda' ) }} - # uses: Jimver/cuda-toolkit@v0.2.17 + - name: cuda-toolkit + if: ${{ startsWith( inputs.build_type, 'cuda' ) }} + uses: Jimver/cuda-toolkit@v0.2.17 - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.11" - #- name: Install Protoc - # run: sudo apt install protobuf-compiler + - name: Install Protoc + run: sudo apt install protobuf-compiler - #- name: Install Python dependencies - # uses: py-actions/py-dependency-install@v4 - # with: - # path: "PyTorch_requirements.txt" - - #- name: Install pypa/build - # run: >- - # python3 -m - # pip install - # build - # --user - - #- name: Build a binary wheel and a source tarball - # run: python3 -m build -v - - - name: Build manylinux Python wheels - uses: RalfG/python-wheels-manylinux-build@v0.7.1-manylinux2014_x86_64 + - name: Install Python dependencies + uses: py-actions/py-dependency-install@v4 with: - python-versions: 'cp39-cp39 cp310-cp310 cp311-cp311' - build-requirements: 'scikit-build-core pybind11 torch==2.0.1+cpu' + path: "PyTorch_requirements.txt" + + - name: Install cibuildwheel + run: python -m pip install cibuildwheel==2.21.1 + - name: Build wheels + run: python -m cibuildwheel --output-dir dist + - name: Store the distribution packages uses: actions/upload-artifact@v4 with: From daae6366649e26db3bbe988c25b67472fbf76d5c Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Sat, 21 Sep 2024 09:32:41 -0500 Subject: [PATCH 28/63] Update pypi-distribution.yaml --- .github/workflows/pypi-distribution.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pypi-distribution.yaml b/.github/workflows/pypi-distribution.yaml index 10dcd46..50d102b 100644 --- a/.github/workflows/pypi-distribution.yaml +++ b/.github/workflows/pypi-distribution.yaml @@ -17,11 +17,11 @@ jobs: fail-fast: false matrix: include: - - build_type: cpu - platform: ubuntu-latest - - #- build_type: cuda + #- build_type: cpu # platform: ubuntu-latest + + - build_type: cuda + platform: ubuntu-latest ## ./ At start of reusable workflow indicates to use the one in current repo i.e. the from the current branch uses: ./.github/workflows/pypi-distribution-reusable.yaml From e12f447cd95c6d97e42ed8ce111527b715704ab6 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Sat, 21 Sep 2024 09:47:03 -0500 Subject: [PATCH 29/63] Update pyproject.toml --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2a77284..46c838b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["scikit-build-core", "pybind11", "torch"] +requires = ["scikit-build", "pybind11", "torch"] build-backend = "scikit_build_core.build" [project] @@ -12,4 +12,4 @@ authors = [ ] [tool.scikit-build] -cmake.args = ["-DNT_ENABLE_PYTHON=ON -DUSE_CUDA=OFF"] +cmake.args = ["-DNT_ENABLE_PYTHON=ON"] From 06b6045c328c881791c2aa64ff08491f332c59d6 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Sat, 21 Sep 2024 10:00:40 -0500 Subject: [PATCH 30/63] Update pypi-distribution-reusable.yaml --- .github/workflows/pypi-distribution-reusable.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index 3aecc42..cf96344 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -47,6 +47,8 @@ jobs: - name: Build wheels run: python -m cibuildwheel --output-dir dist + env: + CIBW_BEFORE_BUILD: pip install scikit-build-core - name: Store the distribution packages uses: actions/upload-artifact@v4 From 82ac0756c278c36ff006e926d7e651f7f70dddb7 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Sat, 21 Sep 2024 10:12:09 -0500 Subject: [PATCH 31/63] Update pypi-distribution-reusable.yaml --- .../workflows/pypi-distribution-reusable.yaml | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index cf96344..2dd1b3d 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -25,30 +25,32 @@ jobs: sudo rm -rf "/usr/local/share/boost" sudo rm -rf "$AGENT_TOOLSDIRECTORY" - - name: cuda-toolkit - if: ${{ startsWith( inputs.build_type, 'cuda' ) }} - uses: Jimver/cuda-toolkit@v0.2.17 + #- name: cuda-toolkit + # if: ${{ startsWith( inputs.build_type, 'cuda' ) }} + # uses: Jimver/cuda-toolkit@v0.2.17 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.11" + #- name: Set up Python + # uses: actions/setup-python@v5 + # with: + # python-version: "3.11" - - name: Install Protoc - run: sudo apt install protobuf-compiler + #- name: Install Protoc + # run: sudo apt install protobuf-compiler - - name: Install Python dependencies - uses: py-actions/py-dependency-install@v4 - with: - path: "PyTorch_requirements.txt" + #- name: Install Python dependencies + # uses: py-actions/py-dependency-install@v4 + # with: + # path: "PyTorch_requirements.txt" - - name: Install cibuildwheel - run: python -m pip install cibuildwheel==2.21.1 + #- name: Install cibuildwheel + # run: python -m pip install cibuildwheel==2.21.1 - - name: Build wheels - run: python -m cibuildwheel --output-dir dist - env: - CIBW_BEFORE_BUILD: pip install scikit-build-core + - uses: pypa/cibuildwheel@v2.21 + + #- name: Build wheels + # run: python -m cibuildwheel --output-dir dist + # env: + # CIBW_BEFORE_BUILD: pip install scikit-build-core - name: Store the distribution packages uses: actions/upload-artifact@v4 From c8a81666f9fbde9d61aa4c7ec0c81b7725f46745 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Sat, 21 Sep 2024 10:15:15 -0500 Subject: [PATCH 32/63] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 46c838b..29f94ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["scikit-build", "pybind11", "torch"] +requires = ["scikit-build-core", "pybind11", "torch"] build-backend = "scikit_build_core.build" [project] From 2df6e06545252e2605b74c4318c3a32d3c5ac031 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Mon, 23 Sep 2024 15:34:13 -0500 Subject: [PATCH 33/63] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 29f94ab..9d66378 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["scikit-build-core", "pybind11", "torch"] +requires = ["scikit-build-core>=0.3.3", "pybind11", "torch"] build-backend = "scikit_build_core.build" [project] From 9838c5a58564d63f337dd28fab3f798f379013a5 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Mon, 23 Sep 2024 15:40:34 -0500 Subject: [PATCH 34/63] Update pyproject.toml --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 9d66378..b93ec0d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,5 +11,8 @@ authors = [ { name = "Ewan Miller", email = "emiller@ifae.es" }, ] +[tool.cibuildwheel] +build-frontend = "build[uv]" + [tool.scikit-build] cmake.args = ["-DNT_ENABLE_PYTHON=ON"] From 7f6aea8237e5d1dbe93dfc432286afb178bc22d2 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Mon, 23 Sep 2024 15:44:34 -0500 Subject: [PATCH 35/63] Update pypi-distribution-reusable.yaml --- .github/workflows/pypi-distribution-reusable.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index 2dd1b3d..99fcdee 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -45,6 +45,8 @@ jobs: #- name: Install cibuildwheel # run: python -m pip install cibuildwheel==2.21.1 + - uses: yezz123/setup-uv@v4 + - uses: pypa/cibuildwheel@v2.21 #- name: Build wheels From b901e4e7fd0336eab0eeac6f88d8f12a63ebe455 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Mon, 23 Sep 2024 15:55:07 -0500 Subject: [PATCH 36/63] Update pyproject.toml --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index b93ec0d..0fd50f8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,6 +10,7 @@ readme = "README.md" authors = [ { name = "Ewan Miller", email = "emiller@ifae.es" }, ] +requires-python = ">=3.9" [tool.cibuildwheel] build-frontend = "build[uv]" From 60adf38a15a59bbf3a14e72266440c1e8c6465f7 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Mon, 23 Sep 2024 16:02:57 -0500 Subject: [PATCH 37/63] try doing cuda? --- .github/workflows/pypi-distribution-reusable.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index 99fcdee..3b0448c 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -48,6 +48,19 @@ jobs: - uses: yezz123/setup-uv@v4 - uses: pypa/cibuildwheel@v2.21 + if: runner.os == 'Linux' + env: + CIBW_BUILD_VERBOSITY: 1 + CIBW_ARCHS_LINUX: "x86_64" + CIBW_SKIP: "*musl*" + CIBW_BEFORE_ALL: > + yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo && + yum clean all && + yum -y install cuda-toolkit && + ls -al /usr/local && + export PATH=$PATH:/usr/local/cuda/bin && + nvcc --version && + export BUILD_WITH_CUDA=1 #- name: Build wheels # run: python -m cibuildwheel --output-dir dist From e45285ea05b4cc6c114a5beda0a29a7004f19e8b Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Mon, 23 Sep 2024 16:16:23 -0500 Subject: [PATCH 38/63] Update CMakeLists.txt --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 78183df..f71ce0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,6 @@ cmake_minimum_required(VERSION 3.18 FATAL_ERROR) set(CMAKE_CXX_STANDARD 17) +set(CUDA_STANDARD 14) project(nuTens) From 6af53cb0e058bf317cf49a0ba03bd55d97016dce Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Mon, 23 Sep 2024 16:22:30 -0500 Subject: [PATCH 39/63] Update pypi-distribution-reusable.yaml --- .github/workflows/pypi-distribution-reusable.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index 3b0448c..0405855 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -61,6 +61,7 @@ jobs: export PATH=$PATH:/usr/local/cuda/bin && nvcc --version && export BUILD_WITH_CUDA=1 + export TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0" #- name: Build wheels # run: python -m cibuildwheel --output-dir dist From 3305255a073dfd0f5b647e645faf517c7c34e1ab Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Mon, 23 Sep 2024 16:31:37 -0500 Subject: [PATCH 40/63] Update CMakeLists.txt --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f71ce0d..e8c0690 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.18 FATAL_ERROR) set(CMAKE_CXX_STANDARD 17) set(CUDA_STANDARD 14) +if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES) + set(CMAKE_CUDA_ARCHITECTURES "native") +endif() + project(nuTens) # Changes default install path to be a subdirectory of the build dir. From d932fd2d719406189388f4c7b40a2bfcbcd84deb Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Mon, 23 Sep 2024 16:36:39 -0500 Subject: [PATCH 41/63] Update CMakeLists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e8c0690..25381c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ set(CMAKE_CXX_STANDARD 17) set(CUDA_STANDARD 14) if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES) - set(CMAKE_CUDA_ARCHITECTURES "native") + set(CMAKE_CUDA_ARCHITECTURES 75) endif() project(nuTens) From e94f0de8b400c15c64a9eb443f4745e2b7615420 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Mon, 23 Sep 2024 16:53:22 -0500 Subject: [PATCH 42/63] Update pypi-distribution-reusable.yaml --- .github/workflows/pypi-distribution-reusable.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index 0405855..a9f7aa0 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -60,7 +60,10 @@ jobs: ls -al /usr/local && export PATH=$PATH:/usr/local/cuda/bin && nvcc --version && - export BUILD_WITH_CUDA=1 + echo nvcc location: && + which nvcc && + export CUDACXX="$(which nvcc)" + export BUILD_WITH_CUDA=1 && export TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0" #- name: Build wheels From bfa3ffd09b75d572f4f1b7f787452ca516c78492 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Mon, 23 Sep 2024 16:59:14 -0500 Subject: [PATCH 43/63] Update pypi-distribution-reusable.yaml --- .github/workflows/pypi-distribution-reusable.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index a9f7aa0..301d36f 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -62,7 +62,8 @@ jobs: nvcc --version && echo nvcc location: && which nvcc && - export CUDACXX="$(which nvcc)" + export CUDACXX="$(which nvcc)" && + echo $CUDACXX && export BUILD_WITH_CUDA=1 && export TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0" From fba3a9c095db9137f2ca9b25b80727ea6f0f8691 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Mon, 23 Sep 2024 17:06:49 -0500 Subject: [PATCH 44/63] Update pypi-distribution-reusable.yaml --- .github/workflows/pypi-distribution-reusable.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index 301d36f..e20f05b 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -64,6 +64,8 @@ jobs: which nvcc && export CUDACXX="$(which nvcc)" && echo $CUDACXX && + echo gcc version: && + gcc --version && export BUILD_WITH_CUDA=1 && export TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0" From 69528b016a11cbde9e82284f04a6d86a0c39775f Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Mon, 23 Sep 2024 17:18:11 -0500 Subject: [PATCH 45/63] aaaaaaaaaaaaaargh --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 25381c1..43392b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 3.18 FATAL_ERROR) set(CMAKE_CXX_STANDARD 17) set(CUDA_STANDARD 14) +set( CMAKE_CUDA_COMPILER "nvcc" ) if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES) set(CMAKE_CUDA_ARCHITECTURES 75) From 7236358d29b7acb7e5e5d744a38e0dfd03e3429a Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Tue, 24 Sep 2024 13:46:32 +0100 Subject: [PATCH 46/63] Update pypi-distribution-reusable.yaml --- .github/workflows/pypi-distribution-reusable.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index e20f05b..9172bb8 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -58,7 +58,6 @@ jobs: yum clean all && yum -y install cuda-toolkit && ls -al /usr/local && - export PATH=$PATH:/usr/local/cuda/bin && nvcc --version && echo nvcc location: && which nvcc && @@ -68,6 +67,8 @@ jobs: gcc --version && export BUILD_WITH_CUDA=1 && export TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0" + CIBW_ENVIRONMENT: PATH=$PATH:/usr/local/cuda/bin + #- name: Build wheels # run: python -m cibuildwheel --output-dir dist From b344de295b192426de8435c5a2bade68eeb7a337 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Tue, 24 Sep 2024 08:37:25 -0500 Subject: [PATCH 47/63] Update pypi-distribution-reusable.yaml --- .github/workflows/pypi-distribution-reusable.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index 9172bb8..2a2fa56 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -68,6 +68,7 @@ jobs: export BUILD_WITH_CUDA=1 && export TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0" CIBW_ENVIRONMENT: PATH=$PATH:/usr/local/cuda/bin + CIBW_BEFORE_BUILD: python -m site #- name: Build wheels From b1ca2d259aaa62b1e16439e4836b0fbf404dc1d2 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Tue, 24 Sep 2024 09:04:12 -0500 Subject: [PATCH 48/63] Update pypi-distribution-reusable.yaml --- .github/workflows/pypi-distribution-reusable.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index 2a2fa56..8198b88 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -66,8 +66,11 @@ jobs: echo gcc version: && gcc --version && export BUILD_WITH_CUDA=1 && - export TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0" - CIBW_ENVIRONMENT: PATH=$PATH:/usr/local/cuda/bin + export TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0" && + python -c 'import site; print(site.getsitepackages()) + CIBW_ENVIRONMENT: > + PATH=$PATH:/usr/local/cuda/bin && + LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(python -c 'import site; print(site.getsitepackages()[0])') && CIBW_BEFORE_BUILD: python -m site From bfaa30fcc1febedfb88e1aa57b8bab7d0778ff8b Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Tue, 24 Sep 2024 09:09:30 -0500 Subject: [PATCH 49/63] Update pypi-distribution-reusable.yaml --- .github/workflows/pypi-distribution-reusable.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index 8198b88..7b05d0c 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -69,8 +69,7 @@ jobs: export TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0" && python -c 'import site; print(site.getsitepackages()) CIBW_ENVIRONMENT: > - PATH=$PATH:/usr/local/cuda/bin && - LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(python -c 'import site; print(site.getsitepackages()[0])') && + PATH=$PATH:/usr/local/cuda/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(python -c 'import site; print(site.getsitepackages()[0])') && CIBW_BEFORE_BUILD: python -m site From ac3f676291b129fd001c2ec4b00fce1be19b018b Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Tue, 24 Sep 2024 09:10:52 -0500 Subject: [PATCH 50/63] Update pypi-distribution-reusable.yaml --- .github/workflows/pypi-distribution-reusable.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index 7b05d0c..eec2ac7 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -69,7 +69,7 @@ jobs: export TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0" && python -c 'import site; print(site.getsitepackages()) CIBW_ENVIRONMENT: > - PATH=$PATH:/usr/local/cuda/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(python -c 'import site; print(site.getsitepackages()[0])') && + PATH=$PATH:/usr/local/cuda/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(python -c 'import site; print(site.getsitepackages()[0])') CIBW_BEFORE_BUILD: python -m site From 921309d05b4fb798c49d2282a2ac55f1b055009e Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Tue, 24 Sep 2024 09:13:57 -0500 Subject: [PATCH 51/63] Update pypi-distribution-reusable.yaml --- .github/workflows/pypi-distribution-reusable.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index eec2ac7..605488c 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -67,10 +67,11 @@ jobs: gcc --version && export BUILD_WITH_CUDA=1 && export TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0" && - python -c 'import site; print(site.getsitepackages()) CIBW_ENVIRONMENT: > PATH=$PATH:/usr/local/cuda/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(python -c 'import site; print(site.getsitepackages()[0])') - CIBW_BEFORE_BUILD: python -m site + CIBW_BEFORE_BUILD: > + python -m site && + python -c 'import site; print(site.getsitepackages())' #- name: Build wheels From 70d7d5488fc46a8af86fd8694f851f22ed9f4283 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Tue, 24 Sep 2024 09:17:35 -0500 Subject: [PATCH 52/63] Update pypi-distribution-reusable.yaml --- .github/workflows/pypi-distribution-reusable.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index 605488c..d28c70c 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -66,7 +66,7 @@ jobs: echo gcc version: && gcc --version && export BUILD_WITH_CUDA=1 && - export TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0" && + export TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0" CIBW_ENVIRONMENT: > PATH=$PATH:/usr/local/cuda/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(python -c 'import site; print(site.getsitepackages()[0])') CIBW_BEFORE_BUILD: > From 138eb47890dad062ac988eb804a4e2b9f9b717c6 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Tue, 24 Sep 2024 09:25:56 -0500 Subject: [PATCH 53/63] Update pypi-distribution-reusable.yaml --- .github/workflows/pypi-distribution-reusable.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index d28c70c..64b7e21 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -68,7 +68,7 @@ jobs: export BUILD_WITH_CUDA=1 && export TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0" CIBW_ENVIRONMENT: > - PATH=$PATH:/usr/local/cuda/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(python -c 'import site; print(site.getsitepackages()[0])') + PATH=$PATH:/usr/local/cuda/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(python -c 'import site; print(site.getsitepackages()[0])')/torch/lib/ CIBW_BEFORE_BUILD: > python -m site && python -c 'import site; print(site.getsitepackages())' From e30ce18bd36528a611e243f6328faae2a50be066 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Tue, 24 Sep 2024 09:41:54 -0500 Subject: [PATCH 54/63] Update pypi-distribution-reusable.yaml --- .github/workflows/pypi-distribution-reusable.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index 64b7e21..fe64c36 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -71,7 +71,9 @@ jobs: PATH=$PATH:/usr/local/cuda/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(python -c 'import site; print(site.getsitepackages()[0])')/torch/lib/ CIBW_BEFORE_BUILD: > python -m site && - python -c 'import site; print(site.getsitepackages())' + python -c 'import site; print(site.getsitepackages())' && + echo $LD_LIBRARY_PATH && + ls $(python -c 'import site; print(site.getsitepackages()[0])')/torch/lib/ #- name: Build wheels From be39a5bedaced2a51f49b58f98c2e4d91004d25d Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Tue, 24 Sep 2024 09:49:46 -0500 Subject: [PATCH 55/63] Update pypi-distribution-reusable.yaml --- .github/workflows/pypi-distribution-reusable.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index fe64c36..3f0ffee 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -73,7 +73,7 @@ jobs: python -m site && python -c 'import site; print(site.getsitepackages())' && echo $LD_LIBRARY_PATH && - ls $(python -c 'import site; print(site.getsitepackages()[0])')/torch/lib/ + ls $(python -c 'import site; print(site.getsitepackages()[0])') #- name: Build wheels From fb663ceeb2c5e636937a76e8793e9d69d9628d9b Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Tue, 24 Sep 2024 10:55:48 -0500 Subject: [PATCH 56/63] Update pypi-distribution-reusable.yaml --- .github/workflows/pypi-distribution-reusable.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pypi-distribution-reusable.yaml b/.github/workflows/pypi-distribution-reusable.yaml index 3f0ffee..0cc2e58 100644 --- a/.github/workflows/pypi-distribution-reusable.yaml +++ b/.github/workflows/pypi-distribution-reusable.yaml @@ -68,12 +68,12 @@ jobs: export BUILD_WITH_CUDA=1 && export TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0" CIBW_ENVIRONMENT: > - PATH=$PATH:/usr/local/cuda/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(python -c 'import site; print(site.getsitepackages()[0])')/torch/lib/ + PATH=$PATH:/usr/local/cuda/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(python -c 'import sys; print(sys.prefix + "/lib/python" + sys.version[:3] + "/site-packages")')/torch/lib/ CIBW_BEFORE_BUILD: > python -m site && - python -c 'import site; print(site.getsitepackages())' && + python -c 'import sys; print(sys.prefix + "/lib/python" + sys.version[:3] + "/site-packages")' && echo $LD_LIBRARY_PATH && - ls $(python -c 'import site; print(site.getsitepackages()[0])') + ls $(python -c 'import sys; print(sys.prefix + "/lib/python" + sys.version[:3] + "/site-packages")') #- name: Build wheels From 67779807cd167c6837527d9bcae287eb38927e78 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Tue, 24 Sep 2024 11:44:30 -0500 Subject: [PATCH 57/63] let's try just uploading the sdist because i am very close to completely losing my mind --- .github/workflows/pypi-distribution.yaml | 100 +++++++++++++++++++---- 1 file changed, 84 insertions(+), 16 deletions(-) diff --git a/.github/workflows/pypi-distribution.yaml b/.github/workflows/pypi-distribution.yaml index 50d102b..66a0cb7 100644 --- a/.github/workflows/pypi-distribution.yaml +++ b/.github/workflows/pypi-distribution.yaml @@ -5,27 +5,95 @@ on: workflow_dispatch: jobs: - pypi_distribution: - + + build: + name: Make SDist + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Optional, use if you use setuptools_scm + submodules: true # Optional, use if you have submodules + + - name: Build SDist + run: pipx run build --sdist + + - uses: actions/upload-artifact@v4 + with: + name: cibw-sdist + path: dist/*.tar.gz + + publish-to-testpypi: + name: Publish Python 🐍 distribution 📦 to TestPyPI + needs: + - build + runs-on: ${{ inputs.platform }} + + environment: + name: testPyPi-distribution + url: https://test.pypi.org/p/nuTens + permissions: - contents: write id-token: write # IMPORTANT: mandatory for trusted publishing - secrets: inherit + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + + publish-to-pypi: + name: >- + Publish Python 🐍 distribution 📦 to PyPI + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + needs: + - build + runs-on: ${{ inputs.platform }} + environment: + name: PyPi-distribution + url: https://pypi.org/p/nuTens # Replace with your PyPI project name + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + + ## one day we will buld wheels and upload them to pypi... but it is not this day + ## when that day comes, the below might be useful + + ##pypi_distribution: + + ##permissions: + ## contents: write + ## id-token: write # IMPORTANT: mandatory for trusted publishing + + ## secrets: inherit - strategy: - fail-fast: false - matrix: - include: - #- build_type: cpu - # platform: ubuntu-latest + ##strategy: + ## fail-fast: false + ## matrix: + ## include: + ## - build_type: cpu + ## platform: ubuntu-latest - - build_type: cuda - platform: ubuntu-latest + ## - build_type: cuda + ## platform: ubuntu-latest ## ./ At start of reusable workflow indicates to use the one in current repo i.e. the from the current branch - uses: ./.github/workflows/pypi-distribution-reusable.yaml - with: - platform: ${{ matrix.platform }} - build_type: ${{ matrix.build_type }} + ## uses: ./.github/workflows/pypi-distribution-reusable.yaml + ## with: + ## platform: ${{ matrix.platform }} + ## build_type: ${{ matrix.build_type }} From 3a110a9ba66524d3f18ddfe6c789552f171f3f53 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Tue, 24 Sep 2024 11:50:04 -0500 Subject: [PATCH 58/63] AAAAAAAAARGGGGHHHH --- .github/workflows/pypi-distribution.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi-distribution.yaml b/.github/workflows/pypi-distribution.yaml index 66a0cb7..f92088f 100644 --- a/.github/workflows/pypi-distribution.yaml +++ b/.github/workflows/pypi-distribution.yaml @@ -27,7 +27,7 @@ jobs: name: Publish Python 🐍 distribution 📦 to TestPyPI needs: - build - runs-on: ${{ inputs.platform }} + runs-on: ubuntu-latest environment: name: testPyPi-distribution @@ -53,7 +53,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes needs: - build - runs-on: ${{ inputs.platform }} + runs-on: ubuntu-latest environment: name: PyPi-distribution url: https://pypi.org/p/nuTens # Replace with your PyPI project name From 3b4e7f18ee80167a12844f1add66b36025c28201 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Tue, 24 Sep 2024 11:53:49 -0500 Subject: [PATCH 59/63] ok if this doesn't work i'm done for the day --- .github/workflows/pypi-distribution.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi-distribution.yaml b/.github/workflows/pypi-distribution.yaml index f92088f..1d080ea 100644 --- a/.github/workflows/pypi-distribution.yaml +++ b/.github/workflows/pypi-distribution.yaml @@ -20,7 +20,7 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: cibw-sdist + name: python-package-distributions path: dist/*.tar.gz publish-to-testpypi: From 5e4c0ecad085a97178f9d2f061037c711c89c641 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Tue, 24 Sep 2024 12:50:33 -0500 Subject: [PATCH 60/63] Update pyproject.toml to work with pytoml --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0fd50f8..daf06b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,5 +15,5 @@ requires-python = ">=3.9" [tool.cibuildwheel] build-frontend = "build[uv]" -[tool.scikit-build] -cmake.args = ["-DNT_ENABLE_PYTHON=ON"] +[tool.scikit-build.cmake] +args = ["-DNT_ENABLE_PYTHON=ON"] From 2cdc2ba502297e7e3c4e66a9b0b92beebd248d30 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Tue, 24 Sep 2024 13:04:22 -0500 Subject: [PATCH 61/63] bump version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index daf06b6..10e4387 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build" [project] name = "nuTens" -version = "0.0.1" +version = "0.0.2" description="Library to calculate neutrino oscillation probabilities using tensors" readme = "README.md" authors = [ From 29ee5cb0743758633053ca94c0bfac9921769de3 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Wed, 25 Sep 2024 10:19:43 -0400 Subject: [PATCH 62/63] I think we can *finally* make a distributable python module that behaves nicely --- pyproject.toml | 30 ++++++++++++++++++++++++++---- python/CMakeLists.txt | 10 +++++----- python/README.md | 5 +++++ python/binding.cpp | 4 ++-- python/nuTens/__init__.py | 3 +++ python/nuTens/dtype.py | 2 ++ python/nuTens/propagator.py | 2 ++ python/nuTens/tensor.py | 2 ++ python/pyNuTens/__init__.py | 4 ---- python/pyNuTens/propagator.py | 2 -- python/pyNuTens/tensor.py | 2 -- tests/pyNuTens-test.py | 6 +++--- 12 files changed, 50 insertions(+), 22 deletions(-) create mode 100644 python/README.md create mode 100644 python/nuTens/__init__.py create mode 100644 python/nuTens/dtype.py create mode 100644 python/nuTens/propagator.py create mode 100644 python/nuTens/tensor.py delete mode 100644 python/pyNuTens/__init__.py delete mode 100644 python/pyNuTens/propagator.py delete mode 100644 python/pyNuTens/tensor.py diff --git a/pyproject.toml b/pyproject.toml index 10e4387..f66c90c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,16 +1,38 @@ -[build-system] -requires = ["scikit-build-core>=0.3.3", "pybind11", "torch"] -build-backend = "scikit_build_core.build" [project] name = "nuTens" -version = "0.0.2" +version = "0.0.3" description="Library to calculate neutrino oscillation probabilities using tensors" readme = "README.md" authors = [ { name = "Ewan Miller", email = "emiller@ifae.es" }, ] requires-python = ">=3.9" +license = {file="LICENSE"} +keywords = ["neutrino", "oscillations", "physics", "particle", "tensor", "experiment", "autograd", "differentiable programming"] +classifiers = [ + "Development Status :: 2 - Pre-Alpha", + "Environment :: GPU", + "Programming Language :: C++", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Scientific/Engineering :: Physics", + "Intended Audience :: Science/Research" +] +dependencies = [ + "torch" +] + +[project.urls] +Repository = "https://github.com/ewanwm/nuTens" +Issues = "https://github.com/ewanwm/nuTens/issues" +Documentation = "https://ewanwm.github.io/nuTens/" + +[build-system] +requires = ["scikit-build-core>=0.3.3", "pybind11", "torch"] +build-backend = "scikit_build_core.build" [tool.cibuildwheel] build-frontend = "build[uv]" diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 555b88e..a5b65f9 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,15 +1,15 @@ pybind11_add_module( - pyNuTens MODULE + _pyNuTens MODULE binding.cpp ) if(NT_USE_PCH) - target_precompile_headers( pyNuTens REUSE_FROM nuTens-pch ) + target_precompile_headers( _pyNuTens REUSE_FROM nuTens-pch ) endif() -target_link_libraries( pyNuTens PUBLIC nuTens ) +target_link_libraries( _pyNuTens PUBLIC nuTens ) # This is passing in the version as a define just as an example -target_compile_definitions( pyNuTens PRIVATE VERSION_INFO=${PROJECT_VERSION} ) +target_compile_definitions( _pyNuTens PRIVATE VERSION_INFO=${PROJECT_VERSION} ) -install( TARGETS pyNuTens DESTINATION pyNuTens/ ) \ No newline at end of file +install( TARGETS _pyNuTens DESTINATION nuTens/ ) \ No newline at end of file diff --git a/python/README.md b/python/README.md new file mode 100644 index 0000000..7605186 --- /dev/null +++ b/python/README.md @@ -0,0 +1,5 @@ +## Python Interface + +nuTens provides a python interface that can be installed manually or via [pyPi](https://pypi.org/). [binding.cpp](binding.cpp) defines the python bindings of many of the nuTens c++ objects, which are then compiled into a python module using [pybind11](https://github.com/pybind/pybind11) (see [CMakeLists.txt](CMakeLists.txt)). + +The [nuTens](nuTens) folder defines the python module and any pure python extension code for nuTens should go in there. \ No newline at end of file diff --git a/python/binding.cpp b/python/binding.cpp index cf4035f..7e9ad9f 100644 --- a/python/binding.cpp +++ b/python/binding.cpp @@ -18,9 +18,9 @@ void initTensor(py::module & /*m*/); void initPropagator(py::module & /*m*/); void initDtypes(py::module & /*m*/); -// initialise the top level module "pyNuTens" +// initialise the top level module "_pyNuTens" // NOLINTNEXTLINE -PYBIND11_MODULE(pyNuTens, m) +PYBIND11_MODULE(_pyNuTens, m) { m.doc() = "Library to calculate neutrino oscillations"; initTensor(m); diff --git a/python/nuTens/__init__.py b/python/nuTens/__init__.py new file mode 100644 index 0000000..ed3dd79 --- /dev/null +++ b/python/nuTens/__init__.py @@ -0,0 +1,3 @@ +from ._pyNuTens import __doc__, __version__, tensor, propagator, dtype + +__all__ = ["__doc__", "__version__", "tensor", "propagator", "dtype"] \ No newline at end of file diff --git a/python/nuTens/dtype.py b/python/nuTens/dtype.py new file mode 100644 index 0000000..d6657b8 --- /dev/null +++ b/python/nuTens/dtype.py @@ -0,0 +1,2 @@ +from ._pyNuTens import dtype +from ._pyNuTens.dtype import * \ No newline at end of file diff --git a/python/nuTens/propagator.py b/python/nuTens/propagator.py new file mode 100644 index 0000000..769a9de --- /dev/null +++ b/python/nuTens/propagator.py @@ -0,0 +1,2 @@ +from ._pyNuTens import propagator +from ._pyNuTens.propagator import * \ No newline at end of file diff --git a/python/nuTens/tensor.py b/python/nuTens/tensor.py new file mode 100644 index 0000000..3e4825c --- /dev/null +++ b/python/nuTens/tensor.py @@ -0,0 +1,2 @@ +from ._pyNuTens import tensor +from ._pyNuTens.tensor import * \ No newline at end of file diff --git a/python/pyNuTens/__init__.py b/python/pyNuTens/__init__.py deleted file mode 100644 index 1a3fcb9..0000000 --- a/python/pyNuTens/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ - -from .pyNuTens import __doc__, __version__ - -__all__ = ["__doc__", "__version__", "tensor", "propagator"] \ No newline at end of file diff --git a/python/pyNuTens/propagator.py b/python/pyNuTens/propagator.py deleted file mode 100644 index 12dce4d..0000000 --- a/python/pyNuTens/propagator.py +++ /dev/null @@ -1,2 +0,0 @@ -from .pyNuTens import propagator -from .pyNuTens.propagator import * \ No newline at end of file diff --git a/python/pyNuTens/tensor.py b/python/pyNuTens/tensor.py deleted file mode 100644 index 6476915..0000000 --- a/python/pyNuTens/tensor.py +++ /dev/null @@ -1,2 +0,0 @@ -from .pyNuTens import tensor -from .pyNuTens.tensor import * \ No newline at end of file diff --git a/tests/pyNuTens-test.py b/tests/pyNuTens-test.py index c4cfdc9..58a34a3 100644 --- a/tests/pyNuTens-test.py +++ b/tests/pyNuTens-test.py @@ -1,7 +1,7 @@ import torch -import pyNuTens as nt -from pyNuTens import tensor -from pyNuTens.tensor import Tensor +import nuTens as nt +from nuTens import tensor +from nuTens.tensor import Tensor import matplotlib.pyplot as plt import typing From 8e08fe61ea1e15adce3ef63e423617a7e5bb8f84 Mon Sep 17 00:00:00 2001 From: Ewan Miller Date: Wed, 25 Sep 2024 17:08:15 +0200 Subject: [PATCH 63/63] Update pypi-distribution.yaml to only run automatically when deploying a release --- .github/workflows/pypi-distribution.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pypi-distribution.yaml b/.github/workflows/pypi-distribution.yaml index 1d080ea..05bb05c 100644 --- a/.github/workflows/pypi-distribution.yaml +++ b/.github/workflows/pypi-distribution.yaml @@ -1,7 +1,8 @@ name: Publish to PyPi on: - push: + release: + types: [published] workflow_dispatch: jobs: