Skip to content

Commit

Permalink
MAINT: Add py312 tests and bump default test version
Browse files Browse the repository at this point in the history
  • Loading branch information
ColmTalbot committed Aug 22, 2024
1 parent 16335b3 commit 55894bb
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 24 deletions.
68 changes: 48 additions & 20 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ authors:
# Test containers scripts are up to date
containers:
stage: initial
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python310
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python311
script:
- cd containers
- python write_dockerfiles.py #HACK
# Fail if differences exist. If this fails, you may need to run
# write_dockerfiles.py and commit the changes.
- git diff --exit-code
- cp env-template.yml env.yml
- echo " - python=3.10" >> env.yml
- echo " - python=3.11" >> env.yml
- mamba env create -f env.yml -n test --dry-run

.test-python: &test-python
Expand Down Expand Up @@ -78,6 +78,10 @@ basic-3.11:
<<: *test-python
image: python:3.11

basic-3.12:
<<: *test-python
image: python:3.12

.test-samplers-import: &test-samplers-import
stage: initial
script:
Expand All @@ -93,6 +97,10 @@ import-samplers-3.11:
<<: *test-samplers-import
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python311

import-samplers-3.12:
<<: *test-samplers-import
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python312

.precommits: &precommits
stage: initial
script:
Expand All @@ -104,19 +112,19 @@ import-samplers-3.11:
# Run precommits (flake8, spellcheck, isort, no merge conflicts, etc)
- pre-commit run --all-files --verbose --show-diff-on-failure

precommits-py3.10:
precommits-py3.11:
<<: *precommits
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python310
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python311
variables:
CACHE_DIR: ".pip310"
PYVERSION: "python310"
CACHE_DIR: ".pip311"
PYVERSION: "python311"

install:
stage: initial
parallel:
matrix:
- EXTRA: [gw, mcmc, all]
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python310
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python311
script:
- pip install .[$EXTRA]

Expand All @@ -132,8 +140,13 @@ install:

python-3.10:
<<: *unit-test
needs: ["basic-3.10", "precommits-py3.10"]
needs: ["basic-3.10"]
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python310

python-3.11:
<<: *unit-test
needs: ["basic-3.11", "precommits-py3.11"]
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python311
after_script:
- coverage html
- coverage xml
Expand All @@ -147,10 +160,10 @@ python-3.10:
- htmlcov/
expire_in: 30 days

python-3.11:
python-3.12:
<<: *unit-test
needs: ["basic-3.11"]
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python311
needs: ["basic-3.12"]
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python312

.test-sampler: &test-sampler
stage: test
Expand All @@ -161,18 +174,23 @@ python-3.11:

python-3.10-samplers:
<<: *test-sampler
needs: ["basic-3.10", "precommits-py3.10"]
needs: ["basic-3.10"]
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python310

python-3.11-samplers:
<<: *test-sampler
needs: ["basic-3.11"]
needs: ["basic-3.11", "precommits-py3.11"]
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python311

integration-tests-python-3.10:
python-3.12-samplers:
<<: *test-sampler
needs: ["basic-3.12"]
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python312

integration-tests-python-3.11:
stage: test
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python310
needs: ["basic-3.10", "precommits-py3.10"]
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python311
needs: ["basic-3.11", "precommits-py3.11"]
only:
- schedules
script:
Expand All @@ -193,18 +211,23 @@ integration-tests-python-3.10:
plotting-python-3.10:
<<: *plotting
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python310
needs: ["basic-3.10", "precommits-py3.10"]
needs: ["basic-3.10"]

plotting-python-3.11:
<<: *plotting
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python311
needs: ["basic-3.11"]
needs: ["basic-3.11", "precommits-py3.11"]

plotting-python-3.12:
<<: *plotting
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python312
needs: ["basic-3.12"]

# ------------------- Docs stage -------------------------------------------

