diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a3edd7e6..2425d108 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,9 @@ jobs: install-linux: name: (Linux) Install package and run tests runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.10', '3.11', '3.12'] steps: - name: Checkout repository @@ -20,7 +23,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: ${{ matrix.python-version }} - name: Install and test run: | @@ -34,6 +37,9 @@ jobs: install-macos: name: (MacOS) Install package and run tests runs-on: macos-latest + strategy: + matrix: + python-version: ['3.10', '3.11', '3.12'] steps: - name: Checkout repository @@ -42,7 +48,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: ${{ matrix.python-version }} - name: Install and test run: | @@ -53,6 +59,9 @@ jobs: install-windows: name: (Windows) Install package and run tests runs-on: windows-latest + strategy: + matrix: + python-version: ['3.10', '3.11', '3.12'] steps: - name: Checkout repository @@ -61,7 +70,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: ${{ matrix.python-version }} - name: Install and test run: | diff --git a/pyproject.toml b/pyproject.toml index 48a0e1f8..ca738a05 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ name = "pydrex" dynamic = ["version"] # Managed by setuptools_scm. description = "Dynamic CPO calculations for olivine-enstatite polycrystal aggregates" readme = "README.md" -requires-python = ">=3.11" # We use tomllib: . +requires-python = ">=3.10" # We use tomllib on 3.11: . license = {file = "LICENSE"} authors = [ {name = "Thomas Duvernay", email = "td75013@hotmail.fr"}, @@ -33,6 +33,7 @@ classifiers = [ ] dependencies = [ + "tomli >= 1.1.0 ; python-version < '3.11'", # https://github.com/hukkin/tomli?tab=readme-ov-file#building-a-tomlitomllib-compatibility-layer "numpy >= 1.8", # "numba >= 0.57", # "scipy >= 1.2", # diff --git a/src/pydrex/io.py b/src/pydrex/io.py index e85da3a0..f07d3295 100644 --- a/src/pydrex/io.py +++ b/src/pydrex/io.py @@ -19,7 +19,13 @@ import io import os import pathlib -import tomllib +import sys + +if sys.version_info >= (3, 11): + import tomllib +else: + import tomli as tomllib + from importlib.resources import files import h5py