Skip to content

Commit 1514240

Browse files
authored
Add Python 3.13 support (#719)
1 parent a2f8e4d commit 1514240

File tree

9 files changed

+34
-17
lines changed

9 files changed

+34
-17
lines changed

.github/workflows/pip-checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
matrix:
1818
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
19-
python-version: ["3.10", "3.11", "3.12"]
19+
python-version: ["3.10", "3.11", "3.12", "3.13"]
2020

2121
steps:
2222
- uses: actions/checkout@v4

.github/workflows/python-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
matrix:
1919
os: ["ubuntu-latest", "macos-latest"]
20-
python-version: ["3.10", "3.11", "3.12"]
20+
python-version: ["3.10", "3.11", "3.12", "3.13"]
2121

2222
# Run all shells using bash (including Windows)
2323
defaults:

CONTRIBUTING.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ The technical steps to contributing to xDEM are:
2020

2121
## Development environment
2222

23-
xDEM currently supports Python versions of 3.10 to 3.12 (see `dev-environment.yml` for detailed dependencies), which are
23+
xDEM currently supports Python versions of 3.10 to 3.13 (see `dev-environment.yml` for detailed dependencies), which are
2424
tested in a continuous integration (CI) workflow running on GitHub Actions.
2525

2626
When you open a PR on xDEM, a single linting action and 9 test actions will automatically start, corresponding to all
27-
supported Python versions (3.10, 3.11 and 3.12) and OS (Ubuntu, Mac, Windows). The coverage change of the tests will also
27+
supported Python versions (3.10, 3.11, 3.12 and 3.13) and OS (Ubuntu, Mac, Windows). The coverage change of the tests will also
2828
be reported by CoverAlls.
2929

3030
### Setup
@@ -46,8 +46,6 @@ cd xdem
4646
make install
4747
```
4848

49-
Please note: pip installation is currently only possible under python3.10.
50-
5149
### Tests
5250

5351
At least one test per feature (in the associated `tests/test_*.py` file) should be included in the PR, using `pytest` (see existing tests for examples).

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ endif
1414
# Python global variables definition
1515
PYTHON_VERSION_MIN = 3.10
1616
# Set PYTHON if not defined in command line
17-
# Example: PYTHON="python3.10" make venv to use python 3.10 for the venv
17+
# Example: PYTHON="python3.13" make venv to use python 3.13 for the venv
1818
# By default the default python3 of the system.
1919
ifndef PYTHON
2020
PYTHON = "python3"

dev-environment.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: xdem-dev
22
channels:
33
- conda-forge
44
dependencies:
5-
- python>=3.10,<3.13
5+
- python>=3.10,<3.14
66
- geopandas>=0.12.0
77
- numba=0.*
88
- numpy>=1,<3
@@ -11,7 +11,6 @@ dependencies:
1111
- rasterio>=1.3,<2
1212
- scipy=1.*
1313
- tqdm
14-
- scikit-gstat>=1.0.18,<1.1
1514
- geoutils=0.1.17
1615
- affine
1716
- pandas
@@ -25,7 +24,6 @@ dependencies:
2524
- pytransform3d
2625
- pyyaml
2726
- scikit-learn
28-
- scikit-gstat>=1.0.18
2927

3028
# Test dependencies
3129
- pytest
@@ -48,7 +46,11 @@ dependencies:
4846
- numpydoc
4947

5048
- pip:
51-
- -e ./
49+
# Optional dependencies with Pip
50+
# SciKit-GStat temporarily here until Conda version supports Python 3.13
51+
- scikit-gstat>=1.0.18
52+
53+
- -e ./
5254

5355
# To run CI against latest GeoUtils
5456
# - git+https://github.com/rhugonnet/geoutils.git

doc/source/quick_start.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
file_format: mystnb
3+
mystnb:
4+
execution_timeout: 60
35
jupytext:
46
formats: md:myst
57
text_representation:

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: xdem
22
channels:
33
- conda-forge
44
dependencies:
5-
- python>=3.10,<3.13
5+
- python>=3.10,<3.14
66
- geopandas>=0.12.0
77
- numba=0.*
88
- numpy>=1,<3

setup.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ classifiers =
2222
Programming Language :: Python :: 3.10
2323
Programming Language :: Python :: 3.11
2424
Programming Language :: Python :: 3.12
25+
Programming Language :: Python :: 3.13
2526
Programming Language :: Python :: 3
2627
Topic :: Software Development :: Libraries :: Python Modules
2728
Typing :: Typed
@@ -32,7 +33,7 @@ download_url = https://pypi.org/project/xdem/
3233
packages = find:
3334
zip_safe = False # https://mypy.readthedocs.io/en/stable/installed_packages.html
3435
include_package_data = True
35-
python_requires = >=3.10,<3.13
36+
python_requires = >=3.10,<3.14
3637
# Avoid pinning dependencies in requirements.txt (which we don't do anyways, and we rely mostly on Conda)
3738
# (https://caremad.io/posts/2013/07/setup-vs-requirement/, https://github.com/pypa/setuptools/issues/1951)
3839
install_requires = file: requirements.txt

xdem/misc.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import copy
2323
import functools
24+
import sys
2425
import warnings
2526
from typing import Any, Callable
2627

@@ -125,14 +126,27 @@ def decorator(decorated: Callable) -> Callable: # type: ignore
125126
# Replace argument description of dem and resolution (not used in the DEM class, only in terrain)
126127
if remove_dem_res_params:
127128

129+
# Get Python version (spaces of docstring are not handled the same way after Python 3.13)
130+
pyv = Version(".".join(str(getattr(sys.version_info, v)) for v in ["major", "minor", "micro"]))
131+
128132
# Find and remove them if they exist
129133
if ":param dem:" in other_doc:
130-
dem_section = "\n :param dem:" + other_doc.split("\n :param dem:")[1].split("\n")[0]
134+
if pyv >= Version("3.13"):
135+
dem_section = "\n:param dem:" + other_doc.split("\n:param dem:")[1].split("\n")[0]
136+
else:
137+
dem_section = "\n :param dem:" + other_doc.split("\n :param dem:")[1].split("\n")[0]
138+
131139
other_doc = other_doc.replace(dem_section, "")
132140
if ":param resolution:" in other_doc:
133-
resolution_section = (
134-
"\n :param resolution:" + other_doc.split("\n :param resolution:")[1].split("\n")[0]
135-
)
141+
if pyv >= Version("3.13"):
142+
resolution_section = (
143+
"\n:param resolution:" + other_doc.split("\n:param resolution:")[1].split("\n")[0]
144+
)
145+
else:
146+
resolution_section = (
147+
"\n :param resolution:" + other_doc.split("\n :param resolution:")[1].split("\n")[0]
148+
)
149+
136150
other_doc = other_doc.replace(resolution_section, "")
137151

138152
# Remove docstring examples

0 commit comments

Comments
 (0)