Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove C99 requirement and test re-enabling windows build #330

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
145 changes: 79 additions & 66 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,54 +23,54 @@ jobs:
python: 3.x
toxenv: codestyle

- name: Python 3.10 with minimal dependencies and coverage
os: ubuntu-latest
python: '3.10'
toxenv: py310-test-cov
# - name: Python 3.10 with minimal dependencies and coverage
# os: ubuntu-latest
# python: '3.10'
# toxenv: py310-test-cov

# - name: Python 3.9
# os: ubuntu-latest
# python: '3.9'
# toxenv: py39-test

- name: Python 3.9
os: ubuntu-latest
python: '3.9'
toxenv: py39-test
# - name: Python 3.10
# os: ubuntu-latest
# python: '3.10'
# toxenv: py310-test

# - name: Python 3.11
# os: ubuntu-latest
# python: '3.11'
# toxenv: py311-test

# # Has to happen on ubuntu because galpy is finnicky on macOS
# - name: Python 3.10 with all optional dependencies
# os: ubuntu-latest
# python: '3.10'
# toxenv: py310-test-extradeps
# toxposargs: --durations=50

# - name: Python 3.10 without GSL
# os: ubuntu-latest
# python: '3.10'
# toxenv: nogsl

# - name: Python 3.9 with oldest supported version of all dependencies
# os: ubuntu-latest
# python: 3.9
# toxenv: py39-test-oldestdeps

- name: Python 3.10
os: ubuntu-latest
python: '3.10'
toxenv: py310-test
# # Mac and Windows:
# - name: Python 3.10 standard tests (macOS)
# os: macos-latest
# python: '3.10'
# toxenv: py310-test

- name: Python 3.11
os: ubuntu-latest
- name: Python 3.11 standard tests (Windows)
os: windows-latest
python: '3.11'
toxenv: py311-test

# Has to happen on ubuntu because galpy is finnicky on macOS
- name: Python 3.10 with all optional dependencies
os: ubuntu-latest
python: '3.10'
toxenv: py310-test-extradeps
toxposargs: --durations=50

- name: Python 3.10 without GSL
os: ubuntu-latest
python: '3.10'
toxenv: nogsl

- name: Python 3.9 with oldest supported version of all dependencies
os: ubuntu-latest
python: 3.9
toxenv: py39-test-oldestdeps

# Mac and Windows:
- name: Python 3.10 standard tests (macOS)
os: macos-latest
python: '3.10'
toxenv: py310-test

# - name: Python 3.9 standard tests (Windows)
# os: windows-latest
# python: 3.9
# toxenv: py39-test

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -91,27 +91,6 @@ jobs:
with:
python-version: ${{ matrix.python }}

# Windows:
# - uses: conda-incubator/setup-miniconda@v2
# if: startsWith(matrix.os, 'windows')
# with:
# auto-update-conda: true
# python-version: ${{ matrix.python-version }}

# - name: Install Python dependencies - Windows
# if: startsWith(matrix.os, 'windows')
# shell: bash -l {0}
# run: |
# conda install -c conda-forge -q gsl python=3.9 libpython
# python -m pip install -e .[test]
# python -m pip install tox

# - name: Run tests - Windows
# if: startsWith(matrix.os, 'windows')
# shell: bash -l {0}
# run: |
# tox ${{ matrix.toxargs }} -e ${{ matrix.toxenv }} ${{ matrix.toxposargs }}

# Mac:
- name: Setup Mac - GSL
if: startsWith(matrix.os, 'mac')
Expand All @@ -126,15 +105,49 @@ jobs:
sudo apt-get install gsl-bin libgsl0-dev build-essential
sudo apt-get install libhdf5-serial-dev # TODO: remove when h5py has 3.11 wheels

# Any *nix:
- name: Install Python dependencies - nix
- name: Install CI Python dependencies (e.g., tox)
if: ${{ !startsWith(matrix.os, 'windows') }}
run: python -m pip install --upgrade tox codecov

- name: Run tests - nix
- name: Run tests - Linux and Mac
if: ${{ !startsWith(matrix.os, 'windows') }}
run: tox -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }}

# Windows:
# Install just the GSL using conda
- uses: mamba-org/setup-micromamba@v1
if: ${{ startsWith(matrix.os, 'windows') }}
with:
environment-name: gsl
create-args: >-
python=${{ matrix.python }}
gsl
condarc: |
channels:
- conda-forge
init-shell: bash powershell

- name: Setup CI environment - Windows
if: ${{ startsWith(matrix.os, 'windows') }}
shell: bash -l {0}
run: |
conda activate gsl
python -m pip install --upgrade tox codecov
micromamba info