docs:
stage: docs
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python310
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python311
before_script:
- python -m ipykernel install
script:
Expand All @@ -225,7 +248,7 @@ docs:

pages:
stage: deploy
needs: ["docs", "python-3.10"]
needs: ["docs", "python-3.11"]
script:
- mkdir public/
- mv htmlcov/ public/
Expand Down Expand Up @@ -267,6 +290,11 @@ build-python311-container:
variables:
PYVERSION: "python311"

build-python312-container:
<<: *build-container
variables:
PYVERSION: "python312"

pypi-release:
stage: deploy
image: containers.ligo.org/lscsoft/bilby/v2-bilby-python310
Expand Down
27 changes: 27 additions & 0 deletions containers/v3-dockerfile-test-suite-python312
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This dockerfile is written automatically and should not be modified by hand.

FROM containers.ligo.org/docker/base:conda
LABEL name="bilby CI testing" \
maintainer="Gregory Ashton <[email protected]>, Colm Talbot <[email protected]>"

COPY env-template.yml env.yml
RUN echo " - python=3.12" >> env.yml
ENV conda_env python312

RUN mamba env create -f env.yml -n ${conda_env}
RUN echo "source activate ${conda_env}" > ~/.bashrc
ENV PATH /opt/conda/envs/${conda_env}/bin:$PATH
RUN /bin/bash -c "source activate ${conda_env}"
RUN mamba info
RUN python --version

# Add the ROQ data to the image
RUN mkdir roq_basis \
&& cd roq_basis \
&& wget https://git.ligo.org/lscsoft/ROQ_data/raw/master/IMRPhenomPv2/4s/B_linear.npy \
&& wget https://git.ligo.org/lscsoft/ROQ_data/raw/master/IMRPhenomPv2/4s/B_quadratic.npy \
&& wget https://git.ligo.org/lscsoft/ROQ_data/raw/master/IMRPhenomPv2/4s/fnodes_linear.npy \
&& wget https://git.ligo.org/lscsoft/ROQ_data/raw/master/IMRPhenomPv2/4s/fnodes_quadratic.npy \
&& wget https://git.ligo.org/lscsoft/ROQ_data/raw/master/IMRPhenomPv2/4s/params.dat \
&& wget https://git.ligo.org/soichiro.morisaki/roq_basis/raw/main/IMRPhenomD/16s_nospins/basis_addcal.hdf5 \
&& wget https://git.ligo.org/soichiro.morisaki/roq_basis/raw/main/IMRPhenomD/16s_nospins/basis_multiband_addcal.hdf5
2 changes: 1 addition & 1 deletion containers/write_dockerfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
with open("dockerfile-template", "r") as ff:
template = ff.read()

python_versions = [(3, 10), (3, 11)]
python_versions = [(3, 10), (3, 11), (3, 12)]
today = date.today().strftime("%Y%m%d")

for python_major_version, python_minor_version in python_versions:
Expand Down
6 changes: 3 additions & 3 deletions docs/installation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ Installation

$ conda install -c conda-forge bilby

Supported python versions: 3.10-3.11.
Supported python versions: 3.10-3.12.

.. tab:: Pip

.. code-block:: console

$ pip install bilby

Supported python versions: 3.10-3.11.
Supported python versions: 3.10-3.12.


This will install all requirements for running :code:`bilby` for general
Expand Down Expand Up @@ -47,7 +47,7 @@ wave inference, please additionally run the following commands.
Install bilby from source
-------------------------

:code:`bilby` is developed and tested with Python 3.10-3.11. In the
:code:`bilby` is developed and tested with Python 3.10-3.12. In the
following, we assume you have a working python installation, `python pip
<https://packaging.python.org/tutorials/installing-packages/#use-pip-for-installing)>`_,
and `git <https://git-scm.com/>`_. See :ref:`installing-python` for our
Expand Down

0 comments on commit 55894bb

Please sign in to comment.