Skip to content

Commit c53277b

Browse files
authored
Run pre-commit and mypy on oldest supported Python version (#6969)
* Run pre-commit and mypy on oldest supported Python version * Fix type hints invalid with Python 3.9
1 parent 6b486b9 commit c53277b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

.github/workflows/pre-commit.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
1515
- uses: actions/setup-python@v4
16+
with:
17+
python-version: "3.9" # Run pre-commit on oldest supported Python version
1618
- uses: pre-commit/[email protected]
1719
mypy:
1820
runs-on: ubuntu-latest
@@ -50,7 +52,7 @@ jobs:
5052
activate-environment: pymc-test
5153
channel-priority: strict
5254
environment-file: conda-envs/environment-test.yml
53-
python-version: 3.9
55+
python-version: "3.9" # Run pre-commit on oldest supported Python version
5456
use-mamba: true
5557
use-only-tar-bz2: false # IMPORTANT: This may break caching of conda packages! See https://github.com/conda-incubator/setup-miniconda/issues/267
5658
- name: Install-pymc and mypy dependencies

pymc/sampling/jax.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def _device_put(input, device: str):
184184
def _postprocess_samples(
185185
jax_fn: Callable,
186186
raw_mcmc_samples: List[TensorVariable],
187-
postprocessing_backend: Literal["cpu", "gpu"] | None = None,
187+
postprocessing_backend: Optional[Literal["cpu", "gpu"]] = None,
188188
postprocessing_vectorize: Literal["vmap", "scan"] = "scan",
189189
) -> List[TensorVariable]:
190190
if postprocessing_vectorize == "scan":
@@ -239,7 +239,7 @@ def _blackjax_stats_to_dict(sample_stats, potential_energy) -> Dict:
239239
def _get_log_likelihood(
240240
model: Model,
241241
samples,
242-
backend: Literal["cpu", "gpu"] | None = None,
242+
backend: Optional[Literal["cpu", "gpu"]] = None,
243243
postprocessing_vectorize: Literal["vmap", "scan"] = "scan",
244244
) -> Dict:
245245
"""Compute log-likelihood for all observations"""

0 commit comments

Comments
 (0)