You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use [Typer](https://typer.tiangolo.com/)to define the CLI for your [Django](https://www.djangoproject.com/) management commands using the typer interface. Optionally use the provided TyperCommand class that inherits from [BaseCommand](https://docs.djangoproject.com/en/stable/howto/custom-management-commands/#django.core.management.BaseCommand). This class maps the typer interface onto a class based interface that Django developers will be familiar with. All of the BaseCommand functionality is preserved, so that TyperCommand can be a drop in replacement.
15
+
Use static typing to define the CLI for your [Django](https://www.djangoproject.com/) management commands with [Typer](https://typer.tiangolo.com/). Optionally use the provided [TyperCommand](https://django-typer.readthedocs.io/en/latest/reference.html#django_typer.TyperCommand) class that inherits from [BaseCommand](https://docs.djangoproject.com/en/stable/howto/custom-management-commands/#django.core.management.BaseCommand). This class maps the [Typer](https://typer.tiangolo.com/) interface onto a class based interface that Django developers will be familiar with. All of the [BaseCommand](https://docs.djangoproject.com/en/stable/howto/custom-management-commands/#django.core.management.BaseCommand) functionality is preserved, so that [TyperCommand](https://django-typer.readthedocs.io/en/latest/reference.html#django_typer.TyperCommand) can be a drop in replacement.
16
16
17
17
**django-typer makes it easy to:**
18
18
19
-
- Define your command CLI interface in a clear, DRY, and safe way using type hints.
20
-
- Create subcommand and group command hierarchies.
21
-
- Use the full power of Typer's parameter types to validate and parse command line inputs.
22
-
- Create beautiful and information dense help outputs.
23
-
- Configure the rendering of exception stack traces using rich.
24
-
-[Install shell tab-completion support](https://django-typer.readthedocs.io/en/latest/shell_completion.html) for TyperCommands and normal Django commands for [bash](https://www.gnu.org/software/bash/), [zsh](https://www.zsh.org/), [fish](https://fishshell.com/), and [powershell](https://learn.microsoft.com/en-us/powershell/scripting/overview).
25
-
-[Create custom and portable shell tab-completions for your CLI parameters.](https://django-typer.readthedocs.io/en/latest/shell_completion.html#defining-custom-completions)
26
-
- Refactor existing management commands into TyperCommands because TyperCommand is interface compatible with BaseCommand.
27
-
- Use either a class-based interface or the basic Typer style interface to define commands.
19
+
* Define your command CLI interface in a clear, DRY and safe way using type hints
20
+
* Create subcommands and hierarchical groups of commands.
21
+
* Use the full power of [Typer](https://typer.tiangolo.com/)'s parameter types to validate and parse command line inputs.
22
+
* Create beautiful and information dense help outputs.
23
+
* Configure the rendering of exception stack traces using [rich](https://rich.readthedocs.io/en/latest/).
24
+
*[Install shell tab-completion support](https://django-typer.readthedocs.io/en/latest/shell_completion.html) for [bash](https://www.gnu.org/software/bash/), [zsh](https://www.zsh.org/), [fish](https://fishshell.com/), and [powershell](https://learn.microsoft.com/en-us/powershell/scripting/overview).
25
+
*[Create custom and portable shell tab-completions for your CLI parameters.](https://django-typer.readthedocs.io/en/latest/shell_completion.html#defining-custom-completions)
26
+
* Port existing commands ([TyperCommand](https://django-typer.readthedocs.io/en/latest/reference.html#django_typer.TyperCommand) is interface compatible with [BaseCommand](https://docs.djangoproject.com/en/stable/howto/custom-management-commands/#django.core.management.BaseCommand)).
27
+
* Use either a Django-style class-based interface or the Typer-style interface to define commands.
28
+
* Add plugins to upstream commands.
28
29
29
30
Please refer to the [full documentation](https://django-typer.readthedocs.io/) for more information.
30
31
@@ -44,7 +45,7 @@ Please refer to the [full documentation](https://django-typer.readthedocs.io/) f
44
45
pip install "django-typer[rich]"
45
46
```
46
47
47
-
2.Add`django_typer` to your `INSTALLED_APPS` setting:
48
+
2.Optionally add`django_typer` to your `INSTALLED_APPS` setting:
48
49
49
50
```python
50
51
INSTALLED_APPS= [
@@ -57,7 +58,7 @@ Please refer to the [full documentation](https://django-typer.readthedocs.io/) f
57
58
58
59
## Basic Example
59
60
60
-
For example, TyperCommands can be a very simple drop-in replacement for BaseCommands. All of the documented features of [BaseCommand](https://docs.djangoproject.com/en/stable/howto/custom-management-commands/#django.core.management.BaseCommand) work!
61
+
[TyperCommand](https://django-typer.readthedocs.io/en/latest/reference.html#django_typer.TyperCommand) is a very simple dropin 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!
61
62
62
63
```python
63
64
from django_typer import TyperCommand
@@ -69,7 +70,7 @@ class Command(TyperCommand):
69
70
"""
70
71
```
71
72
72
-
Or, you may also use an interface identitical to Typer's. Just import typer from django_typer instead of typer:
73
+
Or, you may also use an interface identical to [Typer](https://typer.tiangolo.com/)'s. Simply import [Typer](https://typer.tiangolo.com/) from django_typer instead of typer.
73
74
74
75
```python
75
76
from django_typer import Typer
@@ -220,7 +221,7 @@ Using the class-based interface we could define the command like this:
220
221
221
222
```
222
223
223
-
The typer-style interface builds a TyperCommand class for us.**This allows you to optionally accept the self argument in your commands.** We could define the above command using the typer interface like this:
224
+
The typer-style interface builds a [TyperCommand](https://django-typer.readthedocs.io/en/latest/reference.html#django_typer.TyperCommand) class for us **that allows you to optionally accept the self argument in your commands.** We could define the above command using the typer interface like this:
0 commit comments