Skip to content

Commit e4e39c7

Browse files
Bump version for release (#683)
* Remove git install from testing env and deps * Fix statespace fixture scope * Python 3.12 linting * Add arviz dependency * Bump preliz pin * move pymc out of pip * Bump action versions * Remove scikit-learn dependency * Remove pytensor pin * use windows-2022 instance for test job * pin micromamba version
1 parent 86fac3c commit e4e39c7

9 files changed

Lines changed: 49 additions & 38 deletions

File tree

.github/workflows/pypi.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
name: build source distribution
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1616
with:
1717
fetch-depth: 0
18-
- uses: actions/setup-python@v5
18+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
1919
with:
2020
python-version: "3.12"
2121
- name: Build the sdist and the wheel
@@ -41,7 +41,7 @@ jobs:
4141
echo "Checking import and version number (on release)"
4242
venv-bdist/bin/python -c "import pymc_extras as pmx; assert pmx.__version__ == '${{ github.ref_name }}'[1:] if '${{ github.ref_type }}' == 'tag' else pmx.__version__; print(pmx.__version__)"
4343
cd ..
44-
- uses: actions/upload-artifact@v4
44+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
4545
with:
4646
name: artifact
4747
path: dist/*
@@ -58,8 +58,8 @@ jobs:
5858
# write id-token is necessary for trusted publishing (OIDC)
5959
id-token: write
6060
steps:
61-
- uses: actions/download-artifact@v4
61+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
6262
with:
6363
name: artifact
6464
path: dist
65-
- uses: pypa/gh-action-pypi-publish@release/v1
65+
- uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0

.github/workflows/test.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ jobs:
4343
run:
4444
shell: bash -leo pipefail {0}
4545
steps:
46-
- uses: actions/checkout@v4
47-
- uses: mamba-org/setup-micromamba@v2
46+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
47+
- uses: mamba-org/setup-micromamba@d7c9bd84e824b79d2af72a2d4196c7f4300d3476 # v3.0.0
4848
with:
4949
environment-file: conda-envs/environment-test.yml
5050
create-args: >-
@@ -62,7 +62,7 @@ jobs:
6262
run: |
6363
python -m pytest --color=yes -vv --cov=pymc_extras --cov-append --cov-report=xml --cov-report term --durations=50 $TEST_SUBSET
6464
- name: Upload coverage to Codecov
65-
uses: codecov/codecov-action@v2
65+
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
6666
with:
6767
env_vars: TEST_SUBSET
6868
name: ${{ matrix.os }}
@@ -89,11 +89,13 @@ jobs:
8989
run:
9090
shell: cmd /C call {0}
9191
steps:
92-
- uses: actions/checkout@v4
93-
- uses: mamba-org/setup-micromamba@v2
92+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
93+
- uses: mamba-org/setup-micromamba@d7c9bd84e824b79d2af72a2d4196c7f4300d3476 # v3.0.0
9494
with:
9595
environment-file: conda-envs/environment-test.yml
96-
micromamba-version: "latest"
96+
# Pinned: micromamba 2.6.1-0 ships a Windows binary with a missing DLL
97+
# dependency that breaks GitHub-hosted runners (STATUS_DLL_NOT_FOUND).
98+
micromamba-version: "2.6.0-0"
9799
create-args: >-
98100
python=${{matrix.python-version}}
99101
environment-name: pymc-extras-test
@@ -110,7 +112,7 @@ jobs:
110112
run: >-
111113
python -m pytest --color=yes -vv --cov=pymc_extras --cov-append --cov-report=xml --cov-report term --durations=50 %TEST_SUBSET%
112114
- name: Upload coverage to Codecov
113-
uses: codecov/codecov-action@v2
115+
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
114116
with:
115117
env_vars: TEST_SUBSET
116118
name: ${{ matrix.os }}

conda-envs/environment-test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ channels:
44
- nodefaults
55
dependencies:
66
- scikit-learn
7-
- better-optimize>=0.3.2
7+
- better-optimize>=0.4.1
88
- dask<2025.1.1
99
- xhistogram
1010
- statsmodels
@@ -13,9 +13,9 @@ dependencies:
1313
- pytest-cov
1414
- pydantic>=2.0.0
1515
- h5netcdf
16+
- pymc>=6.0,<7.0
1617
- pip
1718
- pip:
1819
- jax
1920
- blackjax
20-
- pymc @ git+https://github.com/pymc-devs/pymc.git
21-
- preliz @ git+https://github.com/arviz-devs/preliz.git
21+
- preliz>=0.25

pymc_extras/inference/pathfinder/pathfinder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from collections.abc import Callable, Iterator
2525
from dataclasses import asdict, dataclass, field, replace
2626
from enum import Enum, auto
27-
from typing import Any, Literal, Self, TypeAlias
27+
from typing import Any, Literal, Self
2828

2929
import numpy as np
3030
import pymc as pm
@@ -79,7 +79,7 @@
7979
REGULARISATION_TERM = 1e-8
8080
DEFAULT_LINKER = "cvm_nogc"
8181

82-
SinglePathfinderFn: TypeAlias = Callable[[int], "PathfinderResult"]
82+
type SinglePathfinderFn = Callable[[int], "PathfinderResult"]
8383

8484

8585
def get_jaxified_logp_of_ravel_inputs(model: Model, jacobian: bool = True) -> Callable:

pymc_extras/linearmodel.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22
import pandas as pd
33
import pymc as pm
44

5-
from sklearn.base import BaseEstimator
5+
# If scikit-learn is available, inherit from BaseEstimator for sklearn-pipeline interop
6+
# (Pipeline, TransformedTargetRegressor, get_params). Without it, fall back to a stub
7+
# so LinearModel still works as a standalone Bayesian model.
8+
try:
9+
from sklearn.base import BaseEstimator
10+
except ImportError:
11+
12+
class BaseEstimator:
13+
pass
14+
615

716
from pymc_extras.model_builder import ModelBuilder
817

pymc_extras/prior.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def custom_transform(x):
9090
from functools import partial
9191
from inspect import signature
9292
from numbers import Number
93-
from typing import TYPE_CHECKING, Any, Protocol, TypeAlias, runtime_checkable
93+
from typing import TYPE_CHECKING, Any, Protocol, runtime_checkable
9494

9595
import numpy as np
9696
import pymc as pm
@@ -111,7 +111,7 @@ def custom_transform(x):
111111
from pytensor.tensor import TensorLike
112112
from pytensor.xtensor.type import XTensorVariable
113113

114-
XTensorLike: TypeAlias = TensorLike | DataArray
114+
type XTensorLike = TensorLike | DataArray
115115

116116

117117
class UnsupportedShapeError(Exception):

pyproject.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ classifiers = [
1212
"Development Status :: 5 - Production/Stable",
1313
"Programming Language :: Python",
1414
"Programming Language :: Python :: 3",
15-
"Programming Language :: Python :: 3.11",
1615
"Programming Language :: Python :: 3.12",
1716
"Programming Language :: Python :: 3.13",
17+
"Programming Language :: Python :: 3.14",
1818
"License :: OSI Approved :: Apache Software License",
1919
"Intended Audience :: Science/Research",
2020
"Topic :: Scientific/Engineering",
@@ -34,11 +34,11 @@ keywords = [
3434
license = {file = "LICENSE"}
3535
dynamic = ["version"] # specify the version in the __init__.py file
3636
dependencies = [
37-
"pymc@git+https://github.com/pymc-devs/pymc.git",
38-
"scikit-learn",
39-
"better-optimize>=0.3.1",
37+
"pymc>=6.0,<7.0",
38+
"arviz>=1.1",
39+
"better-optimize>=0.4.1,<1.0",
4040
"pydantic>=2.0.0",
41-
"preliz>=0.20.0",
41+
"preliz>=0.25.0",
4242
]
4343

4444
[project.optional-dependencies]
@@ -131,7 +131,7 @@ exclude_lines = [
131131

132132
[tool.ruff]
133133
line-length = 100
134-
target-version = "py311"
134+
target-version = "py312"
135135

136136
[tool.ruff.format]
137137
docstring-code-format = true

tests/statespace/core/test_statespace.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
floatX = pytensor.config.floatX
3737
nile = load_nile_test_data()
3838
ALL_SAMPLE_OUTPUTS = MATRIX_NAMES + FILTER_OUTPUT_NAMES + SMOOTHER_OUTPUT_NAMES
39-
mock_pymc_sample = pytest.fixture(scope="session")(mock_sample_setup_and_teardown)
39+
mock_pymc_sample = pytest.fixture(scope="module")(mock_sample_setup_and_teardown)
4040

4141

4242
def make_statespace_mod(k_endog, k_states, k_posdef, filter_type, verbose=False, data_info=None):
@@ -393,7 +393,7 @@ def pymc_mod_time_varying(ss_mod_time_varying, rng):
393393
return m
394394

395395

396-
@pytest.fixture(scope="session")
396+
@pytest.fixture(scope="module")
397397
def idata(pymc_mod, rng, mock_pymc_sample):
398398
with pymc_mod:
399399
idata = pm.sample(draws=10, tune=0, chains=1, random_seed=rng)
@@ -403,7 +403,7 @@ def idata(pymc_mod, rng, mock_pymc_sample):
403403
return idata
404404

405405

406-
@pytest.fixture(scope="session")
406+
@pytest.fixture(scope="module")
407407
def idata_exog(exog_pymc_mod, rng, mock_pymc_sample):
408408
with exog_pymc_mod:
409409
idata = pm.sample(draws=10, tune=0, chains=1, random_seed=rng)
@@ -412,7 +412,7 @@ def idata_exog(exog_pymc_mod, rng, mock_pymc_sample):
412412
return idata
413413

414414

415-
@pytest.fixture(scope="session")
415+
@pytest.fixture(scope="module")
416416
def idata_exog_mv(exog_pymc_mod_mv, rng, mock_pymc_sample):
417417
with exog_pymc_mod_mv:
418418
idata = pm.sample(draws=10, tune=0, chains=1, random_seed=rng)
@@ -421,7 +421,7 @@ def idata_exog_mv(exog_pymc_mod_mv, rng, mock_pymc_sample):
421421
return idata
422422

423423

424-
@pytest.fixture(scope="session")
424+
@pytest.fixture(scope="module")
425425
def idata_no_exog(pymc_mod_no_exog, rng, mock_pymc_sample):
426426
with pymc_mod_no_exog:
427427
idata = pm.sample(draws=10, tune=0, chains=1, random_seed=rng)
@@ -430,7 +430,7 @@ def idata_no_exog(pymc_mod_no_exog, rng, mock_pymc_sample):
430430
return idata
431431

432432

433-
@pytest.fixture(scope="session")
433+
@pytest.fixture(scope="module")
434434
def idata_no_exog_mv(pymc_mod_no_exog_mv, rng, mock_pymc_sample):
435435
with pymc_mod_no_exog_mv:
436436
idata = pm.sample(draws=10, tune=0, chains=1, random_seed=rng)
@@ -439,7 +439,7 @@ def idata_no_exog_mv(pymc_mod_no_exog_mv, rng, mock_pymc_sample):
439439
return idata
440440

441441

442-
@pytest.fixture(scope="session")
442+
@pytest.fixture(scope="module")
443443
def idata_no_exog_mv_dt(pymc_mod_no_exog_mv_dt, rng, mock_pymc_sample):
444444
with pymc_mod_no_exog_mv_dt:
445445
idata = pm.sample(draws=10, tune=0, chains=1, random_seed=rng)
@@ -448,7 +448,7 @@ def idata_no_exog_mv_dt(pymc_mod_no_exog_mv_dt, rng, mock_pymc_sample):
448448
return idata
449449

450450

451-
@pytest.fixture(scope="session")
451+
@pytest.fixture(scope="module")
452452
def idata_no_exog_dt(pymc_mod_no_exog_dt, rng, mock_pymc_sample):
453453
with pymc_mod_no_exog_dt:
454454
idata = pm.sample(draws=10, tune=0, chains=1, random_seed=rng)
@@ -457,7 +457,7 @@ def idata_no_exog_dt(pymc_mod_no_exog_dt, rng, mock_pymc_sample):
457457
return idata
458458

459459

460-
@pytest.fixture(scope="session")
460+
@pytest.fixture(scope="module")
461461
def idata_time_varying(pymc_mod_time_varying, rng, mock_pymc_sample):
462462
"""Inference data for time-varying model."""
463463
with pymc_mod_time_varying:

tests/statespace/core/test_statespace_JAX.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
nile = load_nile_test_data()
3232
ALL_SAMPLE_OUTPUTS = MATRIX_NAMES + FILTER_OUTPUT_NAMES + SMOOTHER_OUTPUT_NAMES
3333

34-
mock_pymc_sample = pytest.fixture(scope="session")(mock_sample_setup_and_teardown)
34+
mock_pymc_sample = pytest.fixture(scope="module")(mock_sample_setup_and_teardown)
3535

3636

3737
@pytest.fixture(scope="session")
@@ -68,7 +68,7 @@ def exog_pymc_mod(exog_ss_mod, rng):
6868
return m
6969

7070

71-
@pytest.fixture(scope="session")
71+
@pytest.fixture(scope="module")
7272
def idata(pymc_mod, rng, mock_pymc_sample):
7373
with warnings.catch_warnings():
7474
warnings.simplefilter("ignore")
@@ -91,7 +91,7 @@ def idata(pymc_mod, rng, mock_pymc_sample):
9191
return idata
9292

9393

94-
@pytest.fixture(scope="session")
94+
@pytest.fixture(scope="module")
9595
def idata_exog(exog_pymc_mod, rng, mock_pymc_sample):
9696
with warnings.catch_warnings():
9797
warnings.simplefilter("ignore")

0 commit comments

Comments
 (0)