Skip to content

Commit 6d269ea

Browse files
Add python 3.12 support
1 parent eeb9c52 commit 6d269ea

File tree

8 files changed

+554
-540
lines changed

8 files changed

+554
-540
lines changed

.github/workflows/tests.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,20 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
include:
19-
- { python: "3.11", os: "ubuntu-latest", session: "pre-commit" }
19+
- { python: "3.12", os: "ubuntu-latest", session: "pre-commit" }
20+
- { python: "3.12", os: "ubuntu-latest", session: "mypy" }
2021
- { python: "3.11", os: "ubuntu-latest", session: "mypy" }
2122
- { python: "3.10", os: "ubuntu-latest", session: "mypy" }
2223
- { python: "3.9", os: "ubuntu-latest", session: "mypy" }
24+
- { python: "3.12", os: "ubuntu-latest", session: "tests" }
2325
- { python: "3.11", os: "ubuntu-latest", session: "tests" }
2426
- { python: "3.10", os: "ubuntu-latest", session: "tests" }
2527
- { python: "3.9", os: "ubuntu-latest", session: "tests" }
28+
- { python: "3.12", os: "windows-latest", session: "tests" }
2629
- { python: "3.11", os: "windows-latest", session: "tests" }
2730
- { python: "3.10", os: "windows-latest", session: "tests" }
2831
- { python: "3.9", os: "windows-latest", session: "tests" }
32+
- { python: "3.12", os: "macos-latest", session: "tests" }
2933
- { python: "3.11", os: "macos-latest", session: "tests" }
3034
- { python: "3.10", os: "macos-latest", session: "tests" }
3135
- { python: "3.9", os: "macos-latest", session: "tests" }

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ duplication of work, and allows for feedback on your ideas.
4040

4141
## How to set up your development environment
4242

43-
You need Python 3.9, 3.10 or 3.11, and the following tools:
43+
You need Python 3.9, 3.10, 3.11 or 3.12, and the following tools:
4444

4545
- [Poetry]
4646
- [Nox]

docs/contributing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ on your ideas.
4949
How to set up your development environment
5050
------------------------------------------
5151

52-
You need Python 3.9, 3.10 or 3.11, and the following tools:
52+
You need Python 3.9, 3.10, 3.11 or 3.12, and the following tools:
5353

5454
- `Poetry <https://python-poetry.org/>`__
5555
- `Nox <https://nox.thea.codes/>`__

docs/installation.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Installation
44
============
55

66
These instructions will get you a copy of ``sectionproperties`` up and running on your
7-
machine. You will need a working copy of python 3.9, 3.10 or 3.11 to get started.
7+
machine. You will need a working copy of python 3.9, 3.10, 3.11 or 3.12 to get started.
88

99
Installing ``sectionproperties``
1010
--------------------------------
@@ -71,3 +71,6 @@ To install ``sectionproperties`` with the above functionality, use the ``dxf`` a
7171
7272
pip install sectionproperties[dxf]
7373
pip install sectionproperties[rhino]
74+
75+
.. warning:: The "rhino" extras do not currently support python 3.12, this may only be
76+
installed for python 3.9, 3.10 and 3.11.

noxfile.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424

