Skip to content

Commit

Permalink
Add python 3.10+ compatibility (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
tttc3 committed Feb 1, 2024
1 parent 366d5d8 commit 830574d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
run-tests:
strategy:
matrix:
python-version: [ 3.12 ]
python-version: [ "3.10", "3.12" ]
os: [ ubuntu-latest, windows-latest ]
fail-fast: false
runs-on: ${{ matrix.os }}
Expand All @@ -26,7 +26,7 @@ jobs:
python -m pip install -r ./tests/requirements-test.txt
- name: Checks with pre-commit
uses: pre-commit/action@v3
uses: pre-commit/action@v3.0.0

- name: Test with pytest
run: |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ To install the base pacakge:
```bash
pip install mccube
```
Requires Python 3.12+, Diffrax 0.5.0+, and Equinox 0.11.3+.
Requires Python 3.9+, Diffrax 0.5.0+, and Equinox 0.11.3+.

By default, a CPU only version of JAX will be installed. To make use of other JAX/XLA
compatible accelerators (GPUs/TPUs) please follow [these installation instructions](https://github.com/google/jax#pip-installation-gpu-cuda-installed-via-pip-easier).
Expand Down
20 changes: 11 additions & 9 deletions mccube/_formulae.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import itertools
from collections.abc import Callable, Collection
from functools import cached_property
from typing import Literal
from typing import Generic, Literal, TypeVar

import equinox as eqx
import jax
Expand All @@ -27,8 +27,10 @@
from ._regions import AbstractRegion, GaussianRegion
from ._utils import all_subclasses

_Region = TypeVar("_Region", bound=AbstractRegion)

class AbstractCubature[_Region: AbstractRegion](eqx.Module):

class AbstractCubature(eqx.Module, Generic[_Region]):
r"""Abstract base class for cubature formulae.
A concrete implementation of this class allows one to construct the [`points`][mccube.AbstractCubature.points]
Expand Down Expand Up @@ -174,13 +176,13 @@ class AbstractGaussianCubature(AbstractCubature[GaussianRegion]):
```bibtex
@book{stroud1971,
title = {Approximate Calculation of Multiple Integrals},
author = {Stroud, A. H.},
year = {1971},
publisher = {Prentice-Hall},
pages = {431},
isbn = {9780130438935},
url = {https://archive.org/details/approximatecalcu0000stro_b8j7}
title = {Approximate Calculation of Multiple Integrals},
author = {Stroud, A. H.},
year = {1971},
publisher = {Prentice-Hall},
pages = {431},
isbn = {9780130438935},
url = {https://archive.org/details/approximatecalcu0000stro_b8j7}
}
```
"""
Expand Down
4 changes: 2 additions & 2 deletions mccube/_kernels/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import abc
import operator
from typing import override
from typing_extensions import override

import equinox as eqx
import jax.tree_util as jtu
Expand All @@ -9,8 +9,8 @@
from .._custom_types import (
Args,
Particles,
RealScalarLike,
PartitionedParticles,
RealScalarLike,
RecombinedParticles,
)

Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ classifiers = [
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Mathematics",
]
requires-python = ">=3.12"
requires-python = ">=3.9"
dependencies = [
"diffrax>=0.5.0",
"equinox>=0.11.2",
"jax>=0.4.23",
"jaxtyping>=0.2.25",
"scikit-learn>=1.3.2"
"scikit-learn>=1.3.2",
"typing_extensions>=4.9.0"
]

[project.urls]
Expand Down Expand Up @@ -70,6 +71,7 @@ ignore = ["F722"]

[tool.ruff.isort]
combine-as-imports = true
extra-standard-library = ["typing_extensions"]
order-by-type = false

[tool.pyright]
Expand Down

0 comments on commit 830574d

Please sign in to comment.