Skip to content

Commit 3546a0e

Browse files
RonnyPfannschmidtCursor AIclaudecursoragent
committed
feat: restore Python 3.8 and 3.9 support
Re-enable Python 3.8+ compatibility to allow use as a build dependency for projects like scikit-build that still support these versions. Changes: - Lower requires-python to >=3.8 in all packages - Add version-guarded imports for typing_extensions (TypeAlias, ParamSpec, Concatenate, TypeGuard) on Python <3.10 - Replace match/case with if/elif/else in _scm_metadata.py - Replace kw_only=True dataclass with manual __init__ in _legacy_parse.py - Use string-form TypeAlias RHS to avoid runtime type unions - Add python_version markers on dev deps requiring 3.10+ - Add 3.8 and 3.9 to CI test matrix - Fix parenthesized with-statement (3.9+ syntax) in test Co-authored-by: Cursor AI <ai@cursor.sh> Co-authored-by: Anthropic Claude Opus 4 <claude@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 310f3c3 commit 3546a0e

24 files changed

Lines changed: 1727 additions & 283 deletions

‎.github/workflows/python-tests.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jobs:
9898
strategy:
9999
fail-fast: false
100100
matrix:
101-
python_version: [ '3.10', '3.11', '3.12', '3.13', 'pypy-3.11' ]
101+
python_version: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.11' ]
102102
os: [windows-latest, ubuntu-latest] #, macos-latest]
103103
include:
104104
- os: windows-latest