2525
package = "sectionproperties"
26-
python_versions = ["3.11", "3.10", "3.9"]
26+
python_versions = ["3.12", "3.11", "3.10", "3.9"]
2727
nox.needs_version = ">= 2021.6.6"
2828
nox.options.sessions = (
2929
"pre-commit",
@@ -161,9 +161,21 @@ def tests(session: Session) -> None:
161161
Args:
162162
session: Nox session
163163
"""
164-
session.run_always(
165-
"poetry", "install", "--only", "main", "--extras", "dxf rhino", external=True
166-
)
164+
# if python version is 3.12, don't install rhino extras
165+
if session.python == "3.12":
166+
session.run_always(
167+
"poetry", "install", "--only", "main", "--extras", "dxf", external=True
168+
)
169+
else:
170+
session.run_always(
171+
"poetry",
172+
"install",
173+
"--only",
174+
"main",
175+
"--extras",
176+
"dxf rhino",
177+
external=True,
178+
)
167179

168180
# install relevant tooling
169181
session.install("coverage[toml]", "pytest", "pygments", "pytest-check")
@@ -201,7 +213,7 @@ def coverage(session: Session) -> None:
201213
session.run("coverage", *args)
202214

203215

204-
@session(name="docs-build", python=python_versions[1])
216+
@session(name="docs-build", python=python_versions[2])
205217
def docs_build(session: Session) -> None:
206218
"""Build the documentation.
207219
@@ -241,7 +253,7 @@ def docs_build(session: Session) -> None:
241253
session.run("sphinx-build", *args)
242254

243255

244-
@session(python=python_versions[1])
256+
@session(python=python_versions[2])
245257
def docs(session: Session) -> None:
246258
"""Build and serve the documentation with live reloading on file changes.
247259

poetry.lock

Lines changed: 514 additions & 525 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ classifiers = [
2929
"Programming Language :: Python :: 3.9",
3030
"Programming Language :: Python :: 3.10",
3131
"Programming Language :: Python :: 3.11",
32+
"Programming Language :: Python :: 3.12",
3233
]
3334
packages = [
3435
{ include = "sectionproperties", from = "src" },
@@ -47,9 +48,9 @@ Changelog = "https://github.com/robbievanleeuwen/section-properties/releases"
4748
"Bug Tracker" = "https://github.com/robbievanleeuwen/section-properties/issues"
4849

4950
[tool.poetry.dependencies]
50-
python = ">=3.9.0,<3.12"
51-
numpy = "^1.24.4"
52-
scipy = "^1.10.1"
51+
python = ">=3.9.0,<3.13"
52+
numpy = "^1.26.4"
53+
scipy = "^1.12.0"
5354
matplotlib = "^3.8.3"
5455
shapely = "^2.0.3"
5556
triangle = "^20230923"
@@ -58,8 +59,8 @@ click = "^8.1.7"
5859
more-itertools = "^10.2.0"
5960
numba = { version = "^0.59.0", optional = true }
6061
cad-to-shapely = { version = "^0.3.1", optional = true }
61-
rhino-shapley-interop = { version = "^0.0.4", optional = true }
62-
rhino3dm = { version = "^8.4.0", optional = true }
62+
rhino-shapley-interop = { version = "^0.0.4", python = ">=3.9.0,<3.12", optional = true }
63+
rhino3dm = { version = "^8.4.0", python = ">=3.9.0,<3.12", optional = true }
6364
pypardiso = { version = "^0.4.5", optional = true }
6465
intel-openmp = { version = "==2023.2.0", optional = true }
6566
mkl = { version = "==2023.2.0", optional = true }

tests/geometry/test_geometry.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
import json
6+
import sys
67
from pathlib import Path
78

89
import pytest
@@ -479,6 +480,7 @@ def test_geometry_from_dxf():
479480
assert sp_geom.Geometry.from_dxf(section_holes_dxf).geom.wkt == poly
480481

481482

483+
@pytest.mark.skipif(sys.version_info >= (3, 12), reason="requires python < 3.12")
482484
def test_geometry_from_3dm_file_simple():
483485
"""Tests loading geometry from a simple .3dm file."""
484486
section = Path(__file__).parent.absolute() / "3in x 2in.3dm"
@@ -487,6 +489,7 @@ def test_geometry_from_3dm_file_simple():
487489
assert (test.geom - exp).is_empty
488490

489491

492+
@pytest.mark.skipif(sys.version_info >= (3, 12), reason="requires python < 3.12")
490493
def test_geometry_from_3dm_file_complex():
491494
"""Tests loading geometry from a complex .3dm file."""
492495
section_3dm = Path(__file__).parent.absolute() / "complex_shape.3dm"
@@ -498,6 +501,7 @@ def test_geometry_from_3dm_file_complex():
498501
assert (test.geom - exp).is_empty
499502

500503

504+
@pytest.mark.skipif(sys.version_info >= (3, 12), reason="requires python < 3.12")
501505
def test_geometry_from_3dm_file_compound():
502506
"""Tests loading compound geometry from a .3dm file."""
503507
section_3dm = Path(__file__).parent.absolute() / "compound_shape.3dm"
@@ -509,6 +513,7 @@ def test_geometry_from_3dm_file_compound():
509513
assert (MultiPolygon([ii.geom for ii in test.geoms]) - MultiPolygon(exp)).is_empty
510514

511515

516+
@pytest.mark.skipif(sys.version_info >= (3, 12), reason="requires python < 3.12")
512517
def test_geometry_from_3dm_encode():
513518
"""Tests loading compound geometry from a .json file."""
514519
section_3dm = Path(__file__).parent.absolute() / "rhino_data.json"

0 commit comments

Comments
 (0)