Skip to content

Commit 7015323

Browse files
committed
📝 Update release notes
1 parent 35bad6a commit 7015323

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

docs/release-notes.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,58 @@
66

77
* 🔥 Remove auto naming of groups added via `add_typer` based on the group's callback function name. PR [#1052](https://github.com/fastapi/typer/pull/1052) by [@patrick91](https://github.com/patrick91).
88

9+
Before, it was supported to infer the name of a command group from the callback function name in the sub-app, so, in this code:
10+
11+
```python
12+
import typer
13+
14+
app = typer.Typer()
15+
users_app = typer.Typer()
16+
17+
app.add_typer(users_app)
18+
19+
20+
@users_app.callback()
21+
def users(): # <-- This was the inferred command group name
22+
"""
23+
Manage users in the app.
24+
"""
25+
26+
27+
@users_app.command()
28+
def create(name: str):
29+
print(f"Creating user: {name}")
30+
```
31+
32+
...the command group would be named `users`, based on the name of the function `def users()`.
33+
34+
Now you need to set it explicitly:
35+
36+
```python
37+
import typer
38+
39+
app = typer.Typer()
40+
users_app = typer.Typer()
41+
42+
app.add_typer(users_app, name="users") # <-- Explicitly set the command group name
43+
44+
45+
@users_app.callback()
46+
def users():
47+
"""
48+
Manage users in the app.
49+
"""
50+
51+
52+
@users_app.command()
53+
def create(name: str):
54+
print(f"Creating user: {name}")
55+
```
56+
57+
Updated docs [SubCommand Name and Help](https://typer.tiangolo.com/tutorial/subcommands/name-and-help/).
58+
59+
**Note**: this change will enable important features in the next release. 🤩
60+
961
### Internal
1062

1163
* ⬆ Bump pypa/gh-action-pypi-publish from 1.10.3 to 1.12.2. PR [#1043](https://github.com/fastapi/typer/pull/1043) by [@dependabot[bot]](https://github.com/apps/dependabot).

0 commit comments

Comments
 (0)