- name: TEMP - install gala
if: ${{ startsWith(matrix.os, 'windows') }}
shell: bash -l {0}
run: |
python -m pip install . -v

- name: Run tests - Windows
if: ${{ startsWith(matrix.os, 'windows') }}
shell: bash -l {0}
run: |
micromamba info
tox -e ${{ matrix.toxenv }} -- ${{ matrix.toxposargs }}

# Coverage:
- name: Upload coverage report to codecov
uses: codecov/[email protected]
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/tutorials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ on:
- main
pull_request:
branches:
- main
# - main
- DISABLED
release:
types:
- published
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ on:
- edited
pull_request:
branches:
- main
# - main
- DISABLED

env:
CIBW_BUILD: "cp39-* cp310-* cp311-*"
Expand Down
12 changes: 7 additions & 5 deletions gala/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@

import sys

__author__ = 'adrn <[email protected]>'
__author__ = "adrn <[email protected]>"

from ._astropy_init import *

# Enforce Python version check during package import.
# This is the same check as the one at the top of setup.py
__minimum_python_version__ = "3.7"
__minimum_python_version__ = "3.9"


class UnsupportedPythonError(Exception):
pass


if sys.version_info < tuple((int(val)
for val in __minimum_python_version__.split('.'))):
if sys.version_info < tuple(
(int(val) for val in __minimum_python_version__.split("."))
):
raise UnsupportedPythonError(
f"packagename does not support Python < {__minimum_python_version__}")
f"packagename does not support Python < {__minimum_python_version__}"
)
83 changes: 39 additions & 44 deletions gala/dynamics/setup_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,57 +11,52 @@ def get_extensions():
mac_incl_path = "/usr/include/malloc"

cfg = defaultdict(list)
cfg['include_dirs'].append(np.get_include())
cfg['include_dirs'].append(mac_incl_path)
cfg['include_dirs'].append('gala/integrate/cyintegrators')
cfg['include_dirs'].append('gala/potential')
cfg['extra_compile_args'].append('--std=gnu99')
cfg['sources'].append('gala/potential/potential/src/cpotential.c')
cfg['sources'].append('gala/potential/hamiltonian/src/chamiltonian.c')
cfg['sources'].append('gala/integrate/cyintegrators/dopri/dop853.c')
cfg['sources'].append('gala/dynamics/lyapunov/dop853_lyapunov.pyx')
exts.append(Extension('gala.dynamics.lyapunov.dop853_lyapunov', **cfg))
cfg["include_dirs"].append(np.get_include())
cfg["include_dirs"].append(mac_incl_path)
cfg["include_dirs"].append("gala/integrate/cyintegrators")
cfg["include_dirs"].append("gala/potential")
cfg["sources"].append("gala/potential/potential/src/cpotential.c")
cfg["sources"].append("gala/potential/hamiltonian/src/chamiltonian.c")
cfg["sources"].append("gala/integrate/cyintegrators/dopri/dop853.c")
cfg["sources"].append("gala/dynamics/lyapunov/dop853_lyapunov.pyx")
exts.append(Extension("gala.dynamics.lyapunov.dop853_lyapunov", **cfg))

cfg = defaultdict(list)
cfg['include_dirs'].append(np.get_include())
cfg['include_dirs'].append(mac_incl_path)
cfg['include_dirs'].append('gala/potential')
cfg['sources'].append('gala/dynamics/mockstream/_coord.pyx')
cfg['extra_compile_args'].append('--std=gnu99')
exts.append(Extension('gala.dynamics.mockstream._coord', **cfg))
cfg["include_dirs"].append(np.get_include())
cfg["include_dirs"].append(mac_incl_path)
cfg["include_dirs"].append("gala/potential")
cfg["sources"].append("gala/dynamics/mockstream/_coord.pyx")
exts.append(Extension("gala.dynamics.mockstream._coord", **cfg))

cfg = defaultdict(list)
cfg['include_dirs'].append(np.get_include())
cfg['include_dirs'].append(mac_incl_path)
cfg['include_dirs'].append('gala/potential')
cfg['sources'].append('gala/dynamics/mockstream/df.pyx')
cfg['sources'].append('gala/potential/potential/src/cpotential.c')
cfg['extra_compile_args'].append('--std=gnu99')
exts.append(Extension('gala.dynamics.mockstream.df', **cfg))
cfg["include_dirs"].append(np.get_include())
cfg["include_dirs"].append(mac_incl_path)
cfg["include_dirs"].append("gala/potential")
cfg["sources"].append("gala/dynamics/mockstream/df.pyx")
cfg["sources"].append("gala/potential/potential/src/cpotential.c")
exts.append(Extension("gala.dynamics.mockstream.df", **cfg))

