Skip to content

Commit

Permalink
Merge branch 'master' into support_literal_choices
Browse files Browse the repository at this point in the history
  • Loading branch information
svlandeg committed Sep 2, 2024
2 parents cb93aa4 + 5889cf8 commit 1834fb8
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 514 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0
rev: v0.6.1
hooks:
- id: ruff
args:
Expand Down
6 changes: 6 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@

* ✨ Show help items in order of definition. PR [#944](https://github.com/fastapi/typer/pull/944) by [@svlandeg](https://github.com/svlandeg).

### Refactors

* 🔥 Remove unused functionality from `_typing.py` file. PR [#805](https://github.com/fastapi/typer/pull/805) by [@ivantodorovich](https://github.com/ivantodorovich).
* ✏️ Fix typo in function name `_make_rich_text`. PR [#959](https://github.com/fastapi/typer/pull/959) by [@svlandeg](https://github.com/svlandeg).

### Internal

* ⬆ Bump ruff from 0.2.0 to 0.6.1. PR [#938](https://github.com/fastapi/typer/pull/938) by [@dependabot[bot]](https://github.com/apps/dependabot).
* 👷 Update `latest-changes` GitHub Action. PR [#955](https://github.com/fastapi/typer/pull/955) by [@tiangolo](https://github.com/tiangolo).

## 0.12.5
Expand Down
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,6 @@ ignore = [
# Loop control variable `x` not used within loop body
"docs_src/using_click/tutorial001.py" = ["B007"]

# TODO: refactor _typing.py, remove unnecessary code
"typer/_typing.py" = ["UP036", "F822"]

[tool.ruff.lint.isort]
known-third-party = ["typer", "click"]
# For docs_src/subcommands/tutorial003/
Expand Down
2 changes: 1 addition & 1 deletion requirements-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ coverage[toml] >=6.2,<8.0
pytest-xdist >=1.32.0,<4.0.0
pytest-sugar >=0.9.4,<1.1.0
mypy ==1.4.1
ruff ==0.2.0
ruff ==0.6.1
# Needed explicitly by typer-slim
rich >=10.11.0
shellingham >=1.3.0
15 changes: 5 additions & 10 deletions tests/test_ambiguous_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ def test_forbid_default_value_in_annotated_argument():
# This test case only works with `typer.Argument`. `typer.Option` uses positionals
# for param_decls too.
@app.command()
def cmd(my_param: Annotated[str, typer.Argument("foo")]):
... # pragma: no cover
def cmd(my_param: Annotated[str, typer.Argument("foo")]): ... # pragma: no cover

with pytest.raises(AnnotatedParamWithDefaultValueError) as excinfo:
runner.invoke(app)
Expand Down Expand Up @@ -64,8 +63,7 @@ def test_forbid_annotated_param_and_default_param(param, param_info_type):
app = typer.Typer()

@app.command()
def cmd(my_param: Annotated[str, param()] = param("foo")):
... # pragma: no cover
def cmd(my_param: Annotated[str, param()] = param("foo")): ... # pragma: no cover

with pytest.raises(MixedAnnotatedAndDefaultStyleError) as excinfo:
runner.invoke(app)
Expand All @@ -83,8 +81,7 @@ def test_forbid_multiple_typer_params_in_annotated():
@app.command()
def cmd(
my_param: Annotated[str, typer.Argument(), typer.Argument()],
):
... # pragma: no cover
): ... # pragma: no cover

with pytest.raises(MultipleTyperAnnotationsError) as excinfo:
runner.invoke(app)
Expand Down Expand Up @@ -121,8 +118,7 @@ def make_string():
@app.command()
def cmd(
my_param: Annotated[str, param(default_factory=make_string)] = "hello",
):
... # pragma: no cover
): ... # pragma: no cover

with pytest.raises(DefaultFactoryAndDefaultValueError) as excinfo:
runner.invoke(app)
Expand Down Expand Up @@ -171,8 +167,7 @@ def make_string():
@app.command()
def cmd(
my_param: str = param("hi", default_factory=make_string),
):
... # pragma: no cover
): ... # pragma: no cover

with pytest.raises(DefaultFactoryAndDefaultValueError) as excinfo:
runner.invoke(app)
Expand Down
Loading

0 comments on commit 1834fb8

Please sign in to comment.