Skip to content

Commit 599e7c0

Browse files
authored
Merge pull request #89 from bckohan/v2.0.x
V2.1.0
2 parents da65a56 + 943f311 commit 599e7c0

File tree

335 files changed

+4123
-4055
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

335 files changed

+4123
-4055
lines changed

.codecov.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
coverage:
33
fixes:
44
- "__init__.py::django_typer/__init__.py"
5+
- "management/__init__.py::django_typer/management/__init__.py"

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ jobs:
125125
timeout-minutes: 60
126126
- name: Run Unit Tests
127127
run: |
128-
poetry run pytest django_typer/tests/shellcompletion/*
128+
poetry run pytest tests/shellcompletion/*
129129
mv .coverage linux-complete-py${{ matrix.python-version }}-dj${{ matrix.django-version }}.coverage
130130
131131
- name: Store coverage files
@@ -209,7 +209,7 @@ jobs:
209209
- name: Run Unit Tests
210210
shell: zsh {0}
211211
run: |
212-
poetry run pytest django_typer/tests/shellcompletion/test_zsh.py || exit 1
212+
poetry run pytest tests/shellcompletion/test_zsh.py || exit 1
213213
mv .coverage macos-complete-py${{ matrix.python-version }}-dj${{ matrix.django-version }}.coverage
214214
215215
- name: Store coverage files
@@ -256,7 +256,7 @@ jobs:
256256
# shell: powershell
257257
# - name: Run Unit Tests
258258
# run: |
259-
# poetry run pytest django_typer/tests/completion_tests.py::PowerShellTests
259+
# poetry run pytest tests/completion_tests.py::PowerShellTests
260260
# mv .coverage windows-complete-py${{ matrix.python-version }}-dj${{ matrix.django-version }}.coverage
261261
# shell: powershell
262262
# - name: Store coverage files

CONTRIBUTING.md

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,21 @@
1212

1313
# Contributing
1414

15-
Contributions are encouraged! Please use the issue page to submit feature
16-
requests or bug reports. Issues with attached PRs will be given priority and
17-
have a much higher likelihood of acceptance. Please also open an issue and
18-
associate it with any submitted PRs. That said, the aim is to keep this library
19-
as lightweight as possible. Only features with broad-based use cases will be
20-
considered.
15+
Contributions are encouraged! Please use the issue page to submit feature requests or bug reports. Issues with attached PRs will be given priority and have a much higher likelihood of acceptance. Please also open an issue and associate it with any submitted PRs. That said, the aim is to keep this library as lightweight as possible. Only features with broad-based use cases will be considered.
2116

22-
We are actively seeking additional maintainers. If you're interested, please
23-
[contact me](https://github.com/bckohan).
17+
We are actively seeking additional maintainers. If you're interested, please [contact me](https://github.com/bckohan).
2418

2519
## Installation
2620

27-
`django-typer` uses [Poetry](https://python-poetry.org/) for environment, package, and dependency
28-
management:
21+
`django-typer` uses [Poetry](https://python-poetry.org/) for environment, package, and dependency management:
2922

3023
```shell
3124
poetry install
3225
```
3326

3427
## Documentation
3528

36-
`django-typer` documentation is generated using [Sphinx](https://www.sphinx-doc.org/en/master/) with the
37-
[readthedocs](https://readthedocs.org/) theme. Any new feature PRs must provide updated documentation for
38-
the features added. To build the docs run doc8 to check for formatting issues
39-
then run Sphinx:
29+
`django-typer` documentation is generated using [Sphinx](https://www.sphinx-doc.org/en/master/) with the [readthedocs](https://readthedocs.org/) theme. Any new feature PRs must provide updated documentation for the features added. To build the docs run doc8 to check for formatting issues then run Sphinx:
4030

4131
```bash
4232
cd ./doc
@@ -46,11 +36,7 @@ poetry run make html
4636

4737
## Static Analysis
4838

49-
`django-typer` uses [ruff](https://docs.astral.sh/ruff/) for Python linting, header import
50-
standardization and code formatting. [mypy](http://mypy-lang.org/) and
51-
[pyright](https://github.com/microsoft/pyright) are used for static type checking. Before any PR
52-
is accepted the following must be run, and static analysis tools should not produce any errors or
53-
warnings. Disabling certain errors or warnings where justified is acceptable:
39+
`django-typer` uses [ruff](https://docs.astral.sh/ruff/) for Python linting, header import standardization and code formatting. [mypy](http://mypy-lang.org/) and [pyright](https://github.com/microsoft/pyright) are used for static type checking. Before any PR is accepted the following must be run, and static analysis tools should not produce any errors or warnings. Disabling certain errors or warnings where justified is acceptable:
5440

5541
```bash
5642
./check.sh
@@ -64,10 +50,7 @@ To run static analysis without automated fixing you can run:
6450

6551
## Running Tests
6652

67-
`django-typer` is set up to use [pytest](https://docs.pytest.org/en/stable/) to run unit tests. All the tests are
68-
housed in `django_typer/tests/tests.py`. Before a PR is accepted, all tests
69-
must be passing and the code coverage must be at 100%. A small number of
70-
exempted error handling branches are acceptable.
53+
`django-typer` is set up to use [pytest](https://docs.pytest.org/en/stable/) to run unit tests. All the tests are housed in `tests/tests.py`. Before a PR is accepted, all tests must be passing and the code coverage must be at 100%. A small number of exempted error handling branches are acceptable.
7154

7255
To run the full suite:
7356

@@ -81,10 +64,9 @@ To run a single test, or group of tests in a class:
8164
poetry run pytest <path_to_tests_file>::ClassName::FunctionName
8265
```
8366

84-
For instance, to run all tests in BasicTests, and then just the
85-
test_call_command test you would do:
67+
For instance, to run all tests in BasicTests, and then just the test_call_command test you would do:
8668

8769
```shell
88-
poetry run pytest django_typer/tests/tests.py::BasicTests
89-
poetry run pytest django_typer/tests/tests.py::BasicTests::test_call_command
70+
poetry run pytest tests/tests.py::BasicTests
71+
poetry run pytest tests/tests.py::BasicTests::test_call_command
9072
```

README.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ Please refer to the [full documentation](https://django-typer.readthedocs.io/) f
3131

3232
![django-typer example](https://raw.githubusercontent.com/bckohan/django-typer/main/doc/source/_static/img/closepoll_example.gif)
3333

34+
## 🚨 Deprecation Notice
35+
36+
**Imports from ``django_typer`` have been deprecated and will be removed in 3.0! Imports have moved to ``django_typer.management``:**
37+
38+
```python
39+
# old way
40+
from django_typer import TyperCommand, command, group, initialize, Typer
41+
42+
# new way!
43+
from django_typer.management import TyperCommand, command, group, initialize, Typer
44+
```
45+
3446
## Installation
3547

3648
1. Clone django-typer from GitHub or install a release off [PyPI](https://pypi.org/project/django-typer/):
@@ -61,7 +73,7 @@ Please refer to the [full documentation](https://django-typer.readthedocs.io/) f
6173
[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!
6274

6375
```python
64-
from django_typer import TyperCommand
76+
from django_typer.management import TyperCommand
6577

6678
class Command(TyperCommand):
6779
def handle(self, arg1: str, arg2: str, arg3: float = 0.5, arg4: int = 1):
@@ -73,7 +85,7 @@ class Command(TyperCommand):
7385
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.
7486

7587
```python
76-
from django_typer import Typer
88+
from django_typer.management import Typer
7789

7890
app = Typer()
7991

@@ -98,7 +110,7 @@ Commands with multiple subcommands can be defined:
98110
from django.utils.translation import gettext_lazy as _
99111
from typer import Argument
100112

101-
from django_typer import TyperCommand, command
113+
from django_typer.management import TyperCommand, command
102114

103115

104116
class Command(TyperCommand):
@@ -128,7 +140,7 @@ Commands with multiple subcommands can be defined:
128140
Or using the typer-style interface this could be written:
129141

130142
```python
131-
from django_typer import Typer
143+
from django_typer.management import Typer
132144
import typing as t
133145

134146
from django.utils.translation import gettext_lazy as _
@@ -176,7 +188,7 @@ Using the class-based interface we could define the command like this:
176188
from django.utils.translation import gettext_lazy as _
177189
from typer import Argument, Option
178190

179-
from django_typer import TyperCommand, group
191+
from django_typer.management import TyperCommand, group
180192

181193

182194
class Command(TyperCommand):
@@ -232,7 +244,7 @@ from functools import reduce
232244
from django.utils.translation import gettext_lazy as _
233245
from typer import Argument, Option
234246

235-
from django_typer import Typer
247+
from django_typer.management import Typer
236248

237249

238250
app = Typer(help=_("A more complex command that defines a hierarchy of subcommands."))

0 commit comments

Comments
 (0)