Skip to content

Commit fb96046

Browse files
authored
Merge branch 'master' into feature/CommandAliases
2 parents b0db5dc + 17c0dce commit fb96046

File tree

136 files changed

+192
-494
lines changed

Some content is hidden

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

136 files changed

+192
-494
lines changed

docs/environment-variables.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,6 @@ It could look like this:
227227
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/custompython/bin
228228
```
229229

230-
This way, when you type `python` in the terminal, the system will find the Python program in `/opt/custompython/bin` (the last directory) and use that one.
231-
232230
////
233231

234232
//// tab | Windows
@@ -241,8 +239,6 @@ If you say yes to update the `PATH` environment variable, then the installer wil
241239
C:\Program Files\Python312\Scripts;C:\Program Files\Python312;C:\Windows\System32;C:\opt\custompython\bin
242240
```
243241

244-
This way, when you type `python` in the terminal, the system will find the Python program in `C:\opt\custompython\bin` (the last directory) and use that one.
245-
246242
////
247243

248244
So, if you type:
@@ -257,7 +253,7 @@ $ python
257253

258254
//// tab | Linux, macOS
259255

260-
The system will **find** the `python` program in `/opt/custompython/bin` and run it.
256+
The system will **find** the `python` program in `/opt/custompython/bin` (the last directory) and run it.
261257

262258
It would be roughly equivalent to typing:
263259

@@ -273,7 +269,7 @@ $ /opt/custompython/bin/python
273269

274270
//// tab | Windows
275271

276-
The system will **find** the `python` program in `C:\opt\custompython\bin\python` and run it.
272+
The system will **find** the `python` program in `C:\opt\custompython\bin\python` (the last directory) and run it.
277273

278274
It would be roughly equivalent to typing:
279275

docs/release-notes.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@
22

33
## Latest Changes
44

