Skip to content

Commit e78bd75

Browse files
committed
drop python 3.8 - fix #130
1 parent 33e8e95 commit e78bd75

File tree

27 files changed

+75
-177
lines changed

27 files changed

+75
-177
lines changed

.github/workflows/lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ jobs:
1818
strategy:
1919
matrix:
2020
# run static analysis on bleeding and trailing edges
21-
python-version: [ '3.8', '3.10', '3.13' ]
21+
python-version: [ '3.9', '3.10', '3.13' ]
2222
django-version:
2323
- '3.2' # LTS April 2024
2424
- '4.2' # LTS April 2026
2525
- '5.1' # December 2025
2626
exclude:
27-
- python-version: '3.8'
27+
- python-version: '3.9'
2828
django-version: '4.2'
2929
- python-version: '3.13'
3030
django-version: '4.2'
3131
- python-version: '3.13'
3232
django-version: '3.2'
3333
- python-version: '3.10'
3434
django-version: '3.2'
35-
- python-version: '3.8'
35+
- python-version: '3.9'
3636
django-version: '5.1'
3737
- python-version: '3.10'
3838
django-version: '5.1'

.github/workflows/test.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,19 @@ jobs:
1919
runs-on: ubuntu-latest
2020
strategy:
2121
matrix:
22-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
22+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
2323
django-version:
2424
- '3.2' # LTS April 2024
2525
- '4.2' # LTS April 2026
2626
- '5.0' # April 2025
2727
- '5.1' # December 2025
2828
exclude:
29-
- python-version: '3.8'
30-
django-version: '5.0'
3129
- python-version: '3.9'
3230
django-version: '5.0'
3331
- python-version: '3.11'
3432
django-version: '3.2'
3533
- python-version: '3.12'
3634
django-version: '3.2'
37-
- python-version: '3.8'
38-
django-version: '5.1'
3935
- python-version: '3.9'
4036
django-version: '5.1'
4137
- python-version: '3.13'
@@ -93,12 +89,12 @@ jobs:
9389
runs-on: ubuntu-latest
9490
strategy:
9591
matrix:
96-
python-version: ['3.8', '3.13']
92+
python-version: ['3.9', '3.13']
9793
django-version:
9894
- '3.2' # LTS April 2024
9995
- '5.1' # December 2025
10096
exclude:
101-
- python-version: '3.8'
97+
- python-version: '3.9'
10298
django-version: '5.1'
10399
- python-version: '3.13'
104100
django-version: '3.2'
@@ -150,12 +146,12 @@ jobs:
150146
runs-on: macos-latest
151147
strategy:
152148
matrix:
153-
python-version: ['3.8', '3.13']
149+
python-version: ['3.9', '3.13']
154150
django-version:
155151
- '3.2' # LTS April 2024
156152
- '5.1' # December 2025
157153
exclude:
158-
- python-version: '3.8'
154+
- python-version: '3.9'
159155
django-version: '5.1'
160156
- python-version: '3.13'
161157
django-version: '3.2'
@@ -234,12 +230,12 @@ jobs:
234230
# runs-on: windows-latest
235231
# strategy:
236232
# matrix:
237-
# python-version: ['3.8', '3.13']
233+
# python-version: ['3.9', '3.13']
238234
# django-version:
239235
# - '3.2' # LTS April 2024
240236
# - '5.0' # April 2025
241237
# exclude:
242-
# - python-version: '3.8'
238+
# - python-version: '3.9'
243239
# django-version: '5.0'
244240
# - python-version: '3.13'
245241
# django-version: '3.2'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Please refer to the [full documentation](https://django-typer.readthedocs.io/) f
7171

7272
## Basic Example
7373

