Add Python 3.12 support #1007
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Windows build | |
on: | |
push: | |
paths: | |
- '**' | |
- '!*' | |
- '*.py' | |
- '!doc/**' | |
- '!.github/**' | |
- '.github/workflows/build_windows.yml' | |
pull_request: | |
paths-ignore: | |
- 'doc/**' | |
schedule: | |
- cron: '0 20 * * 2' | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
if: "!contains(github.event.head_commit.message, 'ci skip')" | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-latest | |
python-version: "3.11" | |
TEST_FILES: tests/test_actionAngle.py | |
REQUIRES_PYNBODY: false | |
REQUIRES_ASTROPY: false | |
REQUIRES_ASTROQUERY: false | |
REQUIRES_NUMBA: false | |
REQUIRES_JAX: false | |
- os: windows-latest | |
python-version: "3.11" | |
TEST_FILES: tests/test_sphericaldf.py | |
REQUIRES_PYNBODY: false | |
REQUIRES_ASTROPY: false | |
REQUIRES_ASTROQUERY: false | |
REQUIRES_NUMBA: false | |
REQUIRES_JAX: false | |
- os: windows-latest | |
python-version: "3.11" | |
TEST_FILES: tests/test_conversion.py tests/test_galpypaper.py tests/test_import.py tests/test_interp_potential.py tests/test_kuzminkutuzov.py tests/test_util.py | |
REQUIRES_PYNBODY: false | |
REQUIRES_ASTROPY: false | |
REQUIRES_ASTROQUERY: false | |
REQUIRES_NUMBA: false | |
REQUIRES_JAX: false | |
- os: windows-latest | |
python-version: "3.11" | |
TEST_FILES: tests/test_SpiralArmsPotential.py tests/test_potential.py tests/test_scf.py | |
REQUIRES_PYNBODY: false | |
REQUIRES_ASTROPY: false | |
REQUIRES_ASTROQUERY: false | |
REQUIRES_NUMBA: false | |
REQUIRES_JAX: false | |
- os: windows-latest | |
python-version: "3.11" | |
TEST_FILES: tests/test_quantity.py tests/test_coords.py | |
REQUIRES_PYNBODY: false | |
# needs to be separate for different config | |
REQUIRES_ASTROPY: true | |
REQUIRES_ASTROQUERY: false | |
REQUIRES_NUMBA: false | |
REQUIRES_JAX: false | |
- os: windows-latest | |
python-version: "3.11" | |
TEST_FILES: tests/test_orbit.py -k test_energy_jacobi_conservation | |
REQUIRES_PYNBODY: false | |
REQUIRES_ASTROPY: true | |
REQUIRES_ASTROQUERY: true | |
REQUIRES_NUMBA: false | |
REQUIRES_JAX: false | |
- os: windows-latest | |
python-version: "3.11" | |
TEST_FILES: tests/test_orbit.py tests/test_orbits.py -k 'not test_energy_jacobi_conservation' | |
REQUIRES_PYNBODY: false | |
REQUIRES_ASTROPY: true | |
REQUIRES_ASTROQUERY: true | |
REQUIRES_NUMBA: false | |
REQUIRES_JAX: false | |
- os: windows-latest | |
python-version: "3.11" | |
TEST_FILES: tests/test_evolveddiskdf.py | |
REQUIRES_PYNBODY: false | |
REQUIRES_ASTROPY: false | |
REQUIRES_ASTROQUERY: false | |
REQUIRES_NUMBA: false | |
REQUIRES_JAX: false | |
- os: windows-latest | |
python-version: "3.11" | |
TEST_FILES: tests/test_jeans.py tests/test_dynamfric.py | |
REQUIRES_PYNBODY: false | |
REQUIRES_ASTROPY: false | |
REQUIRES_ASTROQUERY: false | |
REQUIRES_NUMBA: false | |
REQUIRES_JAX: false | |
- os: windows-latest | |
python-version: "3.11" | |
TEST_FILES: tests/test_qdf.py tests/test_pv2qdf.py tests/test_streamgapdf_impulse.py tests/test_noninertial.py | |
REQUIRES_PYNBODY: false | |
REQUIRES_ASTROPY: false | |
REQUIRES_ASTROQUERY: false | |
REQUIRES_NUMBA: false | |
REQUIRES_JAX: false | |
- os: windows-latest | |
python-version: "3.11" | |
TEST_FILES: tests/test_streamgapdf.py | |
REQUIRES_PYNBODY: false | |
REQUIRES_ASTROPY: false | |
REQUIRES_ASTROQUERY: false | |
REQUIRES_NUMBA: false | |
REQUIRES_JAX: false | |
- os: windows-latest | |
python-version: "3.11" | |
TEST_FILES: tests/test_diskdf.py | |
REQUIRES_PYNBODY: false | |
REQUIRES_ASTROPY: false | |
REQUIRES_ASTROQUERY: false | |
REQUIRES_NUMBA: false | |
REQUIRES_JAX: false | |
- os: windows-latest | |
python-version: "3.11" | |
TEST_FILES: tests/test_streamdf.py tests/test_streamspraydf.py | |
REQUIRES_PYNBODY: false | |
REQUIRES_ASTROPY: false | |
REQUIRES_ASTROQUERY: false | |
REQUIRES_NUMBA: false | |
REQUIRES_JAX: false | |
- os: windows-latest | |
python-version: "3.10" | |
TEST_FILES: tests/test_orbit.py -k test_energy_jacobi_conservation | |
REQUIRES_PYNBODY: false | |
REQUIRES_ASTROPY: true | |
REQUIRES_ASTROQUERY: true | |
REQUIRES_NUMBA: false | |
REQUIRES_JAX: false | |
- os: windows-latest | |
python-version: "3.10" | |
TEST_FILES: tests/test_orbit.py tests/test_orbits.py -k 'not test_energy_jacobi_conservation' | |
REQUIRES_PYNBODY: false | |
REQUIRES_ASTROPY: true | |
REQUIRES_ASTROQUERY: true | |
REQUIRES_NUMBA: false | |
REQUIRES_JAX: false | |
- os: windows-latest | |
python-version: 3.9 | |
TEST_FILES: tests/test_orbit.py -k test_energy_jacobi_conservation | |
REQUIRES_PYNBODY: false | |
REQUIRES_ASTROPY: true | |
REQUIRES_ASTROQUERY: true | |
REQUIRES_NUMBA: false | |
REQUIRES_JAX: false | |
- os: windows-latest | |
python-version: 3.9 | |
TEST_FILES: tests/test_orbit.py tests/test_orbits.py -k 'not test_energy_jacobi_conservation' | |
REQUIRES_PYNBODY: false | |
REQUIRES_ASTROPY: true | |
REQUIRES_ASTROQUERY: true | |
REQUIRES_NUMBA: false | |
REQUIRES_JAX: false | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Cache both conda and pip, conda done by setup-micromamba | |
- uses: actions/cache@v3 | |
with: | |
path: ~\AppData\Local\pip\Cache | |
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('.github/workflows/build_windows.yml') }}-${{ matrix.REQUIRES_PYNBODY }}-${{ matrix.REQUIRES_ASTROPY }}-${{ matrix.REQUIRES_ASTROQUERY }}-${{ matrix.REQUIRES_NUMBA }}-${{ matrix.REQUIRES_JAX }} | |
# Install just the GSL using conda | |
- uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-name: gsl | |
condarc: | | |
channels: | |
- conda-forge | |
create-args: gsl | |
cache-environment: true | |
cache-environment-key: ${{ runner.os }}-${{ hashFiles('.github/workflows/build_windows.yml') }} | |
- name: Set GSL environment variables | |
shell: bash -l {0} | |
run: | | |
echo "INCLUDE=$CONDA_PREFIX\\Library\\include" >> $GITHUB_ENV | |
echo "LIB=$CONDA_PREFIX\\Library\\lib" >> $GITHUB_ENV | |
echo "LIBPATH=$CONDA_PREFIX\\Library\\lib" >> $GITHUB_ENV | |
echo "$CONDA_PREFIX\\Library\\bin" >> $GITHUB_PATH # necessary when we don't activate the environment | |
- name: Install Python dependencies | |
run: | | |
pip install --upgrade --upgrade-strategy eager numpy scipy matplotlib numexpr setuptools cython pytest tqdm | |
- name: Install pynbody | |
if: ${{ matrix.REQUIRES_PYNBODY }} | |
run: | | |
pip install --upgrade --upgrade-strategy eager h5py pandas pytz | |
pip install --upgrade --upgrade-strategy eager wheel | |
pip install --upgrade --upgrade-strategy eager pynbody | |
- name: Install astropy | |
if: ${{ matrix.REQUIRES_ASTROPY && matrix.python-version != 4.0 }} | |
run: | | |
pip install astropy pyerfa | |
- name: Install astropy (Python 4.0; doesn't exist of course, placeholder for new python v) | |
if: ${{ matrix.REQUIRES_ASTROPY && matrix.python-version == 4.0 }} | |
run: | | |
pip install pyerfa | |
pip install --extra-index-url=https://pkgs.dev.azure.com/astropy-project/astropy/_packaging/nightly/pypi/simple/ --pre astropy | |
- name: Install astroquery | |
if: ${{ matrix.REQUIRES_ASTROQUERY }} | |
run: pip install astroquery | |
- name: Install numba | |
if: ${{ matrix.REQUIRES_NUMBA }} | |
run: pip install numba | |
- name: Install JAX | |
if: ${{ matrix.REQUIRES_JAX }} | |
run: pip install jax jaxlib | |
- name: Install package | |
run: | | |
python -m pip install -ve . | |
- name: Print debug info | |
shell: pwsh | |
env: | |
REQUIRES_ASTROPY : ${{ matrix.REQUIRES_ASTROPY }} | |
REQUIRES_ASTROQUERY : ${{ matrix.REQUIRES_ASTROQUERY }} | |
REQUIRES_PYNBODY : ${{ matrix.REQUIRES_PYNBODY }} | |
run: | | |
python -c "import numpy; print('numpy: {}'.format(numpy.__version__))" | |
python -c "import scipy; print('scipy: {}'.format(scipy.__version__))" | |
python -c "import matplotlib; print('matplotlib: {}'.format(matplotlib.__version__))" | |
if ( $REQUIRES_ASTROPY ) { python -c "import astropy; print('astropy: {}'.format(astropy.__version__))"} | |
if ( $REQUIRES_ASTROQUERY ) { python -c "import astroquery; print('astroquery: {}'.format(astroquery.__version__))"} | |
if ( $REQUIRES_PYNBODY ) {python -c "import pynbody; print('pynbody: {}'.format(pynbody.__version__))"} | |
- name: Test with pytest | |
shell: bash | |
env: | |
TEST_FILES: ${{ matrix.TEST_FILES }} | |
REQUIRES_ASTROPY : ${{ matrix.REQUIRES_ASTROPY }} | |
run: | | |
pip install pytest-cov | |
# Turn astropy deprecation warnings into errors as well if astropy | |
if $REQUIRES_ASTROPY; then export PYTEST_ADDOPTS="-W error::astropy.utils.exceptions.AstropyDeprecationWarning"; else export PYTEST_ADDOPTS=""; fi | |
export XDRLIB_DEPRECATION="-W ignore:\"'xdrlib' is deprecated and slated for removal in Python 3.13\":DeprecationWarning" | |
# eval necessary for -k 'not ...' in TEST_FILES | |
eval "pytest -W error::DeprecationWarning -W error::FutureWarning $PYTEST_ADDOPTS $XDRLIB_DEPRECATION -v $TEST_FILES --cov galpy --cov-config .coveragerc --disable-pytest-warnings --durations=0" |