Skip to content

v2.2.1 #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion django_typer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
model_parser_completer, # noqa: F401
)

VERSION = (2, 2, 0)
VERSION = (2, 2, 1)

__title__ = "Django Typer"
__version__ = ".".join(str(i) for i in VERSION)
Expand Down
30 changes: 0 additions & 30 deletions django_typer/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,33 +127,3 @@ def get_console(stderr: bool = False) -> Console:

strip_ansi = _compat.strip_ansi
_compat.strip_ansi = lambda value: strip_ansi(str(value))


from typer import __version__ as typer_version # noqa: E402

if (0, 4, 0) <= tuple(int(v) for v in typer_version.split(".")) < (0, 13, 0):
from typer import main as typer_main
from typer.models import ParamMeta

upstream_get_click_param = typer_main.get_click_param

def patched_get_click_param(
param: ParamMeta,
) -> t.Tuple[t.Union[click.Argument, click.Option], t.Any]:
"""
Patch this bug: https://github.com/tiangolo/typer/issues/334

This gets shell completions working for arguments. As of 0.9.0 I have
an open PR to fix this problem upstream, but it is enough of an issue
that its worth patching here until it gets merged.
"""
click_param = upstream_get_click_param(param)
if isinstance(click_param[0], click.Argument) and getattr(
param.default, "shell_complete", None
):
click_param[0]._custom_shell_complete = param.default.shell_complete
return click_param

typer_main.get_click_param = patched_get_click_param
else: # pragma: no cover
pass
5 changes: 5 additions & 0 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
Change Log
==========

v2.2.1 (17-AUG-2024)
====================

* Fixed `Remove shell_complete monkey patch when upstream PR is merged. <https://github.com/bckohan/django-typer/issues/66>`_

v2.2.0 (26-JUL-2024)
====================

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "django-typer"
version = "2.2.0"
version = "2.2.1"
description = "Use Typer to define the CLI for your Django management commands."
authors = ["Brian Kohan <[email protected]>"]
license = "MIT"
Expand Down Expand Up @@ -48,7 +48,7 @@ click = "^8.1.0"
# typer's release history is full of breaking changes for minor versions
# given the reliance on some of its private internals we peg the typer
# version very strictly to bug fix releases for specific minor lines.
typer-slim = ">=0.12.0,<0.13.0"
typer-slim = ">=0.12.4,<0.13.0"

# this should track typer's rich dependency, so long as our console
# patches still work - so be sure to test on the low end of the range
Expand Down
Loading