diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 285ada069b..3319aee965 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -54,7 +54,7 @@ jobs: if: ${{ needs.changes.outputs.changes == 'true' }} strategy: matrix: - python-version: ["3.11", "3.13"] + python-version: ["3.11", "3.14"] steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: @@ -75,7 +75,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest"] - python-version: ["3.11", "3.13"] + python-version: ["3.11", "3.14"] fast-compile: [0, 1] float32: [0, 1] install-numba: [0] @@ -117,13 +117,13 @@ jobs: part: "tests/link/numba --ignore=tests/link/numba/test_slinalg.py" - install-numba: 1 os: "ubuntu-latest" - python-version: "3.13" + python-version: "3.14" fast-compile: 0 float32: 0 part: "tests/link/numba --ignore=tests/link/numba/test_slinalg.py" - install-numba: 1 os: "ubuntu-latest" - python-version: "3.13" + python-version: "3.14" fast-compile: 0 float32: 0 part: "tests/link/numba/test_slinalg.py" @@ -135,7 +135,7 @@ jobs: part: "tests/link/jax" - install-jax: 1 os: "ubuntu-latest" - python-version: "3.13" + python-version: "3.14" fast-compile: 0 float32: 0 part: "tests/link/jax" @@ -147,7 +147,7 @@ jobs: part: "tests/link/pytorch" - install-xarray: 1 os: "ubuntu-latest" - python-version: "3.13" + python-version: "3.14" fast-compile: 0 float32: 0 part: "tests/xtensor" @@ -161,7 +161,7 @@ jobs: install-torch: 0 part: "tests/link/mlx" - os: "macos-15" - python-version: "3.13" + python-version: "3.14" fast-compile: 0 float32: 0 install-numba: 0 @@ -202,7 +202,7 @@ jobs: else micromamba install --yes -q "python~=${PYTHON_VERSION}" mkl "numpy${NUMPY_VERSION}" scipy pip mkl-service graphviz cython pytest coverage pytest-cov pytest-benchmark pytest-mock pytest-sphinx; fi - if [[ $INSTALL_NUMBA == "1" ]]; then micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}" "numba>=0.57"; fi + if [[ $INSTALL_NUMBA == "1" ]]; then pip install "numba==0.63.0b1"; fi if [[ $INSTALL_JAX == "1" ]]; then micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}" jax jaxlib numpyro equinox && pip install tfp-nightly; fi if [[ $INSTALL_TORCH == "1" ]]; then micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}" pytorch pytorch-cuda=12.1 "mkl<=2024.0" -c pytorch -c nvidia; fi if [[ $INSTALL_MLX == "1" ]]; then micromamba install --yes -q -c conda-forge "python~=${PYTHON_VERSION}" mlx; fi @@ -324,7 +324,7 @@ jobs: - name: Set up Python uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 with: - python-version: "3.13" + python-version: "3.14" - name: Install dependencies run: | diff --git a/pyproject.toml b/pyproject.toml index da56fdfe11..de180c5921 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ build-backend = "setuptools.build_meta" [project] name = "pytensor" dynamic = ['version'] -requires-python = ">=3.11,<3.14" +requires-python = ">=3.11,<3.15" authors = [{ name = "pymc-devs", email = "pymc.devs@gmail.com" }] description = "Optimizing compiler for evaluating mathematical expressions on CPUs and GPUs." readme = "README.rst" @@ -33,6 +33,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", ] keywords = [ @@ -79,7 +80,7 @@ tests = [ ] rtd = ["sphinx>=5.1.0,<6", "pygments", "pydot"] jax = ["jax", "jaxlib"] -numba = ["numba>=0.57", "llvmlite"] +numba = ["numba>=0.63.0b1", "llvmlite"] [tool.setuptools.packages.find] include = ["pytensor*"] diff --git a/tests/link/c/test_cmodule.py b/tests/link/c/test_cmodule.py index 212a2d8181..0cba38daf1 100644 --- a/tests/link/c/test_cmodule.py +++ b/tests/link/c/test_cmodule.py @@ -395,18 +395,18 @@ def test_linking_patch(listdir_mock, platform): ] -def test_cache_race_condition(): - with tempfile.TemporaryDirectory() as dir_name: +@config.change_flags(on_opt_error="raise", on_shape_error="raise") +def _f_build_cache_race_condition(factor): + # Some of the caching issues arise during constant folding within the + # optimization passes, so we need these config changes to prevent the + # exceptions from being caught + a = pt.vector() + f = pytensor.function([a], factor * a) + return f(np.array([1], dtype=config.floatX)) - @config.change_flags(on_opt_error="raise", on_shape_error="raise") - def f_build(factor): - # Some of the caching issues arise during constant folding within the - # optimization passes, so we need these config changes to prevent the - # exceptions from being caught - a = pt.vector() - f = pytensor.function([a], factor * a) - return f(np.array([1], dtype=config.floatX)) +def test_cache_race_condition(): + with tempfile.TemporaryDirectory() as dir_name: ctx = multiprocessing.get_context() compiledir_prop = pytensor.config._config_var_dict["compiledir"] @@ -425,7 +425,7 @@ def f_build(factor): # A random, constant input to prevent caching between runs factor = rng.random() procs = [ - ctx.Process(target=f_build, args=(factor,)) + ctx.Process(target=_f_build_cache_race_condition, args=(factor,)) for i in range(num_procs) ] for proc in procs: diff --git a/tests/test_config.py b/tests/test_config.py index ab34037c67..ea1de66561 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -247,9 +247,12 @@ def test_config_pickling(): configparser.IntParam(5, lambda i: i > 0), in_c_key=False, ) + # Python 3.14 emits a pickle.PicklingError + # previous versions used to emit an AttributeError + # the error string changed a little bit too with pytest.raises( - AttributeError, - match=r"Can't (pickle|get) local object 'test_config_pickling\.\.'", + (AttributeError, pickle.PicklingError), + match=r"Can't (pickle|get) local object .*test_config_pickling\.\.", ): pickle.dump(root, io.BytesIO())