Skip to content

Commit ee7599f

Browse files
Deprecate support for Python 3.6 and remove dependency on attrs (#1257)
* Start deprecation of Python 3.6 * Removed dependency on attrs and replaced with dataclasses * Fix typing * Added comments to assist with dropping support of Python versions in the future. --------- Co-authored-by: Kevin Van Brunt <kmvanbrunt@gmail.com>
1 parent 031832a commit ee7599f

35 files changed

+89
-120
lines changed

.github/CONTRIBUTING.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ The tables below list all prerequisites along with the minimum required version
4646
#### Prerequisites to run cmd2 applications
4747

4848
| Prerequisite | Minimum Version |
49-
| --------------------------------------------------- | --------------- |
50-
| [python](https://www.python.org/downloads/) | `3.6` |
51-
| [attrs](https://github.com/python-attrs/attrs) | `16.3` |
49+
| --------------------------------------------------- |-----------------|
50+
| [python](https://www.python.org/downloads/) | `3.7` |
5251
| [pyperclip](https://github.com/asweigart/pyperclip) | `1.6` |
5352
| [setuptools](https://pypi.org/project/setuptools/) | `34.4` |
5453
| [wcwidth](https://pypi.python.org/pypi/wcwidth) | `0.1.7` |

.github/workflows/doc.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]
15-
python-version: ["3.10"]
15+
python-version: ["3.11"]
1616
fail-fast: false
1717
runs-on: ${{ matrix.os }}
1818
steps:

.github/workflows/format.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]
15-
python-version: ["3.10"]
15+
python-version: ["3.11"]
1616
fail-fast: false
1717
runs-on: ${{ matrix.os }}
1818
steps:

.github/workflows/lint.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]
15-
python-version: ["3.10"]
15+
python-version: ["3.11"]
1616
fail-fast: false
1717
runs-on: ${{ matrix.os }}
1818
steps:

.github/workflows/mypy.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]
15-
python-version: ["3.10"]
15+
python-version: ["3.11"]
1616
fail-fast: false
1717
runs-on: ${{ matrix.os }}
1818
steps:

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,7 @@ Pipfile.lock
3939
.venv
4040

4141
# Commitizen configuration
42-
.cz.toml
42+
.cz.toml
43+
44+
# pyenv version file
45+
.python-version

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 2.5.0 (TBD)
2+
* Breaking Change
3+
* `cmd2` 2.5 supports Python 3.7+ (removed support for Python 3.6)
4+
* Enhancements
5+
* Removed dependency on `attrs` and replaced with [dataclasses](https://docs.python.org/3/library/dataclasses.html)
6+
17
## 2.4.3 (January 27, 2023)
28
* Bug Fixes
39
* Fixed ValueError caused when passing `Cmd.columnize()` strings wider than `display_width`.

Pipfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ url = "https://pypi.org/simple"
44
verify_ssl = true
55

66
[packages]
7-
attrs = ">=16.3.0"
87
pyperclip = ">=1.6"
98
setuptools = ">=34.4"
109
wcwidth = ">=0.1.7"

README.md

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

81-
cmd2 works with Python 3.6+ on Windows, macOS, and Linux. It is pure Python code with few 3rd-party dependencies.
81+
cmd2 works with Python 3.7+ on Windows, macOS, and Linux. It is pure Python code with few 3rd-party dependencies.
8282

8383
For information on other installation options, see
8484
[Installation Instructions](https://cmd2.readthedocs.io/en/latest/overview/installation.html) in the cmd2

cmd2/argparse_completer.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,8 @@ def update_mutex_groups(arg_action: argparse.Action) -> None:
273273
# Check if this action is in a mutually exclusive group
274274
for group in self._parser._mutually_exclusive_groups:
275275
if arg_action in group._group_actions:
276-
277276
# Check if the group this action belongs to has already been completed
278277
if group in completed_mutex_groups:
279-
280278
# If this is the action that completed the group, then there is no error
281279
# since it's allowed to appear on the command line more than once.
282280
completer_action = completed_mutex_groups[group]
@@ -307,7 +305,6 @@ def update_mutex_groups(arg_action: argparse.Action) -> None:
307305
# Parse all but the last token
308306
#############################################################################################
309307
for token_index, token in enumerate(tokens[:-1]):
310-
311308
# If we're in a positional REMAINDER arg, force all future tokens to go to that
312309
if pos_arg_state is not None and pos_arg_state.is_remainder:
313310
consume_argument(pos_arg_state)
@@ -339,7 +336,6 @@ def update_mutex_groups(arg_action: argparse.Action) -> None:
339336

340337
# Check the format of the current token to see if it can be an argument's value
341338
if _looks_like_flag(token, self._parser) and not skip_remaining_flags:
342-
343339
# Check if there is an unfinished flag
344340
if (
345341
flag_arg_state is not None
@@ -484,7 +480,6 @@ def update_mutex_groups(arg_action: argparse.Action) -> None:
484480

485481
# Otherwise check if we have a positional to complete
486482
elif pos_arg_state is not None or remaining_positionals:
487-
488483
# If we aren't current tracking a positional, then get the next positional arg to handle this token
489484
if pos_arg_state is None:
490485
action = remaining_positionals.popleft()

0 commit comments

Comments
 (0)