Skip to content

Commit a349351

Browse files
authored
Drop support for Python 3.10 (#1665)
This PR changes cmd2 to require Python 3.11 or newer.
1 parent 211a3b1 commit a349351

14 files changed

Lines changed: 20 additions & 47 deletions

File tree

.github/CONTRIBUTING.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,11 @@ See the `dependencies` list under the `[project]` heading in [pyproject.toml](..
6464
| Prerequisite | Minimum Version | Purpose |
6565
| ------------------------------------------------------------------------- | --------------- | ------------------------------------------------------ |
6666
| [prompt-toolkit](https://github.com/prompt-toolkit/python-prompt-toolkit) | `3.0.52` | Replacement for GNU `readline` that is cross-platform |
67-
| [python](https://www.python.org/downloads/) | `3.10` | Python programming language |
67+
| [python](https://www.python.org/downloads/) | `3.11` | Python programming language |
6868
| [pyperclip](https://github.com/asweigart/pyperclip) | `1.8` | Cross-platform clipboard functions |
6969
| [rich](https://github.com/Textualize/rich) | `14.3.0` | Add rich text and beautiful formatting in the terminal |
7070
| [rich-argparse](https://github.com/hamdanal/rich-argparse) | `1.7.1` | A rich-enabled help formatter for argparse |
7171

72-
> Python 3.10 depends on [backports.strenum](https://github.com/clbarnes/backports.strenum) to use
73-
> the `enum.StrEnum` class introduced in Python 3.11.
74-
7572
#### Additional prerequisites to build and publish cmd2
7673

7774
See the `build` list under the `[dependency-groups]` heading in [pyproject.toml](../pyproject.toml)
@@ -120,7 +117,7 @@ Linux). You can install `uv` using instructions at the link above.
120117
You can then install multiple versions of Python using `uv` like so:
121118

122119
```sh
123-
uv python install 3.10 3.11 3.12 3.13
120+
uv python install 3.11 3.12 3.13 3.14
124121
```
125122

126123
### Forking the project

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
os: [ubuntu-latest, macos-latest, windows-latest]
15-
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t", "3.15-dev"]
15+
python-version: ["3.11", "3.12", "3.13", "3.14", "3.14t", "3.15-dev"]
1616
fail-fast: false
1717

1818
runs-on: ${{ matrix.os }}

.github/workflows/typecheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
18+
python-version: ["3.11", "3.12", "3.13", "3.14"]
1919
fail-fast: false
2020
defaults:
2121
run:

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ repos:
1414
- id: trailing-whitespace
1515

1616
- repo: https://github.com/astral-sh/ruff-pre-commit
17-
rev: "v0.15.8"
17+
rev: "v0.15.13"
1818
hooks:
1919
- id: ruff-format
2020
args: [--config=ruff.toml]
@@ -26,11 +26,11 @@ repos:
2626
hooks:
2727
- id: prettier
2828
additional_dependencies:
29-
- prettier@3.8.1
29+
- prettier@3.8.3
3030
- prettier-plugin-toml@2.0.6
3131

3232
- repo: https://github.com/crate-ci/typos
33-
rev: v1.44.0
33+
rev: v1.46.1
3434
hooks:
3535
- id: typos
3636
exclude: |

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ prompt is displayed.
2222
each platform and provided utility functions related to `readline`
2323
- Added a dependency on `prompt-toolkit` and a new `cmd2.pt_utils` module with supporting
2424
utilities
25+
- Dropped support for Python 3.10. `cmd2` now requires Python 3.11 or later
2526
- Removed **Transcript Testing** feature set along with the `history -t` option for generating
2627
transcript files and the `cmd2.transcript` module
2728
- This was an extremely brittle regression testing framework which should never have been

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ On all operating systems, the latest stable version of `cmd2` can be installed u
8686
pip install -U cmd2
8787
```
8888

89-
cmd2 works with Python 3.10+ on Windows, macOS, and Linux. It is pure Python code with few 3rd-party
89+
cmd2 works with Python 3.11+ on Windows, macOS, and Linux. It is pure Python code with few 3rd-party
9090
dependencies. It works with both conventional CPython and free-threaded variants.
9191

9292
For information on other installation options, see

cmd2/cmd2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3124,7 +3124,7 @@ def _complete_statement(self, line: str) -> Statement:
31243124
while True:
31253125
try:
31263126
return self._check_statement_complete(line)
3127-
except IncompleteStatement: # noqa: PERF203
3127+
except IncompleteStatement:
31283128
# If incomplete, we need to fetch the next line
31293129
try:
31303130
try:

cmd2/colors.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
"""Provides a convenient StrEnum for Rich color names."""
22

3-
import sys
4-
5-
if sys.version_info >= (3, 11):
6-
from enum import StrEnum
7-
else:
8-
from backports.strenum import StrEnum
3+
from enum import StrEnum
94

105

116
class Color(StrEnum):

cmd2/completion.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import copy
44
import re
5-
import sys
65
from collections.abc import (
76
Iterable,
87
Iterator,
@@ -14,22 +13,16 @@
1413
)
1514
from typing import (
1615
Any,
16+
Self,
1717
cast,
1818
overload,
1919
)
2020

21-
from rich.table import Table
22-
23-
from . import string_utils as su
24-
25-
if sys.version_info >= (3, 11):
26-
from typing import Self
27-
else:
28-
from typing_extensions import Self
29-
3021
from rich.protocol import is_renderable
22+
from rich.table import Table
3123

3224
from . import rich_utils as ru
25+
from . import string_utils as su
3326

3427

3528
class _UnsetStr(str):

cmd2/parsing.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import re
44
import shlex
5-
import sys
65
from collections.abc import (
76
Iterable,
87
Mapping,
@@ -16,13 +15,9 @@
1615
from typing import (
1716
Any,
1817
ClassVar,
18+
Self,
1919
)
2020

21-
if sys.version_info >= (3, 11):
22-
from typing import Self
23-
else:
24-
from typing_extensions import Self
25-
2621
from . import (
2722
constants,
2823
utils,

0 commit comments

Comments
 (0)