Skip to content

Commit 5b4dd5c

Browse files
committed
🐛 fix: fix some issues with Typer config and code
1 parent 2c13416 commit 5b4dd5c

4 files changed

Lines changed: 14 additions & 9 deletions

File tree

copier.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ project_name:
1313
help: What is your project name?
1414
validator: >-
1515
{% if not (project_name | regex_search('^[a-z][a-z0-9\-]+$')) %}
16-
project_name must start with a letter, followed by one or more letters,
16+
Project name must start with a letter, followed by one or more letters,
1717
digits or dashes all lowercase.
1818
{% endif %}
1919
@@ -130,8 +130,8 @@ cli_name:
130130
help: Set the CLI's name
131131
default: "{{ project_name }}"
132132
validator: >-
133-
{% if not (project_name | regex_search('^[a-z][a-z0-9\-]+$')) %}
134-
project_name must start with a letter, followed by one or more letters,
133+
{% if not (cli_name | regex_search('^[a-z][a-z0-9\-]+$')) %}
134+
The CLI's name must start with a letter, followed by one or more letters,
135135
digits or dashes all lowercase.
136136
{% endif %}
137137

template/pyproject.toml.jinja

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ classifiers = [
2929
{%- endfor %}
3030
"Topic :: Software Development :: Libraries :: Python Modules",
3131
]
32+
dependencies = [
33+
{%- if with_typer_cli %}
34+
"typer>=0.15.2",
35+
{%- endif %}
36+
]
3237

3338
{% if repository_provider == 'github' -%}
3439
[project.urls]
@@ -37,7 +42,6 @@ Repository = "{{ repository }}"
3742
Documentation = "{{ documentation }}"
3843
{%- endif %}
3944

40-
4145
{% if with_typer_cli -%}
4246
[project.scripts]
4347
{{ cli_name }} = "{{ project_slug }}.cli.main:app"
@@ -71,7 +75,7 @@ name = "cz_gitmoji"
7175
{%- else %}
7276
name = "cz_conventional_commits"
7377
{%- endif %}
74-
version_files = ["src/{{ project_slug }}/__version__.py"{% if dockerfile %}", compose.yaml"{% endif %}]
78+
version_files = ["src/{{ project_slug }}/__version__.py"{% if dockerfile %}, "compose.yaml"{% endif %}]
7579
tag_format = "$version"
7680
version_scheme = "pep440"
7781
version_provider = "uv"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import typer
12
from rich import print as rprint
2-
from typer import Typer
33

44
from {{ project_slug }} import __version__
55

66
app = typer.Typer()
77

8+
89
@app.command(rich_help_panel="Help and Others", help="Show the CLI's version.")
910
def version() -> None:
1011
rprint(f"{{ cli_name }} Version: [green]{__version__}[/green]")

template/src/{{project_slug}}/{% if with_typer_cli %}cli{% endif %}/main.py.jinja

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from typing import Annotated
22

33
from rich import print as rprint
4-
from typer import Typer
4+
import typer
55

66
from {{ project_slug }} import __version__
77
from {{ project_slug }}.cli.commands import version
@@ -10,7 +10,7 @@ app = typer.Typer(
1010
help="{{ cli_name }} CLI.",
1111
no_args_is_help=True,
1212
rich_markup_mode="rich",
13-
# epilog="Made with [red]:heart:[/red] by [bold]Bassem Karoui[/bold]",
13+
# epilog="Made with [red]:heart:[/red] by [bold]{{ author_fullname }}[/bold]",
1414
# pretty_exceptions_show_locals=False,
1515
)
1616

@@ -24,4 +24,4 @@ def callback(
2424
raise typer.Exit()
2525

2626

27-
app.add_typer(version.app, help="Show the CLI's version.")
27+
app.add_typer(version.app)

0 commit comments

Comments
 (0)