Skip to content

Commit

Permalink
Python 3.12 support (#1238)
Browse files Browse the repository at this point in the history
* add Python 3.12 to all Github work flows
* update max supported py version in setup.cfg
* remove use of pandas in example script
* Update manylinux_2_28 tag for wheel builds
* don't install setuptools/wheel for macOS CI
  • Loading branch information
molpopgen authored Dec 1, 2023
1 parent 29562bd commit 9a11cf5
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
compiler: [gcc]
python-version: ["3.10"]
python-version: ["3.12"]
rust: [1.62.1]
defaults:
run:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/macos_x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python: [ 3.8, 3.9, "3.10", "3.11" ]
python: [ 3.8, 3.9, "3.10", "3.11", "3.12" ]
os: [ macos-latest ]
rust: [1.62.1]
defaults:
Expand Down Expand Up @@ -46,7 +46,7 @@ jobs:
python -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
python -m pip install setuptools wheel build
python -m pip install wheel
python -m pip install -r requirements/development.txt
- name: Build extension module
run: |
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python: [ 3.8, 3.9, "3.10", "3.11" ]
python: [ 3.8, 3.9, "3.10", "3.11", "3.12" ]
os: [ ubuntu-22.04 ]
compiler: [gcc, clang14]
rust: [1.62.1]
Expand Down Expand Up @@ -154,7 +154,9 @@ jobs:
python -m venv venv
source venv/bin/activate
which python
python -m pip install --no-cache-dir ./fwdpy11*-linux*.whl
# The CPPFLAGS contain stuff for C++ that makes no sense for C.
# The flags are also too strict for tskit to build under Py 3.12
CPPFLAGS= python -m pip install --no-cache-dir ./fwdpy11*-linux*.whl
python -m fwdpy11 --includes
python -c "import fwdpy11;print(fwdpy11.__version__)"
python -c "import fwdpy11;print(fwdpy11.__file__)"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
python: [3.8, 3.9, "3.10", "3.11"]
python: [3.8, 3.9, "3.10", "3.11", "3.12"]
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["python3.8", "python3.9", "python3.10", "python3.11"]
python: ["python3.8", "python3.9", "python3.10", "python3.11", "python3.12"]
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
needs: ['build_sdist']
strategy:
matrix:
python: [3.8, 3.9, "3.10", "3.11"]
python: [3.8, 3.9, "3.10", "3.11", "3.12"]
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
Expand Down Expand Up @@ -182,7 +182,7 @@ jobs:
runs-on: macos-latest
strategy:
matrix:
python: [3.8, 3.9, "3.10", "3.11"]
python: [3.8, 3.9, "3.10", "3.11", "3.12"]
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion deployment/linux_wheels/run_wheel_workflow.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
PYTHON=$1

docker run --rm -v `pwd`:/project -w /project quay.io/pypa/manylinux_2_28_x86_64:2022-10-02-69a0972 /bin/sh ./deployment/linux_wheels/wheel_workflow.sh $PYTHON
docker run --rm -v `pwd`:/project -w /project quay.io/pypa/manylinux_2_28_x86_64:2023-11-29-1ba608e /bin/sh ./deployment/linux_wheels/wheel_workflow.sh $PYTHON
4 changes: 4 additions & 0 deletions doc/misc/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Major changes are listed below. Each release likely contains fiddling with back-end code,
updates to latest `fwdpp` version, etc.

## 0.21.5

Add support for Python 3.12

## 0.21.4

Behavior changes:
Expand Down
9 changes: 5 additions & 4 deletions examples/gss_divergent_optima/gss_divergent_optima.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import sys

import numpy as np
import pandas as pd

import fwdpy11

Expand Down Expand Up @@ -82,6 +81,8 @@
fwdpy11.evolvets(rng, pop, params, 100)
assert pop.generation == 10 * N + 200
md = np.array(pop.diploid_metadata, copy=False)
df = pd.DataFrame.from_records(md[["deme", "g", "w"]])
g = df.groupby(["deme"])
print(g.mean())

for deme in np.unique(md["deme"]):
mean_genetic_value = md["g"][np.where(md["deme"] == deme)].mean()
mean_fitness = md["w"][np.where(md["deme"] == deme)].mean()
print(f"{deme} {mean_genetic_value} {mean_fitness}")
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ classifiers =
[options]
zip_safe = False # https://mypy.readthedocs.io/en/latest/installed_packages.html
include_package_data = True
python_requires = >=3.8, <3.12
python_requires = >=3.8, <3.13
# NOTE: any pinning should also be coordinated
# with requirements.in and doc/requirements.in
# and may require regenerating the .txt files.
Expand Down

0 comments on commit 9a11cf5

Please sign in to comment.