Skip to content

Commit b56069c

Browse files
authored
Merge branch 'master' into typos
2 parents 3cf4e2e + 7bf84ab commit b56069c

25 files changed

Lines changed: 517 additions & 28 deletions

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ jobs:
3636
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
3737
run: python -m build
3838
- name: Publish
39-
uses: pypa/[email protected].1
39+
uses: pypa/[email protected].3

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ default_language_version:
44
python: python3.10
55
repos:
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v4.6.0
7+
rev: v5.0.0
88
hooks:
99
- id: check-added-large-files
1010
- id: check-toml
@@ -14,7 +14,7 @@ repos:
1414
- id: end-of-file-fixer
1515
- id: trailing-whitespace
1616
- repo: https://github.com/astral-sh/ruff-pre-commit
17-
rev: v0.6.5
17+
rev: v0.7.2
1818
hooks:
1919
- id: ruff
2020
args:

docs/release-notes.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,42 @@
22

33
## Latest Changes
44

5+
## 0.13.0
6+
57
### Features
68

9+
* ✨ Handle `KeyboardInterrupt` separately from other exceptions. PR [#1039](https://github.com/fastapi/typer/pull/1039) by [@patrick91](https://github.com/patrick91).
10+
* ✨ Update `launch` to not print anything when opening urls. PR [#1035](https://github.com/fastapi/typer/pull/1035) by [@patrick91](https://github.com/patrick91).
711
* ✨ Show help items in order of definition. PR [#944](https://github.com/fastapi/typer/pull/944) by [@svlandeg](https://github.com/svlandeg).
812

13+
### Fixes
14+
15+
* 🐛 Fix equality check for custom classes. PR [#979](https://github.com/fastapi/typer/pull/979) by [@AryazE](https://github.com/AryazE).
16+
* 🐛 Allow colon in zsh autocomplete values and descriptions. PR [#988](https://github.com/fastapi/typer/pull/988) by [@snapbug](https://github.com/snapbug).
17+
918
### Refactors
1019

20+
* 🗑️ Deprecate support for `is_flag` and `flag_value` parameters. PR [#987](https://github.com/fastapi/typer/pull/987) by [@svlandeg](https://github.com/svlandeg).
1121
* 🔥 Remove unused functionality from `_typing.py` file. PR [#805](https://github.com/fastapi/typer/pull/805) by [@ivantodorovich](https://github.com/ivantodorovich).
1222
* ✏️ Fix typo in function name `_make_rich_text`. PR [#959](https://github.com/fastapi/typer/pull/959) by [@svlandeg](https://github.com/svlandeg).
1323

1424
### Internal
1525

26+
* ✅ Only run completion installation tests when the env var `_TYPER_RUN_INSTALL_COMPLETION_TESTS` is set. PR [#995](https://github.com/fastapi/typer/pull/995) by [@svlandeg](https://github.com/svlandeg).
27+
* 📝 Update the docstring of the `_make_rich_text` method. PR [#972](https://github.com/fastapi/typer/pull/972) by [@svlandeg](https://github.com/svlandeg).
28+
*[pre-commit.ci] pre-commit autoupdate. PR [#1040](https://github.com/fastapi/typer/pull/1040) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
29+
* ⬆ Bump mkdocs-material from 9.5.42 to 9.5.44. PR [#1042](https://github.com/fastapi/typer/pull/1042) by [@dependabot[bot]](https://github.com/apps/dependabot).
30+
* ⬆ Bump ruff from 0.7.1 to 0.7.2. PR [#1038](https://github.com/fastapi/typer/pull/1038) by [@dependabot[bot]](https://github.com/apps/dependabot).
31+
* ⬆ Bump mkdocs-macros-plugin from 1.3.6 to 1.3.7. PR [#1031](https://github.com/fastapi/typer/pull/1031) by [@dependabot[bot]](https://github.com/apps/dependabot).
32+
*[pre-commit.ci] pre-commit autoupdate. PR [#1032](https://github.com/fastapi/typer/pull/1032) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
33+
* ⬆ Bump ruff from 0.7.0 to 0.7.1. PR [#1029](https://github.com/fastapi/typer/pull/1029) by [@dependabot[bot]](https://github.com/apps/dependabot).
34+
* ⬆ Bump pillow from 10.4.0 to 11.0.0. PR [#1023](https://github.com/fastapi/typer/pull/1023) by [@dependabot[bot]](https://github.com/apps/dependabot).
35+
* ⬆ Bump mkdocs-material from 9.5.35 to 9.5.42. PR [#1027](https://github.com/fastapi/typer/pull/1027) by [@dependabot[bot]](https://github.com/apps/dependabot).
36+
* ⬆ Bump ruff from 0.6.5 to 0.7.0. PR [#1026](https://github.com/fastapi/typer/pull/1026) by [@dependabot[bot]](https://github.com/apps/dependabot).
37+
* ⬆ Bump mkdocs-macros-plugin from 1.2.0 to 1.3.6. PR [#1025](https://github.com/fastapi/typer/pull/1025) by [@dependabot[bot]](https://github.com/apps/dependabot).
38+
* ⬆ Update pre-commit requirement from <4.0.0,>=2.17.0 to >=2.17.0,<5.0.0. PR [#1012](https://github.com/fastapi/typer/pull/1012) by [@dependabot[bot]](https://github.com/apps/dependabot).
39+
* ⬆ Bump pypa/gh-action-pypi-publish from 1.10.1 to 1.10.3. PR [#1009](https://github.com/fastapi/typer/pull/1009) by [@dependabot[bot]](https://github.com/apps/dependabot).
40+
*[pre-commit.ci] pre-commit autoupdate. PR [#1001](https://github.com/fastapi/typer/pull/1001) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
1641
* 👷 Update Deploy docs CI to use uv. PR [#1021](https://github.com/fastapi/typer/pull/1021) by [@tiangolo](https://github.com/tiangolo).
1742
* 👷 Fix smokeshow, checkout files on CI. PR [#1020](https://github.com/fastapi/typer/pull/1020) by [@tiangolo](https://github.com/tiangolo).
1843
* 👷 Use uv in CI. PR [#1019](https://github.com/fastapi/typer/pull/1019) by [@tiangolo](https://github.com/tiangolo).

requirements-docs.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
-e .
22

3-
mkdocs-material==9.5.35
3+
mkdocs-material==9.5.44
44
mdx-include >=1.4.1,<2.0.0
55
mkdocs-redirects>=1.2.1,<1.3.0
66
pyyaml >=5.3.1,<7.0.0
77
# For Material for MkDocs, Chinese search
88
# jieba==0.42.1
99
# For image processing by Material for MkDocs
10-
pillow==10.4.0
10+
pillow==11.0.0
1111
# For image processing by Material for MkDocs
1212
cairosvg==2.7.1
1313
# mkdocstrings[python]==0.25.1
1414
# Enable griffe-typingdoc once dropping Python 3.7 and upgrading typing-extensions
1515
# griffe-typingdoc==0.2.5
1616
# For griffe, it formats with black
1717
# black==24.3.0
18-
mkdocs-macros-plugin==1.2.0
18+
mkdocs-macros-plugin==1.3.7

requirements-tests.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ coverage[toml] >=6.2,<8.0
66
pytest-xdist >=1.32.0,<4.0.0
77
pytest-sugar >=0.9.4,<1.1.0
88
mypy ==1.4.1
9-
ruff ==0.6.5
9+
ruff ==0.7.2
1010
# Needed explicitly by typer-slim
1111
rich >=10.11.0
1212
shellingham >=1.3.0

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
-r requirements-tests.txt
44
-r requirements-docs.txt
55

6-
pre-commit >=2.17.0,<4.0.0
6+
pre-commit >=2.17.0,<5.0.0

scripts/test.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ set -x
77
export TERMINAL_WIDTH=3000
88
# Force disable terminal for tests inside of pytest, takes precedence over GITHUB_ACTIONS env var
99
export _TYPER_FORCE_DISABLE_TERMINAL=1
10+
# Run autocompletion install tests in the CI
11+
export _TYPER_RUN_INSTALL_COMPLETION_TESTS=1
1012
# It seems xdist-pytest ensures modified sys.path to import relative modules in examples keeps working
1113
pytest --cov --cov-report=term-missing -o console_output_style=progress --numprocesses=auto ${@}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import typer
2+
3+
image_desc = [
4+
("alpine:latest", "latest alpine image"),
5+
("alpine:hello", "fake image: for testing"),
6+
("nvidia/cuda:10.0-devel-ubuntu18.04", ""),
7+
]
8+
9+
10+
def _complete(incomplete: str) -> str:
11+
for image, desc in image_desc:
12+
if image.startswith(incomplete):
13+
yield image, desc
14+
15+
16+
app = typer.Typer()
17+
18+
19+
@app.command()
20+
def image(name: str = typer.Option(autocompletion=_complete)):
21+
typer.echo(name)
22+
23+
24+
if __name__ == "__main__":
25+
app()

tests/test_completion/test_completion.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from docs_src.commands.index import tutorial001 as mod
77

8-
from ..utils import needs_bash, needs_linux
8+
from ..utils import needs_bash, needs_linux, requires_completion_permission
99

1010

1111
@needs_bash
@@ -26,6 +26,7 @@ def test_show_completion():
2626

2727
@needs_bash
2828
@needs_linux
29+
@requires_completion_permission
2930
def test_install_completion():
3031
bash_completion_path: Path = Path.home() / ".bashrc"
3132
text = ""

tests/test_completion/test_completion_install.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@
1010

1111
from docs_src.commands.index import tutorial001 as mod
1212

13+
from ..utils import requires_completion_permission
14+
1315
runner = CliRunner()
1416
app = typer.Typer()
1517
app.command()(mod.main)
1618

1719

20+
@requires_completion_permission
1821
def test_completion_install_no_shell():
1922
result = subprocess.run(
2023
[sys.executable, "-m", "coverage", "run", mod.__file__, "--install-completion"],
@@ -28,6 +31,7 @@ def test_completion_install_no_shell():
2831
assert "Option '--install-completion' requires an argument" in result.stderr
2932

3033

34+
@requires_completion_permission
3135
def test_completion_install_bash():
3236
bash_completion_path: Path = Path.home() / ".bashrc"
3337
text = ""
@@ -67,6 +71,7 @@ def test_completion_install_bash():
6771
)
6872

6973

74+
@requires_completion_permission
7075
def test_completion_install_zsh():
7176
completion_path: Path = Path.home() / ".zshrc"
7277
text = ""
@@ -104,6 +109,7 @@ def test_completion_install_zsh():
104109
assert "compdef _tutorial001py_completion tutorial001.py" in install_content
105110

106111

112+
@requires_completion_permission
107113
def test_completion_install_fish():
108114
script_path = Path(mod.__file__)
109115
completion_path: Path = (
@@ -133,6 +139,7 @@ def test_completion_install_fish():
133139
assert "Completion will take effect once you restart the terminal" in result.stdout
134140

135141

142+
@requires_completion_permission
136143
def test_completion_install_powershell():
137144
completion_path: Path = (
138145
Path.home() / ".config/powershell/Microsoft.PowerShell_profile.ps1"

0 commit comments

Comments
 (0)