From e67078df7852a0dac3b5055cd633e367ced5a7a1 Mon Sep 17 00:00:00 2001 From: wjr21 Date: Wed, 12 Feb 2025 20:04:12 +0000 Subject: [PATCH 1/6] Don't use a enivronment for the build too --- .github/workflows/deploy.yml | 40 ++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b4411469c..d77e14cbf 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,4 +1,4 @@ -name: Publish Python Package +name: Publish Python 🐍 distribution 📦 to PyPI on: push: @@ -8,7 +8,6 @@ on: jobs: build: runs-on: ubuntu-latest - environment: pypi-deployment # Grant the job permission to request an OIDC token permissions: contents: read @@ -16,12 +15,14 @@ jobs: steps: - name: Check out the repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + persist-credentials: false - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: - python-version: "3.8" + python-version: "3.10" - name: Install build dependencies run: | @@ -31,8 +32,29 @@ jobs: - name: Build source distribution (sdist only) run: python -m build --sdist - # We publish using the "Trusted Publisher" system on PyPi - - name: Publish to PyPI via OIDC - uses: pypa/gh-action-pypi-publish@v1.6.0 + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + publish-to-pypi: + name: >- + Publish Python 🐍 distribution 📦 to PyPI + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi-deployment + url: https://pypi.org/p/cosmos-synthesizer + permissions: + id-token: write + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 with: - user: __token__ + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 From 0790da8014cc3ea9e135e6b8fdd9d2ea3d9d8c7d Mon Sep 17 00:00:00 2001 From: wjr21 Date: Wed, 12 Feb 2025 20:04:38 +0000 Subject: [PATCH 2/6] Need to use PyPi complaint metadata --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5c0c53452..2950160b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,9 +65,9 @@ classifiers = [ # Optional # 4 - Beta # 5 - Production/Stable "Development Status :: 4 - Beta", # 3 Alpha/4 Beta/5 Production/Stable - "Intended Audience :: Astronomers", - "Topic :: Synthetic Observations", - "License :: GNU GENERAL PUBLIC LICENSE v3.0", + "Intended Audience :: Science/Research", + "Topic :: Scientific/Engineering :: Astronomy", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", # Supported Python versions "Programming Language :: Python :: 3.8", From e661273fb0ec7ed42cc9ca600cd9beca9439b1e5 Mon Sep 17 00:00:00 2001 From: wjr21 Date: Thu, 13 Feb 2025 12:13:37 +0000 Subject: [PATCH 3/6] Removing github based optional dependencies --- pyproject.toml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5f517fff5..a00b737b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -126,17 +126,6 @@ bluetides = [ eagle = [ "schwimmbad", ] -illustris = [ - "illustris_python @ git+https://github.com/illustristng/illustris_python.git@master", -] - -# Optional dependency for using dense_basis (note that we -# currently have to use the main branch since the PyPi version -# hasn't been updated with a fix we required) -dense_basis = [ - "dense_basis@git+https://github.com/kartheikiyer/dense_basis", -] - # Project urls [project.urls] From d84656bb60db2fae5cd88c641b8a2b0be6f12820 Mon Sep 17 00:00:00 2001 From: wjr21 Date: Thu, 13 Feb 2025 12:24:10 +0000 Subject: [PATCH 4/6] Clearly signposting illutris_python --- .github/workflows/python-app.yml | 3 ++- src/synthesizer/load_data/load_illustris.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index a81605286..9a7a7a35a 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -35,7 +35,8 @@ jobs: # is not set up properly and depends on numpy and cython, the former # we depend on, the latter we need to install) pip install cython - WITH_OPENMP=1 pip install .[bluetides,eagle,illustris,dense_basis] + WITH_OPENMP=1 pip install .[bluetides,eagle,dense_basis] + pip install "illustris_python @ git+https://github.com/illustristng/illustris_python.git@master" # Output the compilation report so it can be viewed in an action log cat build_synth.log - uses: astral-sh/ruff-action@v1 # Lint with Ruff diff --git a/src/synthesizer/load_data/load_illustris.py b/src/synthesizer/load_data/load_illustris.py index 6517db584..b93432cd1 100644 --- a/src/synthesizer/load_data/load_illustris.py +++ b/src/synthesizer/load_data/load_illustris.py @@ -35,8 +35,8 @@ except ImportError: raise UnmetDependency( "The `illustris_python` module is required to load IllustrisTNG data. " - "Install synthesizer with the `illustris` extra dependencies:" - " `pip install .[illustris]`." + "Install it via `pip install 'illustris_python @ " + "git+https://github.com/illustristng/illustris_python.git@master'" ) From de3ae493576dfba17770df5ec40bd141f9f610c7 Mon Sep 17 00:00:00 2001 From: wjr21 Date: Thu, 13 Feb 2025 12:25:23 +0000 Subject: [PATCH 5/6] Can actually just use the pip version of dense basis now its optional --- pyproject.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index a00b737b2..661510f4e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -127,6 +127,12 @@ eagle = [ "schwimmbad", ] +# Optional dependency for using dense_basis +dense_basis = [ + "dense_basis", +] + + # Project urls [project.urls] "Homepage" = "https://github.com/flaresimulations/synthesizer" From 1d2863ca402f3e682004e4a140384e673f5746b8 Mon Sep 17 00:00:00 2001 From: wjr21 Date: Thu, 13 Feb 2025 12:49:59 +0000 Subject: [PATCH 6/6] Ok, forget that we just need to install from the repo --- .github/workflows/python-app.yml | 3 ++- .github/workflows/static.yml | 3 ++- pyproject.toml | 6 ------ 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 9a7a7a35a..bd7f909fc 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -35,8 +35,9 @@ jobs: # is not set up properly and depends on numpy and cython, the former # we depend on, the latter we need to install) pip install cython - WITH_OPENMP=1 pip install .[bluetides,eagle,dense_basis] + WITH_OPENMP=1 pip install .[bluetides,eagle] pip install "illustris_python @ git+https://github.com/illustristng/illustris_python.git@master" + pip install "dense_basis@git+https://github.com/kartheikiyer/dense_basis" # Output the compilation report so it can be viewed in an action log cat build_synth.log - uses: astral-sh/ruff-action@v1 # Lint with Ruff diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 19e0b1445..bba9d8dbf 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -34,7 +34,8 @@ jobs: run: | python -m pip install --upgrade pip pip install wheel - pip install -e .[docs,dense_basis] + pip install -e .[docs] + pip install "dense_basis@git+https://github.com/kartheikiyer/dense_basis" sudo apt install pandoc - name: Download test data run: | diff --git a/pyproject.toml b/pyproject.toml index 661510f4e..a00b737b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -127,12 +127,6 @@ eagle = [ "schwimmbad", ] -# Optional dependency for using dense_basis -dense_basis = [ - "dense_basis", -] - - # Project urls [project.urls] "Homepage" = "https://github.com/flaresimulations/synthesizer"