Skip to content

Commit

Permalink
Support Python 3.10
Browse files Browse the repository at this point in the history
To help adoption, this change adds support for more
Python versions, namely Python 3.10.

Note, Python 3.10 is missing:
 * re._constants - instead use sre_constants
 * re._parser - instead use sre_parse
 * typing.Self - use typing_extensions

Signed-off-by: Eric Brown <[email protected]>
  • Loading branch information
ericwb committed Oct 9, 2024
1 parent a660b35 commit 80f768c
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ jobs:
strategy:
matrix:
python-version: [
["3.10", "310"],
["3.11", "311"],
["3.12", "312"],
["3.13", "313"],
Expand Down
11 changes: 9 additions & 2 deletions precli/core/redos.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
import collections
import itertools
import sys
from re import _constants as constants
from re import _parser as parser

try:
from re import _constants as constants
except ImportError:
import sre_constants as constants
try:
from re import _parser as parser
except ImportError:
import sre_parse as parser


CR = collections.namedtuple("CR", ["cr_min", "cr_max"])
Expand Down
7 changes: 5 additions & 2 deletions precli/core/symtab.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Copyright 2023 Secure Sauce LLC
from typing import Self
# Copyright 2024 Secure Sauce LLC
try:
from typing import Self
except ImportError:
from typing_extensions import Self

from precli.core.call import Call

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
typing-extensions==4.12.2;python_version<"3.11"
rich==13.9.2
tree-sitter==0.23.1
ignorelib==0.3.0
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ classifier =
Operating System :: Microsoft :: Windows
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3.13
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@


setuptools.setup(
python_requires=">=3.11", setup_requires=["pbr>=2.0.0"], pbr=True
python_requires=">=3.10", setup_requires=["pbr>=2.0.0"], pbr=True
)

0 comments on commit 80f768c

Please sign in to comment.