From 4884882047d39690d71d94bef9ee5f51db90db08 Mon Sep 17 00:00:00 2001 From: Luke Polson Date: Sat, 28 Sep 2024 22:07:10 -0700 Subject: [PATCH 1/8] add pyproject.toml to python folder and workflow that auto pushes to python package index --- .github/workflows/ci.yml | 6 ++++++ python/pyproject.toml | 14 ++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 python/pyproject.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f853a09..7fc7e9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,3 +58,9 @@ jobs: ninja ./prd_generator test.h5 ./prd_analysis test.h5 + + - name: Publish to TestPyPI + run: | + cd python + python -m build + twine upload --repository-url https://test.pypi.org/legacy/ dist/* -u __token__ -p ${{ secrets.TEST_PYPI_TOKEN }} diff --git a/python/pyproject.toml b/python/pyproject.toml new file mode 100644 index 0000000..8809eb8 --- /dev/null +++ b/python/pyproject.toml @@ -0,0 +1,14 @@ +[build-system] +requires = ["setuptools>=42", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "prd" +version = "0.0.1" # Update as needed +description = "Your package description" +authors = [{ name = "Your Name", email = "your.email@example.com" }] +license = { text = "MIT" } # Update as needed +requires-python = ">=3.8" +dependencies = [ + "numpy>=1.24.3", +] From 1f44f0f6d6c0613ee937667bc5a2f1b3e5bfecf8 Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Sun, 29 Sep 2024 09:41:43 +0100 Subject: [PATCH 2/8] Update python/pyproject.toml --- python/pyproject.toml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python/pyproject.toml b/python/pyproject.toml index 8809eb8..7e3575d 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -5,9 +5,10 @@ build-backend = "setuptools.build_meta" [project] name = "prd" version = "0.0.1" # Update as needed -description = "Your package description" -authors = [{ name = "Your Name", email = "your.email@example.com" }] -license = { text = "MIT" } # Update as needed +description = "Library and tools for working with PET Emission Tomography Standardization Initiative Raw Data (PETSIRD) data" +readme = "README.md" +authors = [{ name = "Kris Thielemans", email = "k.thielemans@ucl.ac.uk" }] +license = { text = "Apache-2.0" } # Update as needed requires-python = ">=3.8" dependencies = [ "numpy>=1.24.3", From 0eaa7144003ed4fd17de3128f01bc5666be402e7 Mon Sep 17 00:00:00 2001 From: Luke Polson Date: Sun, 29 Sep 2024 10:35:08 -0700 Subject: [PATCH 3/8] create separate workflow for pushing to testpypi if CI succeeds --- .github/workflows/ci.yml | 6 ----- .github/workflows/test_pypi.yml | 48 +++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/test_pypi.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7fc7e9d..f853a09 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,9 +58,3 @@ jobs: ninja ./prd_generator test.h5 ./prd_analysis test.h5 - - - name: Publish to TestPyPI - run: | - cd python - python -m build - twine upload --repository-url https://test.pypi.org/legacy/ dist/* -u __token__ -p ${{ secrets.TEST_PYPI_TOKEN }} diff --git a/.github/workflows/test_pypi.yml b/.github/workflows/test_pypi.yml new file mode 100644 index 0000000..cdb340f --- /dev/null +++ b/.github/workflows/test_pypi.yml @@ -0,0 +1,48 @@ +name: Publish to TestPyPI + +on: + workflow_run: + workflows: ["CI"] + types: + - completed +env: + # Increase this to manually reset the conda environment cache + YARDL_VERSION: 0.6.1 + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.9' # Adjust Python version as needed + + - name: Install required packages + run: | + pip install setuptools wheel twine build + + - name: Install yardl + run: | + YARDL_DIR=${{github.workspace}}/yardl + mkdir ${YARDL_DIR} + cd ${YARDL_DIR} + echo "${{github.workspace}}/yardl" >> $GITHUB_PATH + wget --quiet "https://github.com/microsoft/yardl/releases/download/v${YARDL_VERSION}/yardl_${YARDL_VERSION}_linux_x86_64.tar.gz" + tar -xzf "yardl_${YARDL_VERSION}_linux_x86_64.tar.gz" + rm "yardl_${YARDL_VERSION}_linux_x86_64.tar.gz" + + - name: Run yardl + run: | + cd model + yardl generate + + - name: Publish to TestPyPI + run: | + cd python + python -m build + twine upload --repository-url https://test.pypi.org/legacy/ dist/* -u __token__ -p ${{ secrets.TEST_PYPI_TOKEN }} \ No newline at end of file From 5ceea27bff84e0b0c61ce7b1aff036b74d3bac33 Mon Sep 17 00:00:00 2001 From: Luke Polson Date: Mon, 30 Sep 2024 09:52:21 -0700 Subject: [PATCH 4/8] update python and numpy versions in pyproject.toml --- python/pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/pyproject.toml b/python/pyproject.toml index 7e3575d..af4cc55 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -9,7 +9,7 @@ description = "Library and tools for working with PET Emission Tomography Standa readme = "README.md" authors = [{ name = "Kris Thielemans", email = "k.thielemans@ucl.ac.uk" }] license = { text = "Apache-2.0" } # Update as needed -requires-python = ">=3.8" +requires-python = ">=3.9" dependencies = [ - "numpy>=1.24.3", + "numpy>=1.22", ] From bc65fde81abc886e0a1f9c895b2efa5027d570ae Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Tue, 8 Oct 2024 12:25:01 +0100 Subject: [PATCH 5/8] use petsird --- python/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/pyproject.toml b/python/pyproject.toml index af4cc55..92d16f4 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=42", "wheel"] build-backend = "setuptools.build_meta" [project] -name = "prd" +name = "petsird" version = "0.0.1" # Update as needed description = "Library and tools for working with PET Emission Tomography Standardization Initiative Raw Data (PETSIRD) data" readme = "README.md" From fd46f5970b37e39c593688f72cbf57a380009a6f Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Tue, 8 Oct 2024 14:51:01 +0100 Subject: [PATCH 6/8] [CI] minor fixes to test_pypi action --- .github/workflows/test_pypi.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_pypi.yml b/.github/workflows/test_pypi.yml index cdb340f..f3cd4a7 100644 --- a/.github/workflows/test_pypi.yml +++ b/.github/workflows/test_pypi.yml @@ -2,7 +2,7 @@ name: Publish to TestPyPI on: workflow_run: - workflows: ["CI"] + workflows: [CI] types: - completed env: @@ -12,13 +12,13 @@ env: jobs: publish: runs-on: ubuntu-latest - + if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.9' # Adjust Python version as needed From e0411ce6c09a2978af13cf1ce3e8639d4e4238c4 Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Sun, 27 Oct 2024 17:37:25 +0000 Subject: [PATCH 7/8] minor updates to pyproject.toml - add urls --- python/pyproject.toml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/pyproject.toml b/python/pyproject.toml index 92d16f4..e3db3bd 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -8,8 +8,13 @@ version = "0.0.1" # Update as needed description = "Library and tools for working with PET Emission Tomography Standardization Initiative Raw Data (PETSIRD) data" readme = "README.md" authors = [{ name = "Kris Thielemans", email = "k.thielemans@ucl.ac.uk" }] -license = { text = "Apache-2.0" } # Update as needed +license = { text = "Apache-2.0" } requires-python = ">=3.9" dependencies = [ "numpy>=1.22", ] + +[project.urls] +Homepage = "https://etsinitiative.org/" +Repository = "https://github.com/ETSInitiative/PETSIRD.git" +Issues = "https://github.com/ETSInitiative/PETSIRD/issues" From 668a1e691c40c9b29ae851af6a0cfcfd81c4f332 Mon Sep 17 00:00:00 2001 From: Kris Thielemans Date: Sun, 27 Oct 2024 17:39:12 +0000 Subject: [PATCH 8/8] update yardl version --- .github/workflows/test_pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_pypi.yml b/.github/workflows/test_pypi.yml index f3cd4a7..09cabe1 100644 --- a/.github/workflows/test_pypi.yml +++ b/.github/workflows/test_pypi.yml @@ -7,7 +7,7 @@ on: - completed env: # Increase this to manually reset the conda environment cache - YARDL_VERSION: 0.6.1 + YARDL_VERSION: 0.6.2 jobs: publish: