Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 49 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
python-version: [ "3.9", "3.10", "3.11" ]
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
runs-on: "${{ matrix.os }}"
defaults:
run:
Expand Down Expand Up @@ -81,13 +81,58 @@ jobs:
uses: codecov/codecov-action@v4.2.0
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
test-pint-compatibility:
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
# Testing the highest and lowest supported Python versions
python-version: [ "3.10", "3.13" ]
# Test all of the supported pint versions (including the latest)
pint-version: [
# The double quotes are needed to avoid parsing issues with the >= and < characters
"'pint>=0.22,<0.23' 'numpy<2'",
"'pint>=0.23,<0.24' 'numpy<2'",
"'pint>=0.24,<0.25'",
"'pint>=0.25,<0.26'",
"'pint>=0.25'"
]
exclude:
# Known incompatibilities
# Python 3.10 with pint 0.25 and above
- python-version: "3.10"
pint-version: "'pint>=0.25,<0.26'"
- python-version: "3.10"
pint-version: "'pint>=0.25'"
# Python 3.13 with pint <0.24
# Python 3.11 is the lowest version that supports pint 0.22/0.23
- python-version: "3.13"
pint-version: "'pint>=0.23,<0.24' 'numpy<2'"
- python-version: "3.13"
pint-version: "'pint>=0.22,<0.23' 'numpy<2'"
runs-on: "${{ matrix.os }}"
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
python-version: ${{ matrix.python-version }}
pdm-dependency-install-flags: "-G dev -G tests"
- name: Run tests
run: |
# Use pip *inside* pdm to install different pint versions otherwise
# pdm's own dependency resolver will resolve a single version that works for all python versions
pdm run pip install -U ${{ matrix.pint-version }}
pdm run pip freeze
pdm run pytest -r a -v src tests --doctest-modules --cov=src --cov-report=term-missing --cov-report=xml
pdm run coverage report

imports-without-extras:
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
python-version: [ "3.9", "3.10", "3.11" ]
python-version: [ "3.10", "3.11", "3.12", "3.13" ]
runs-on: "${{ matrix.os }}"
steps:
- name: Check out repository
Expand All @@ -107,7 +152,7 @@ jobs:
- name: Setup PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: "3.9"
python-version: "3.10"
pdm-dependency-install-flags: "not-used"
run-pdm-install: false
- name: Build package
Expand All @@ -125,7 +170,7 @@ jobs:
uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
python-version: "3.9"
python-version: "3.10"
pdm-dependency-install-flags: "-G dev"
- name: Check licences of dependencies
shell: bash
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ci:
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.5.0"
rev: "v6.0.0"
hooks:
- id: check-added-large-files
- id: check-ast
Expand All @@ -33,13 +33,13 @@ repos:
language: fail
files: "\\.rej$"
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.1.8"
rev: "v0.14.9"
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]
- id: ruff-check
args: [ --fix]
- id: ruff-format
- repo: https://github.com/pdm-project/pdm
rev: 2.17.0
rev: 2.26.1
hooks:
# Check that the lock file is up to date.
# We need the pdm lock file too
Expand Down
2 changes: 2 additions & 0 deletions changelog/75.breaking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Removed support for Python 3.9 which is now marked as End of Life.
The last openscm-units release to support Python 3.9 is v0.6.3.
1 change: 1 addition & 0 deletions changelog/75.docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Documented the strategy for the supported versions Python that openscm-units will support.
1 change: 1 addition & 0 deletions changelog/76.trivial.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added testing of different versions of Pint to the CI
22 changes: 22 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ and [Semantic Versioning](https://semver.org/) to describe how the version
should change depending on the updates to the code base.

[](){releasing-reference}

## Releasing

Releasing is semi-automated via a CI job.
Expand Down Expand Up @@ -75,6 +76,27 @@ The steps required are the following:

1. Enjoy the newly available version

## Testing strategy

We support Python 3.10 and above.
We follow the [Python life-cycle schedule](https://devguide.python.org/versions/)
and will drop support for Python versions when they reach their end of life.
Given the nature of the package,
we want to ensure support for a broad range of Python versions to minimise any downstream constraints.
Libraries building on `openscm-units` are free to further restrict the Python versions
(or other dependencies) they support.

For downstream package maintainers we recommend following
the [SPEC 0000](https://scientific-python.org/specs/spec-0000/) deprecation policy.
This policy provides support for a key scientific packages for 24 months after release
and Python versions for 36 months after release.
The Python ecosystem is quicker to adopt new versions than it was previously
and these reduced support timelines reflect that.

None-the-less we also recommend that lockfiles are used for analysis projects
to capture the exact versions of dependencies used.
This will enable the project to be recreated in the future even if the Python version is no longer supported.

## Read the Docs

Our documentation is hosted by [Read the Docs (RtD)](https://www.readthedocs.org/),
Expand Down
2 changes: 1 addition & 1 deletion docs/gen_doc_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def create_sub_packages_table(sub_packages: Iterable[PackageInfo]) -> str:
sub_packages_table_l.append(line)

if i == 0:
underline = f"| {'-'*sub_package_width} | {'-'*description_width} |"
underline = f"| {'-' * sub_package_width} | {'-' * description_width} |"
sub_packages_table_l.append(underline)

sub_packages_table = "\n".join(sub_packages_table_l)
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ plugins:
handlers:
python:
paths: [src]
import:
inventories:
# Cross-ref helpers (lots included here, remove what you don't want)
- https://www.attrs.org/en/stable/objects.inv
- https://unidata.github.io/cftime/objects.inv
Expand Down
Loading
Loading