74-
[TyperCommand](https://django-typer.readthedocs.io/en/latest/reference.html#django_typer.TyperCommand) is a very simple drop in replacement for [BaseCommand](https://docs.djangoproject.com/en/stable/howto/custom-management-commands/#django.core.management.BaseCommand). All of the documented features of [BaseCommand](https://docs.djangoproject.com/en/stable/howto/custom-management-commands/#django.core.management.BaseCommand) work the same way!
74+
[TyperCommand](https://django-typer.readthedocs.io/en/latest/reference.html#django_typer.TyperCommand) is a drop in extension to [BaseCommand](https://docs.djangoproject.com/en/stable/howto/custom-management-commands/#django.core.management.BaseCommand). All of the documented features of [BaseCommand](https://docs.djangoproject.com/en/stable/howto/custom-management-commands/#django.core.management.BaseCommand) work the same way!
7575

7676
```python
7777
from django_typer.management import TyperCommand

django_typer/management/__init__.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -775,11 +775,6 @@ class Command(
775775
else:
776776
return Typer(**kwargs)
777777

778-
if sys.version_info < (3, 9):
779-
# this is a workaround for a bug in python 3.8 that causes multiple
780-
# values for cls error. 3.8 support is sun setting soon so we just punt
781-
# on this one - REMOVE when 3.8 support is dropped
782-
kwargs.pop("cls", None)
783778
return super().__call__(*args, **kwargs)
784779

785780

@@ -1875,7 +1870,7 @@ def __new__(
18751870
bases,
18761871
attrs,
18771872
name: t.Optional[str] = Default(None),
1878-
# cls: t.Optional[t.Type[DTGroup]] = DTGroup,
1873+
cls: t.Optional[t.Type[DTGroup]] = DTGroup,
18791874
invoke_without_command: bool = Default(False),
18801875
no_args_is_help: bool = Default(False),
18811876
subcommand_metavar: t.Optional[str] = Default(None),
@@ -1941,7 +1936,7 @@ def command_bases() -> t.Generator[t.Type[TyperCommand], None, None]:
19411936

19421937
typer_app = Typer(
19431938
name=name or attrs.get("__module__", "").rsplit(".", maxsplit=1)[-1],
1944-
cls=kwargs.pop("cls", DTGroup),
1939+
cls=cls,
19451940
help=help or attr_help, # pyright: ignore[reportArgumentType]
19461941
invoke_without_command=invoke_without_command,
19471942
no_args_is_help=no_args_is_help,

django_typer/management/commands/shellcompletion.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,8 @@
2828
import os
2929
import sys
3030
import typing as t
31-
from pathlib import Path
32-
33-
if sys.version_info < (3, 9):
34-
from typing_extensions import Annotated
35-
else:
36-
from typing import Annotated
37-
3831
from functools import cached_property
32+
from pathlib import Path
3933

4034
from click.parser import split_arg_string
4135
from click.shell_completion import (
@@ -270,15 +264,15 @@ def replace(s: str, old: str, new: str, occurrences: t.List[int]) -> str:
270264
)
271265
def install(
272266
self,
273-
shell: Annotated[
267+
shell: t.Annotated[
274268
t.Optional[Shells],
275269
Argument(
276270
help=t.cast(
277271
str, _("Specify the shell to install or remove autocompletion for.")
278272
)
279273
),
280274
] = DETECTED_SHELL,
281-
manage_script: Annotated[
275+
manage_script: t.Annotated[
282276
t.Optional[str],
283277
Option(
284278
help=t.cast(
@@ -290,7 +284,7 @@ def install(
290284
)
291285
),
292286
] = None,
293-
fallback: Annotated[
287+
fallback: t.Annotated[
294288
t.Optional[str],
295289
Option(
296290
help=t.cast(
@@ -337,7 +331,7 @@ def install(
337331
)
338332
def remove(
339333
self,
340-
shell: Annotated[
334+
shell: t.Annotated[
341335
t.Optional[Shells],
342336
Argument(
343337
help=t.cast(
@@ -346,7 +340,7 @@ def remove(
346340
)
347341
),
348342
] = DETECTED_SHELL,
349-
manage_script: Annotated[
343+
manage_script: t.Annotated[
350344
t.Optional[str],
351345
Option(
352346
help=t.cast(
@@ -444,7 +438,7 @@ def remove(
444438
)
445439
def complete(
446440
self,
447-
cmd_str: Annotated[
441+
cmd_str: t.Annotated[
448442
t.Optional[str],
449443
Argument(
450444
metavar="command",
@@ -453,7 +447,7 @@ def complete(
453447
),
454448
),
455449
] = None,
456-
shell: Annotated[
450+
shell: t.Annotated[
457451
t.Optional[Shells],
458452
Option(
459453
help=t.cast(
@@ -464,7 +458,7 @@ def complete(
464458
)
465459
),
466460
] = None,
467-
fallback: Annotated[
461+
fallback: t.Annotated[
468462
t.Optional[str],
469463
Option(
470464
help=t.cast(

django_typer/types.py

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

77
import sys
88
from pathlib import Path
9-
from typing import Optional, cast
10-
11-
if sys.version_info < (3, 9):
12-
from typing_extensions import Annotated
13-
else:
14-
from typing import Annotated
9+
from typing import Annotated, Optional, cast
1510

1611
from django.core.management import CommandError
1712
from django.utils.translation import gettext_lazy as _

doc/source/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Change Log
55
v2.2.3 (2024-10-xx)
66
===================
77

8+
* Implemented `Drop python 3.8 support. <https://github.com/django-commons/django-typer/issues/130>`_
89
* Implemented `Command help order should respect definition order for class based commands. <https://github.com/django-commons/django-typer/issues/129>`_
910
* Fixed `Overriding the command group class does not work. <https://github.com/django-commons/django-typer/issues/128>`_
1011
* Completed `Add project to test PyPI <https://github.com/django-commons/django-typer/issues/126>`_

doc/source/index.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ developers will be familiar with. All of the BaseCommand_ functionality is prese
8282

8383
:big:`Basic Example`
8484

85-
:class:`~django_typer.management.TyperCommand` is a very simple drop in replacement for
86-
BaseCommand_. All of the documented features of BaseCommand_ work the same way! Or, you may also
87-
use an interface identical to Typer_'s. Simply import Typer_ from django_typer instead of typer.
85+
:class:`~django_typer.management.TyperCommand` is a drop in extension to BaseCommand_. All of the
86+
documented features of BaseCommand_ work the same way! Or, you may also use an interface identical
87+
to Typer_'s. Simply import Typer_ from django_typer instead of typer.
8888

8989
.. tabs::
9090

doc/source/refs.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
.. _fish: https://fishshell.com/
1414
.. _zsh: https://www.zsh.org/
1515
.. _bash: https://www.gnu.org/software/bash/
16-
.. _typing_extensions: https://pypi.org/project/typing-extensions/
1716
.. _Arguments: https://typer.tiangolo.com/tutorial/arguments/
1817
.. _Options: https://typer.tiangolo.com/tutorial/options/
1918
.. _call_command: https://docs.djangoproject.com/en/5.0/ref/django-admin/#running-management-commands-from-your-code

doc/source/tutorial.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,6 @@ markup the docstring may be the more appropriate place to put it.
181181

182182
|
183183
184-
.. note::
185-
186-
On Python <=3.8 you will need to import Annotated from typing_extensions_ instead of the standard
187-
library.
188-
189-
190184
Defining custom and reusable parameter types
191185
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
192186

0 commit comments

Comments
 (0)