‎pyproject.toml‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
name = "vcs-versioning.workspace"
55
description = "workspace configuration for this monorepo"
66
version = "0.1+private"
7-
requires-python = ">=3.10"
7+
requires-python = ">=3.8"
88
dependencies = [
99
"vcs-versioning",
1010
"setuptools-scm",
@@ -18,12 +18,12 @@ create-release-proposal = "vcs_versioning_workspace.create_release_proposal:main
1818
# PP006 / uv: aggregate groups for local development (members define their own test deps)
1919
dev = [{ include-group = "docs" }, { include-group = "typing" }, { include-group = "release" }]
2020
docs = [
21-
"mkdocs<2",
22-
"mkdocs-include-markdown-plugin<8",
23-
"mkdocs-material<10",
24-
"mkdocstrings[python]>=1.0.4,<2", # 0.29 renamed import to inventories
25-
"pygments<2.20",
26-
"griffe-public-wildcard-imports",
21+
"mkdocs<2; python_version>='3.10'",
22+
"mkdocs-include-markdown-plugin<8; python_version>='3.10'",
23+
"mkdocs-material<10; python_version>='3.10'",
24+
"mkdocstrings[python]>=1.0.4,<2; python_version>='3.10'", # 0.29 renamed import to inventories
25+
"pygments<2.20; python_version>='3.10'",
26+
"griffe-public-wildcard-imports; python_version>='3.10'",
2727
]
2828
typing = [
2929
"types-setuptools",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Restore Python 3.8 and 3.9 support, re-enabling use as a build dependency for projects like scikit-build that still support these versions.

‎setuptools-scm/pyproject.toml‎

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
[build-system]
22
build-backend = "setuptools.build_meta"
33
requires = [
4-
"setuptools>=77.0.3",
4+
"setuptools>=45",
55
"vcs-versioning>=2.0.0.dev0,<3",
66
# https://github.com/pypa/setuptools-scm/issues/1222: was <=2.0.2 for #1090 (old pip+toml);
77
# pip 21.2+ vendors tomli, so the workaround is no longer needed.
88
'tomli>=1; python_version < "3.11"',
9-
'typing-extensions; python_version < "3.11"',
9+
'typing-extensions>=4.1; python_version < "3.11"',
1010
]
1111
[project]
1212
name = "setuptools-scm"
1313
description = "the blessed package to manage your versions by scm tags"
1414
readme = "README.md"
15-
license = "MIT"
15+
license = {text = "MIT"}
1616
authors = [
1717
{name="Ronny Pfannschmidt", email="opensource@ronnypfannschmidt.de"}
1818
]
19-
requires-python = ">=3.10"
19+
requires-python = ">=3.8"
2020
classifiers = [
2121
"Development Status :: 5 - Production/Stable",
2222
"Intended Audience :: Developers",
2323
"Programming Language :: Python",
2424
"Programming Language :: Python :: 3 :: Only",
25+
"Programming Language :: Python :: 3.8",
26+
"Programming Language :: Python :: 3.9",
2527
"Programming Language :: Python :: 3.10",
2628
"Programming Language :: Python :: 3.11",
2729
"Programming Language :: Python :: 3.12",
@@ -43,7 +45,7 @@ dependencies = [
4345
# https://github.com/pypa/setuptools-scm/issues/1112 - re-pin in a breaking release
4446
"setuptools", # >= 61",
4547
'tomli>=1; python_version < "3.11"',
46-
'typing-extensions; python_version < "3.11"',
48+
'typing-extensions>=4.1; python_version < "3.11"',
4749
]
4850

4951

@@ -55,13 +57,13 @@ toml = []
5557
[dependency-groups]
5658
dev = [{ include-group = "test" }]
5759
docs = [
58-
"mkdocs",
59-
"mkdocs-entangled-plugin",
60-
"mkdocs-include-markdown-plugin",
61-
"mkdocs-material",
62-
"mkdocstrings[python]",
63-
"pygments",
64-
"griffe-public-wildcard-imports",
60+
"mkdocs; python_version>='3.10'",
61+
"mkdocs-entangled-plugin; python_version>='3.10'",
62+
"mkdocs-include-markdown-plugin; python_version>='3.10'",
63+
"mkdocs-material; python_version>='3.10'",
64+
"mkdocstrings[python]; python_version>='3.10'",
65+
"pygments; python_version>='3.10'",
66+
"griffe-public-wildcard-imports; python_version>='3.10'",
6567
]
6668
test = [
6769
"pip",
@@ -73,10 +75,10 @@ test = [
7375
"ruff",
7476
"mypy; implementation_name != 'pypy'",
7577
'typing-extensions; python_version < "3.11"',
76-
"griffe",
77-
"griffe-public-wildcard-imports",
78+
"griffe; python_version>='3.10'",
79+
"griffe-public-wildcard-imports; python_version>='3.10'",
7880
"flake8",
79-
"griffecli",
81+
"griffecli; python_version>='3.10'",
8082
]
8183

8284
[project.urls]

‎setuptools-scm/src/setuptools_scm/_integration/setuptools.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def _register_build_py_command(dist: setuptools.Distribution) -> None:
4646
log.debug("Registered setuptools_scm build_py command")
4747
return
4848

49-
project_build_py = cast(type[setuptools.Command], existing_build_py)
49+
project_build_py = cast("type[setuptools.Command]", existing_build_py)
5050

5151
if issubclass(project_build_py, ScmVersionFileMixin):
5252
return
@@ -79,7 +79,7 @@ def _register_egg_info_command(dist: setuptools.Distribution) -> None:
7979
log.debug("Registered setuptools_scm egg_info command")
8080
return
8181

82-
project_egg_info = cast(type[setuptools.Command], existing_egg_info)
82+
project_egg_info = cast("type[setuptools.Command]", existing_egg_info)
8383

8484
if issubclass(project_egg_info, ScmEggInfoMixin):
8585
return

‎setuptools-scm/src/setuptools_scm/_integration/version_inference.py‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
from __future__ import annotations
22

33
import logging
4+
import sys
45

56
from dataclasses import dataclass
67
from typing import TYPE_CHECKING
78
from typing import Any
89
from typing import Protocol
9-
from typing import TypeAlias
10+
11+
if sys.version_info >= (3, 10):
12+
from typing import TypeAlias
13+
else:
14+
from typing_extensions import TypeAlias
1015

1116
from setuptools import Distribution
1217
from setuptools import sic as setuptools_sic
@@ -222,9 +227,7 @@ def apply(self, dist: Distribution) -> None:
222227

223228

224229
VersionInferenceResult: TypeAlias = (
225-
VersionInferenceConfig # Proceed with inference
226-
| VersionAlreadySetWarning # Warn: version already set
227-
| VersionInferenceNoOp # Don't infer (silent)
230+
"VersionInferenceConfig | VersionAlreadySetWarning | VersionInferenceNoOp"
228231
)
229232

230233

0 commit comments

Comments
 (0)