cfg = defaultdict(list)
cfg['include_dirs'].append(np.get_include())
cfg['include_dirs'].append('gala/integrate/cyintegrators')
cfg['include_dirs'].append(mac_incl_path)
cfg['include_dirs'].append('gala/potential')
cfg['include_dirs'].append('gala/dynamics/nbody')
cfg['sources'].append('gala/potential/potential/src/cpotential.c')
cfg['sources'].append('gala/potential/hamiltonian/src/chamiltonian.c')
cfg['sources'].append('gala/dynamics/mockstream/mockstream.pyx')
cfg['sources'].append('gala/integrate/cyintegrators/dopri/dop853.c')
cfg['extra_compile_args'].append('--std=gnu99')
exts.append(Extension('gala.dynamics.mockstream._mockstream', **cfg))
cfg["include_dirs"].append(np.get_include())
cfg["include_dirs"].append("gala/integrate/cyintegrators")
cfg["include_dirs"].append(mac_incl_path)
cfg["include_dirs"].append("gala/potential")
cfg["include_dirs"].append("gala/dynamics/nbody")
cfg["sources"].append("gala/potential/potential/src/cpotential.c")
cfg["sources"].append("gala/potential/hamiltonian/src/chamiltonian.c")
cfg["sources"].append("gala/dynamics/mockstream/mockstream.pyx")
cfg["sources"].append("gala/integrate/cyintegrators/dopri/dop853.c")
exts.append(Extension("gala.dynamics.mockstream._mockstream", **cfg))

cfg = defaultdict(list)
cfg['include_dirs'].append(np.get_include())
cfg['include_dirs'].append('gala/integrate/cyintegrators')
cfg['include_dirs'].append(mac_incl_path)
cfg['include_dirs'].append('gala/potential')
cfg['sources'].append('gala/potential/potential/src/cpotential.c')
cfg['sources'].append('gala/potential/hamiltonian/src/chamiltonian.c')
cfg['sources'].append('gala/integrate/cyintegrators/dopri/dop853.c')
cfg['sources'].append('gala/dynamics/nbody/nbody.pyx')
cfg['extra_compile_args'].append('--std=gnu99')
exts.append(Extension('gala.dynamics.nbody.nbody', **cfg))
cfg["include_dirs"].append(np.get_include())
cfg["include_dirs"].append("gala/integrate/cyintegrators")
cfg["include_dirs"].append(mac_incl_path)
cfg["include_dirs"].append("gala/potential")
cfg["sources"].append("gala/potential/potential/src/cpotential.c")
cfg["sources"].append("gala/potential/hamiltonian/src/chamiltonian.c")
cfg["sources"].append("gala/integrate/cyintegrators/dopri/dop853.c")
cfg["sources"].append("gala/dynamics/nbody/nbody.pyx")
exts.append(Extension("gala.dynamics.nbody.nbody", **cfg))

return exts
3 changes: 0 additions & 3 deletions gala/integrate/setup_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def get_extensions():
cfg["include_dirs"].append(mac_incl_path)
cfg["include_dirs"].append("gala/potential")
cfg["include_dirs"].append("gala/dynamics/nbody")
cfg["extra_compile_args"].append("--std=gnu99")
cfg["sources"].append("gala/integrate/cyintegrators/leapfrog.pyx")
cfg["sources"].append("gala/potential/potential/src/cpotential.c")
exts.append(Extension("gala.integrate.cyintegrators.leapfrog", **cfg))
Expand All @@ -24,7 +23,6 @@ def get_extensions():
cfg["include_dirs"].append(np.get_include())
cfg["include_dirs"].append(mac_incl_path)
cfg["include_dirs"].append("gala/potential")
cfg["extra_compile_args"].append("--std=gnu99")
cfg["sources"].append("gala/potential/hamiltonian/src/chamiltonian.c")
cfg["sources"].append("gala/potential/potential/src/cpotential.c")
cfg["sources"].append("gala/integrate/cyintegrators/dop853.pyx")
Expand All @@ -36,7 +34,6 @@ def get_extensions():
cfg["include_dirs"].append(mac_incl_path)
cfg["include_dirs"].append("gala/potential")
cfg["include_dirs"].append("gala/dynamics/nbody")
cfg["extra_compile_args"].append("--std=gnu99")
cfg["sources"].append("gala/integrate/cyintegrators/ruth4.pyx")
cfg["sources"].append("gala/potential/potential/src/cpotential.c")
exts.append(Extension("gala.integrate.cyintegrators.ruth4", **cfg))
Expand Down
Loading
Loading