Skip to content

Commit

Permalink
add python 3.12 in supported and tested versions
Browse files Browse the repository at this point in the history
- add python 3.12 in supported versions
- remove python 3.7 #106
- reorganize requirements as optional dependencies blocs in pyproject.toml as described in [PEP631](https://peps.python.org/pep-0631/#optional-dependencies)
  • Loading branch information
ManonMarchand authored Nov 8, 2023
2 parents 1ed605a + 936b7cd commit ec6ee53
Show file tree
Hide file tree
Showing 15 changed files with 106 additions and 165 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/cov-and-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: "Checkout branch ${{ github.head_ref }}"
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: "Set up Python on Ubuntu"
uses: actions/setup-python@v4
with:
python-version: 3.11
python-version: 3.12
# Test Rust code
- name: "Test with coverage, build and test doc"
run: |
Expand All @@ -37,12 +37,12 @@ jobs:
# Build and install mocpy
maturin develop --release
# Install pytest-cov, needed to test with coverage
pip install -r requirements/tests.txt
pip install .[dev]
pip install pytest-cov
# Run test with coverage and doctests
python -m pytest -v -s --doctest-modules python/mocpy --cov-report=term --cov=python/mocpy
# Install dependencies needed to build the docs
pip install -r requirements/docs.txt
pip install .[docs]
sudo apt-get install pandoc
# Compile the docs and run the test examples
cd ./docs
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: "Checkout branch ${{ github.head_ref }}"
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: "Set up Python on Ubuntu"
uses: actions/setup-python@v4
with:
python-version: 3.11
python-version: 3.12
- name: "Build doc"
run: |
# Build the doc
Expand All @@ -31,7 +31,7 @@ jobs:
# - Build and install mocpy
maturin develop --release
# - Install dependencies needed to build the docs
pip install -r requirements/docs.txt
pip install .[docs]
sudo apt-get install pandoc
# - Build the doc: once done, it is in docs/_build/html/
cd ./docs
Expand All @@ -40,8 +40,8 @@ jobs:
# Switch off the virtualenv
deactivate
- name: "Publish doc on github pages (commit on branch gh-pages)"
uses: JamesIves/github-pages-deploy-action@4.4.3
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: docs/_build/html/

22 changes: 11 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: |
source $HOME/.cargo/env
rustup target add wasm32-unknown-emscripten
for PYBIN in /opt/python/cp3[78910]*/bin; do
for PYBIN in /opt/python/cp3{8,9,10,11,12}-*/bin; do
"${PYBIN}/pip" install --upgrade pip
"${PYBIN}/pip" install maturin
"${PYBIN}/maturin" publish -i "${PYBIN}/python" --skip-existing --compatibility manylinux2014 --username "$MATURIN_USERNAME"
Expand All @@ -47,10 +47,10 @@ jobs:
img: quay.io/pypa/manylinux2014_i686
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: "Set up QEMU"
id: qemu
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
- name: Install dependencies
run: |
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \
Expand All @@ -59,7 +59,7 @@ jobs:
${{ env.img }} \
bash -exc 'curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
source $HOME/.cargo/env && \
for PYBIN in /opt/python/cp3[8910]*/bin; do
for PYBIN in /opt/python/cp3{8,9,10,11,12}-*/bin; do
echo "Loop on PYBIN: $PYBIN"
"${PYBIN}/pip" install --upgrade pip
"${PYBIN}/pip" install maturin
Expand All @@ -76,10 +76,10 @@ jobs:
img: quay.io/pypa/manylinux2014_aarch64
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: "Set up QEMU"
id: qemu
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
- name: Install dependencies
run: |
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \
Expand All @@ -88,7 +88,7 @@ jobs:
${{ env.img }} \
bash -exc 'curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-host aarch64-unknown-linux-gnu -y && \
source $HOME/.cargo/env && \
for PYBIN in /opt/python/cp3[78910]*/bin; do
for PYBIN in /opt/python/cp3{8,9,10,11,12}-*/bin; do
echo "Loop on PYBIN: $PYBIN"
"${PYBIN}/pip" install maturin
"${PYBIN}/maturin" -V
Expand All @@ -104,10 +104,10 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11','3.12']
steps:
# Checkout the project
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# Set up python, see https://docs.github.com/en/actions/guides/building-and-testing-python
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: actions/setup-python@v4
Expand Down Expand Up @@ -139,10 +139,10 @@ jobs:
fail-fast: false
matrix:
os: [macOS-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
# Checkout the project
- uses: actions/checkout@v3
- uses: actions/checkout@v4
# Set up python, see https://docs.github.com/en/actions/guides/building-and-testing-python
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: actions/setup-python@v4
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/notebooks.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
name: notebooks-mocpy
on: workflow_dispatch
jobs:
jobs:
# Run the notebooks. This add more examples to test the code with.
# This workflow should not block the deployment pipeline.
# This workflow should not block the deployment pipeline.
run-notebooks:
runs-on: ubuntu-latest
steps:
- name: "Checkout branch ${{ github.head_ref }}"
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: "Set up Python 3.8 on Ubuntu"
- name: "Set up Python 3.12 on Ubuntu"
uses: actions/setup-python@v4
with:
python-version: 3.8
# Test Rust code
python-version: 3.12
- name: "Run notebooks"
run: |
# Install virtualenv
# Install virtualenv
pip install virtualenv
# Create and activate a new virtualenv
virtualenv mocpy-env
Expand All @@ -29,7 +28,7 @@ jobs:
# Build and install mocpy
maturin develop --release
# Install pytest-cov, needed to test with coverage
pip install -r requirements/notebooks.txt
pip install .[notebooks]
# Add the mocpy-env environnement as a jupyter kernel
python -m ipykernel install --user --name mocpy-env
# Run the notebooks under that kernel
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: "Build and test wheels"
run: |
source $HOME/.cargo/env
for PYBIN in /opt/python/cp{37,38,39,310,311}-*/bin; do
for PYBIN in /opt/python/cp3{8,9,10,11,12}-*/bin; do
echo "Loop on PYBIN: $PYBIN"
# With maturin develop, we have to use virtualenv
"${PYBIN}/pip" install virtualenv
Expand All @@ -39,7 +39,7 @@ jobs:
pip install maturin
maturin build --release --compatibility manylinux2014
maturin develop --release
pip install -r requirements/tests.txt
pip install .[dev]
python -m pytest -v -s python/mocpy
pip freeze > requirements-uninstall.txt
pip uninstall -r requirements-uninstall.txt -y
Expand All @@ -51,11 +51,11 @@ jobs:
runs-on: macOS-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
# Checkout the project
- name: "Checkout branch ${{ github.head_ref }}"
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
# Set up python, see https://docs.github.com/en/actions/guides/building-and-testing-python
Expand All @@ -77,7 +77,7 @@ jobs:
maturin build --release --target universal2-apple-darwin
maturin develop --release
# Install dependencies
pip install -r requirements/tests.txt
pip install .[dev]
# Run tests
python -m pytest -v -s python/mocpy
# Clean
Expand All @@ -90,11 +90,11 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
# Checkout the project
- name: "Checkout branch ${{ github.head_ref }}"
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
# Set up python, see https://docs.github.com/en/actions/guides/building-and-testing-python
Expand All @@ -114,7 +114,7 @@ jobs:
pip install maturin
maturin develop --release
# Install dependencies
pip install -r requirements\tests.txt
pip install .[dev]
# Run tests
python -m pytest -v -s python\mocpy
deactivate
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

### Changed

* currently supported versions of python now range from 3.8 to 3.12. There is a catch for python 3.8: the corresponding astropy version is pinned to astropy<5.3

### Fixed

* all methods of `MOC` with signatures like `function(self, lon, lat, **kwargs)` now accept both lists of coordinates and single coordinates
Expand Down
19 changes: 14 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,26 @@ Latest stable version
- from conda ``conda install -c conda-forge mocpy``
- from this repository

Developpement version
*********************
Unreleased latest version
*************************
.. code::
git clone https://github.com/cds-astro/mocpy.git
cd mocpy
pip install .
Note that the point is important.


To run the notebooks
********************

The example notebooks require additional dependencies. They can be installed with

.. code::
pip install mocpy[notebooks]
For use in pyodide
******************

Wheels that run in pyodide can be downloaded from `this repository assets <https://github.com/cds-astro/mocpy/releases/download/v0.12.3/mocpy-0.12.3-cp310-cp310-emscripten_3_1_27_wasm32.whl>`__. This is not fully tested.
Wheels that run in pyodide can be downloaded from `this repository assets <https://github.com/cds-astro/mocpy/releases/download/v0.12.3/mocpy-0.12.3-cp310-cp310-emscripten_3_1_27_wasm32.whl>`__. This is not fully tested.
42 changes: 21 additions & 21 deletions docs/contribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ interpreter and package manager.
Setting up the environment
--------------------------

There is two ways to set up an environment.
Here we highlight two ways to set up an environment.
Using conda (installed from miniconda or anaconda) or
using the pip package called
using the pip package
`virtualenv <https://python-guide-pt-br.readthedocs.io/fr/latest/dev/virtualenvs.html>`__ .
Choose the one you prefer.
Choose the one you prefer, or your own one.

Using conda
~~~~~~~~~~~

- Set up the conda environment and activate it::

conda env create -q python=3.8 -f <path_to_mocpy>/requirements/environment.yml -n mocpy-env
source activate mocpy-env
conda create -n mocpy-dev python==3.12.*
source activate mocpy-dev

- Once you are done with your developments you can
deactivate your conda environment::

source deactivate
conda deactivate

Using virtualenv
~~~~~~~~~~~~~~~~
Expand All @@ -53,9 +53,9 @@ along with a new empty pip package manager.
opens a session with the ``mocpy-env`` interpreter.

- You can now install all the necessary pip packages
for developping and testing MOCpy::
for developing and testing MOCpy::

pip install -r <path_to_mocpy_repo>/requirements/contributing.txt
pip install .[dev]

- Once you are done with your developments you can deactivate the virtual env::

Expand All @@ -68,7 +68,7 @@ Pre-commits setup

pre-commit install

It will run linting and formating tests at each of your commits.
It will run linting and formatting tests at each of your commits.

Now build package
-----------------
Expand All @@ -83,7 +83,8 @@ Now build package

This step will inform you of any issue in the rust part.

- After a new version of mocpy goes out, if a ``maturin develop --release`` does not actualise your ``Cargo.toml`` file, you might need to before executing the ``maturin`` command again::
- After a new version of mocpy goes out, if a ``maturin develop --release`` does not actualize your
``Cargo.toml`` file, you might need to before executing the ``maturin`` command again::

rm Cargo.lock && cargo clean

Expand All @@ -102,29 +103,28 @@ Once your environment is set up and activated you can run the tests

- When contributing to the notebooks::

python -m pip install -r requirements/notebooks.txt
python -m pip install .[notebooks]
python -m pytest --nbmake -n=auto "./notebooks"

You also can have a html output of the coverage. For that set ``--cov-report=html``,
this will generate an ``htmlcov`` folder where all the static html files can be found.
You also can have a html output of the coverage with the flag ``--cov-report=html``.
This will generate an ``htmlcov`` folder where all the static html files can be found.


Building the documentation
--------------------------

To see the documentation locally, you'll need to install the python packages in
:file:`requirements/docs.txt` and the pandoc software.
To see the documentation locally, you'll need to install the additional python dependencies with

- To build the docs from the repo directory::
pip install .[docs]

cd docs
make html
cd ..
and the pandoc software (``sudo apt-get install pandoc`` on ubuntu,
``choco install pandoc`` on windows, ``brew install pandoc`` on mac,
``pacman -S haskell-pandoc`` on arch).

- Other API examples found in the documentation can be run with::
- To build the docs from the repo directory::

cd docs
make doctest
make html
cd ..

You will find the html index file in the :file:`docs/_build/html` folder.
Loading

0 comments on commit ec6ee53

Please sign in to comment.