Skip to content

Commit

Permalink
Add support for python 3.9 and 3.12 (#50)
Browse files Browse the repository at this point in the history
* Import annotations from __future__ in modules where union type syntax is used.

* Extend supported python versions to cover >=3.9, <4.

* Update pycln version to a one that supports python 3.12.

* Add python 3.9 and 3.12 to the CI python target list.

* Fix typo in CI.yml.

---------

Co-authored-by: Caglar Kutlu <[email protected]>
  • Loading branch information
ckutlu and Caglar Kutlu authored Jul 19, 2024
1 parent 664a912 commit 6606925
Show file tree
Hide file tree
Showing 11 changed files with 165 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.10', '3.11' ]
python-version: [ '3.9', '3.10', '3.11', '3.12']

steps:
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/hadialqattan/pycln
rev: v2.1.3
rev: v2.4.0
hooks:
- id: pycln
args: [--config=pyproject.toml]
Expand Down
230 changes: 145 additions & 85 deletions poetry.lock

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ classifiers = [
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering",
]
readme = "README.md"
repository = "https://github.com/hippalectryon-0/xr-scipy"
documentation = "https://xr-scipy.readthedocs.io"

[tool.poetry.dependencies]
python = ">=3.10,<3.12"
python = ">=3.9,<4"
xarray = ">=2023"
scipy = ">=1.9"
docstring-parser = "^0.15"
Expand All @@ -31,11 +33,11 @@ sphinx-rtd-theme = "^1.3.0"
pre-commit = "^3.3.1"
isort = "5.12.0"
black = "24.3.0"
pycln = "2.1.3"
ipython = "^8.13.2"
matplotlib = "^3.7.0" # used in docs
myst-parser = "1.0.0" # used in docs
pickleshare = "^0.7.5"
pycln = "^2.4.0"

[build-system]
requires = ["poetry-core"]
Expand Down
2 changes: 2 additions & 0 deletions tests/testings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""utilities for tests"""

from __future__ import annotations

import numpy as np
import xarray as xr

Expand Down
3 changes: 3 additions & 0 deletions xrscipy/docs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
"""Tools for interacting with docstrings"""

from __future__ import annotations

from typing import Any, Callable

import docstring_parser
Expand Down
1 change: 1 addition & 0 deletions xrscipy/fft.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
@savefig fftn.png width=4in
plt.show()
"""

from typing import Callable

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions xrscipy/fftpack.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
r"""mirrors scipy.fftpack"""

from typing import Callable

from scipy import fftpack
Expand Down
1 change: 1 addition & 0 deletions xrscipy/integrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
There are slight difference from the original implementations.
Our :py:func:`~xrscipy.integrate.cumulative_trapezoid` always assume ``initial=0``.
"""

from typing import Callable

import xarray as xr
Expand Down
3 changes: 3 additions & 0 deletions xrscipy/signal/spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@
A partially averaged counterpart to :py:func:`~xrscipy.signal.coherence` is :py:func:`~xrscipy.signal.coherogram` which uses a running average over ``nrolling`` FFT windows.
"""

from __future__ import annotations

from typing import Callable, Literal, TypeVar

import numpy as np
Expand Down
3 changes: 3 additions & 0 deletions xrscipy/signal/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
r"""utils for signal"""

from __future__ import annotations

import typing
import warnings

Expand Down

0 comments on commit 6606925

Please sign in to comment.