Skip to content

Commit

Permalink
Merge pull request #4626 from neutrinoceros/test_on_cp312
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros authored Sep 28, 2023
2 parents 0f84cc2 + 0048818 commit 079ba50
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 9 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/bleeding-edge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,30 @@ jobs:
- name: Set up Python (newest testable version)
uses: actions/setup-python@v4
with:
# the '-dev' suffix allows to use alphas and betas if no final release is available yet
# this version should be upgraded as often as possible, typically once a year when numpy
# and Cython are known to be compatible
python-version: '3.11-dev'
# the '-dev' suffix allows to use pre-releases if no final release is available yet
# this version should be upgraded as often as possible, typically once a year when
# Cython, numpy and matplotlib are known to be compatible
python-version: '3.12-dev'

- name: Install dependencies
# PyYAML needs to be installed in isolation for now, because of a known
# incompatibility with Cython 3
# see https://github.com/yaml/pyyaml/issues/601
# and https://github.com/cython/cython/issues/4568
# Cython 3.0.2 has a defect on Python 3.12, so we install the -fixed- dev version
# from source for now.
# see https://github.com/cython/cython/issues/5724
# Cython can be installed from PyPI binaries again when the patch is included
# in a release (likely in version 3.0.3)
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools wheel
python -m pip install --pre --upgrade --extra-index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy matplotlib
python -m pip install --pre cython ewah-bool-utils
python -m pip install --pre --only-binary ":all:" numpy matplotlib \
--extra-index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
python -m pip install --pre ewah-bool-utils
python -m pip install git+https://github.com/yt-project/unyt.git
python -m pip install --pre pytest PyYAML
python -m pip install git+https://github.com/cython/cython.git
- name: Build
# --no-build-isolation is used to guarantee that build time dependencies
Expand Down
21 changes: 18 additions & 3 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import shutil
import sys
import tempfile
from importlib.metadata import version
from importlib.util import find_spec
Expand All @@ -22,7 +23,13 @@
MPL_VERSION = Version(version("matplotlib"))
NUMPY_VERSION = Version(version("numpy"))
PILLOW_VERSION = Version(version("pillow"))
SETUPTOOLS_VERSION = Version(version("setuptools"))

# setuptools does not ship with the standard lib starting in Python 3.12, so we need to
# be resilient if it's not available at runtime
if find_spec("setuptools") is not None:
SETUPTOOLS_VERSION = Version(version("setuptools"))
else:
SETUPTOOLS_VERSION = None


def pytest_addoption(parser):
Expand Down Expand Up @@ -105,7 +112,7 @@ def pytest_configure(config):
):
config.addinivalue_line("filterwarnings", value)

if SETUPTOOLS_VERSION >= Version("67.3.0"):
if SETUPTOOLS_VERSION is not None and SETUPTOOLS_VERSION >= Version("67.3.0"):
# may be triggered by multiple dependencies
# see https://github.com/glue-viz/glue/issues/2364
# see https://github.com/matplotlib/matplotlib/issues/25244
Expand All @@ -116,7 +123,7 @@ def pytest_configure(config):
r"is preferred to `pkg_resources\.declare_namespace`\.:DeprecationWarning",
)

if SETUPTOOLS_VERSION >= Version("67.5.0"):
if SETUPTOOLS_VERSION is not None and SETUPTOOLS_VERSION >= Version("67.5.0"):
# may be triggered by multiple dependencies
# see https://github.com/glue-viz/glue/issues/2364
# see https://github.com/matplotlib/matplotlib/issues/25244
Expand Down Expand Up @@ -162,6 +169,14 @@ def pytest_configure(config):
),
)

if sys.version_info >= (3, 12):
# already patched (but not released) upstream:
# https://github.com/dateutil/dateutil/pull/1285
config.addinivalue_line(
"filterwarnings",
r"ignore:datetime\.datetime\.utcfromtimestamp\(\) is deprecated:DeprecationWarning",
)


def pytest_collection_modifyitems(config, items):
r"""
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
requires = [
"setuptools>=61.2",

# for the upper pin in Cython
# see https://github.com/yt-project/yt/issues/4044
# TODO: bump minimal Cython version to 3.0.3 when released
# see https://github.com/yt-project/yt/issues/4675
"Cython>=3.0, <3.1",
"numpy>=1.25, <2.0",
"ewah-bool-utils>=1.0.2",
Expand Down Expand Up @@ -32,6 +35,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Astronomy",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Scientific/Engineering :: Visualization",
Expand Down

0 comments on commit 079ba50

Please sign in to comment.