diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml deleted file mode 100644 index 862034c..0000000 --- a/.github/workflows/python-publish.yml +++ /dev/null @@ -1,36 +0,0 @@ -# This workflow will upload a Python Package using Twine when a release is created -# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries - -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -name: Upload Python Package - -on: - release: - types: [published] - -jobs: - deploy: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build - - name: Build package - run: python -m build - - name: Publish package - uses: pypa/gh-action-pypi-publish@b7f401de30cb6434a1e19f805ff006643653240e - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1f99d1c..14dfeb3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,50 +5,105 @@ on: schedule: # Run weekly, Friday at 7:15 EST. - cron: '15 12 * * 5' + release: + types: [published] jobs: + build: + if: ${{ github.event_name == 'release' && github.event.action == 'published' }} + name: Build Wheels + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install build + + - name: Build + run: python -m build + + - uses: actions/upload-artifact@v3 + with: + path: | + ./dist/*.whl + ./dist/*.tar.gz + tests: + name: Tests + # always run, but wait for build if publishing + if: ${{ !cancelled() }} + needs: [build] runs-on: ubuntu-latest + env: + PUBLISH: ${{ github.event_name == 'release' && github.event.action == 'published' }} strategy: matrix: python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + - name: Install dependencies run: | python -m pip install -U pip pip install numpy pip install 'setuptools' 'wheel' 'numpy>=1.19.0' 'Cython>=0.29.21,<3' # for classy pip install --no-build-isolation classy + + - name: Install package from source + if: ${{ env.PUBLISH != 'true' }} + run: | pip install -U .[test] make -C pipe_asdf + + - name: Fetch wheel + if: ${{ env.PUBLISH == 'true' }} + uses: actions/download-artifact@v3 + with: + name: artifact + path: dist + + - name: Install package from wheel + if: ${{ env.PUBLISH == 'true' }} + run: | + pip install $(ls dist/*.whl)[test] + - name: Test Python with pytest run: | # TODO: set up environment in tox export NUMBA_THREADING_LAYER=forksafe pytest -v + - name: Test pipe_asdf + # no C test client from wheels + if: ${{ env.PUBLISH != 'true' }} run: | ./tests/test_pipe_asdf.sh - lint: + upload: + name: PyPI Upload + if: ${{ github.event_name == 'release' && github.event.action == 'published' }} + needs: [build, tests] + environment: pypi + permissions: + id-token: write runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v4 + - uses: actions/download-artifact@v3 with: - python-version: "3.10" - - name: Install dependencies - run: | - python -m pip install -U pip - pip install pre-commit - - name: Lint with pre-commit - run: | - pre-commit run --all-files + name: artifact + path: dist + + - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/CHANGES.rst b/CHANGES.rst index 4b3cd80..35443ac 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,9 +1,25 @@ Changelog ========= -1.4.0 (2023-??-??) +2.0.0 (2023-11-15) ------------------ +abacusutils 2.0 introduces a power spectrum module based on fast, parallelized TSC +and FFT, including grid interlacing and window compensation, that can output bandpowers, +Legendre multipoles, (k,mu) wedges, and more. + +The set of default installed dependencies has also been reduced to avoid trouble with +source-only distributions. Use `pip install abacusutils[all]` if you need functionality +provided by a non-default dependency. + +Furthermore, there's a new Zel'dovich Control Variates (ZCV) module, and the HOD module +has many additions, performance improvements, and bug fixes. + +This is a relatively large release, so the version number has been bumped to 2.0.0. + +Supported Python versions are 3.8-3.11. Python 3.7 continues to work, although we'll +drop support if/when this is no longer the case. + New Features ~~~~~~~~~~~~ - HOD now supports a new ELG conformity model @@ -13,12 +29,15 @@ New Features Fixes ~~~~~ - Bump Numba requirement to fixed version and enable parallelism in env calc [#60] +- Many small bug fixes Enhancements ~~~~~~~~~~~~ - Add power spectrum to `metadata` module [#69] - Upgrade docs and CI [#71] - Power spectrum optimization and parallelization [#102] +- Compute Xi(rp,pi) from P(k) [#115] +- Update CI test and build infrastructure [#118] Installation ~~~~~~~~~~~~ diff --git a/abacusnbody/metadata/abacussummit.py b/abacusnbody/metadata/abacussummit.py index 2e507d6..773d4d7 100644 --- a/abacusnbody/metadata/abacussummit.py +++ b/abacusnbody/metadata/abacussummit.py @@ -45,7 +45,7 @@ def get_meta(simname, redshift=None): if 'CLASS_power_spectrum' in af_tree[sim]: metadata[sim]['CLASS_power_spectrum'] = af_tree[sim]['CLASS_power_spectrum'] if simname not in metadata: - raise ValueError(f'Simulation "{simname}" is not in metadata file "{metadata_fn}"') + raise ValueError(f'Simulation "{simname}" is not in metadata files "{metadata_fns}"') res = dict(metadata[simname]['param']) @@ -58,7 +58,7 @@ def get_meta(simname, redshift=None): if not redshift.startswith('z'): redshift = 'z' + redshift if redshift not in metadata[simname]['state']: - raise ValueError(f'Redshift {redshift} metadata not present for "{simname}" in metadata file "{metadata_fn}') + raise ValueError(f'Redshift {redshift} metadata not present for "{simname}" in metadata files "{metadata_fns}') res.update(metadata[simname]['state'][redshift]) return res diff --git a/pyproject.toml b/pyproject.toml index 21e5bdc..6bea5da 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,7 @@ [build-system] requires = [ "setuptools>=61", - "wheel", "setuptools_scm>=6.2", - "pip>=21.2", ] build-backend = "setuptools.build_meta"