Skip to content

Commit

Permalink
chore: Updates for Python 3.12 in CI (#1107)
Browse files Browse the repository at this point in the history
- Drop support for Python 3.7 & 3.8 in CI.
- Use setuptools_scm recommended version file.

Update the approach to determine the current version of Pywr
to use the method recommended by setuptools_scm. This removes
the need for pkg_resources to be installed at runtime (which
is no longer installed by default in Python 3.12).
  • Loading branch information
jetuk authored Oct 6, 2023
1 parent 1981de1 commit a0924ea
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
CIBW_TEST_COMMAND_LINUX: "{project}/.github/workflows/run-tests.sh {project}"
CIBW_TEST_COMMAND_WINDOWS: "{project}\\.github\\workflows\\run-tests-windows.bat {project}"
# Only build on Python 3.7+
CIBW_BUILD: cp37-* cp38-* cp39-* cp310-* cp311-*
CIBW_BUILD: cp39-* cp310-* cp311-* cp312-*
# Skip 32-bit builds and MUSL Linux builds
# MUSL Linux can be re-enabled more easily when updating from manylinux2014
CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux*"
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[build-system]
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4", "cython>=3", "numpy"]
requires = ["setuptools>=62", "wheel", "setuptools_scm[toml]>=8.0", "cython>=3", "numpy"]

# enable version inference
[tool.setuptools_scm]

version_file = "pywr/_version.py"

[tool.black]
line-length = 88
Expand Down
10 changes: 5 additions & 5 deletions pywr/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env python
import os
import sys
from pkg_resources import get_distribution, DistributionNotFound

try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
# package is not installed
pass
from ._version import version as __version__
from ._version import version_tuple
except ImportError:
__version__ = "unknown version"
version_tuple = (0, 0, "unknown version")

if sys.platform == "win32":
dll_folder = os.path.abspath(os.path.join(os.path.dirname(__file__), ".libs"))
Expand Down
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ def finalize_options(self):
author="Joshua Arnott",
author_email="josh@snorfalorpagus.net",
url="https://github.com/pywr/pywr",
setup_requires=["setuptools>=18.0", "setuptools_scm", "cython>=3", "numpy"],
setup_requires=[
"setuptools>=62",
"setuptools_scm[toml]>=8.0",
"cython>=3",
"numpy",
],
install_requires=[
"pandas",
"networkx",
Expand Down

0 comments on commit a0924ea

Please sign in to comment.