5+
### Features
6+
7+
* ✨ Add support for standard tracebacks via the env `TYPER_STANDARD_TRACEBACK`. PR [#1299](https://github.com/fastapi/typer/pull/1299) by [@colin-nolan](https://github.com/colin-nolan).
8+
59
### Docs
610

11+
* 📝 Remove duplicate explanation how the path is resolved. PR [#956](https://github.com/fastapi/typer/pull/956) by [@dennis-rall](https://github.com/dennis-rall).
712
* 📝 Update docs to use `Typer()` more prominently. PR [#1418](https://github.com/fastapi/typer/pull/1418) by [@svlandeg](https://github.com/svlandeg).
813
* 💄 Use font 'Fira Code' to fix display of Rich panels in docs in Windows. PR [#1419](https://github.com/fastapi/typer/pull/1419) by [@tiangolo](https://github.com/tiangolo).
914

1015
### Internal
1116

17+
* ✅ Update tests to use `mod.app` . PR [#1427](https://github.com/fastapi/typer/pull/1427) by [@svlandeg](https://github.com/svlandeg).
1218
* ⬆ Bump actions/checkout from 5 to 6. PR [#1426](https://github.com/fastapi/typer/pull/1426) by [@dependabot[bot]](https://github.com/apps/dependabot).
1319
*[pre-commit.ci] pre-commit autoupdate. PR [#1425](https://github.com/fastapi/typer/pull/1425) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
1420
* ⬆ Bump ruff from 0.14.5 to 0.14.6. PR [#1423](https://github.com/fastapi/typer/pull/1423) by [@dependabot[bot]](https://github.com/apps/dependabot).

docs/tutorial/arguments/default.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Hello Camila
5252

5353
And we can even make the default value be dynamically generated by passing a function as the `default_factory` argument:
5454

55-
{* docs_src/arguments/default/tutorial002_an.py hl[10:11,14] *}
55+
{* docs_src/arguments/default/tutorial002_an.py hl[9:10,14] *}
5656

5757
In this case, we created the function `get_name` that will just return a random `str` each time.
5858

docs/tutorial/exceptions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,14 @@ TypeError: can only concatenate str (not "int") to str
235235

236236
</div>
237237

238-
You could also achieve the same with the environment variable `_TYPER_STANDARD_TRACEBACK=1`.
238+
You could also achieve the same with the environment variable `TYPER_STANDARD_TRACEBACK=1` (or by setting the deprecated variable `_TYPER_STANDARD_TRACEBACK=1`).
239239

240240
This will work for any other Typer program too, in case you need to debug a problem in a Typer program made by someone else:
241241

242242
<div class="termy">
243243

244244
```console
245-
export _TYPER_STANDARD_TRACEBACK=1
245+
export TYPER_STANDARD_TRACEBACK=1
246246
$ python main.py
247247

248248

docs_src/arguments/default/tutorial002.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
app = typer.Typer()
66

77

8-
@app.command()
98
def get_name():
109
return random.choice(["Deadpool", "Rick", "Morty", "Hiro"])
1110

1211

12+
@app.command()
1313
def main(name: str = typer.Argument(default_factory=get_name)):
1414
print(f"Hello {name}")
1515

docs_src/arguments/default/tutorial002_an.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
app = typer.Typer()
77

88

9-
@app.command()
109
def get_name():
1110
return random.choice(["Deadpool", "Rick", "Morty", "Hiro"])
1211

1312

13+
@app.command()
1414
def main(name: Annotated[str, typer.Argument(default_factory=get_name)]):
1515
print(f"Hello {name}")
1616

tests/test_completion/test_completion_install.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@
55
from unittest import mock
66

77
import shellingham
8-
import typer
98
from typer.testing import CliRunner
109

1110
from docs_src.typer_app import tutorial001 as mod
1211

1312
from ..utils import requires_completion_permission
1413

1514
runner = CliRunner()
16-
app = typer.Typer()
17-
app.command()(mod.main)
15+
app = mod.app
1816

1917

2018
@requires_completion_permission

tests/test_completion/test_completion_show.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44
from unittest import mock
55

66
import shellingham
7-
import typer
87
from typer.testing import CliRunner
98

109
from docs_src.typer_app import tutorial001 as mod
1110

1211
runner = CliRunner()
13-
app = typer.Typer()
14-
app.command()(mod.main)
12+
app = mod.app
1513

1614

1715
def test_completion_show_no_shell():

tests/test_tracebacks.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ def test_traceback_no_rich():
1010
[sys.executable, "-m", "coverage", "run", str(file_path)],
1111
capture_output=True,
1212
encoding="utf-8",
13-
env={**os.environ, "_TYPER_STANDARD_TRACEBACK": ""},
13+
env={
14+
**os.environ,
15+
"TYPER_STANDARD_TRACEBACK": "",
16+
"_TYPER_STANDARD_TRACEBACK": "",
17+
},
1418
)
1519
assert "return get_command(self)(*args, **kwargs)" not in result.stderr
1620

@@ -25,7 +29,11 @@ def test_traceback_no_rich_short_disable():
2529
[sys.executable, "-m", "coverage", "run", str(file_path)],
2630
capture_output=True,
2731
encoding="utf-8",
28-
env={**os.environ, "_TYPER_STANDARD_TRACEBACK": ""},
32+
env={
33+
**os.environ,
34+
"TYPER_STANDARD_TRACEBACK": "",
35+
"_TYPER_STANDARD_TRACEBACK": "",
36+
},
2937
)
3038
assert "return get_command(self)(*args, **kwargs)" not in result.stderr
3139

@@ -40,7 +48,11 @@ def test_unmodified_traceback():
4048
[sys.executable, "-m", "coverage", "run", str(file_path)],
4149
capture_output=True,
4250
encoding="utf-8",
43-
env={**os.environ, "_TYPER_STANDARD_TRACEBACK": ""},
51+
env={
52+
**os.environ,
53+
"TYPER_STANDARD_TRACEBACK": "",
54+
"_TYPER_STANDARD_TRACEBACK": "",
55+
},
4456
)
4557
assert "morty" in result.stdout, "the call to the first app should work normally"
4658
assert "return callback(**use_params)" in result.stderr, (

tests/test_tutorial/test_arguments/test_default/test_tutorial001.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import subprocess
22
import sys
33

4-
import typer
54
from typer.testing import CliRunner
65

76
from docs_src.arguments.default import tutorial001 as mod
87

98
runner = CliRunner()
109

11-
app = typer.Typer()
12-
app.command()(mod.main)
10+
app = mod.app
1311

1412

1513
def test_help():

0 commit comments

Comments
 (0)