Skip to content

Commit e84a2ec

Browse files
authored
Merge branch 'master' into dependabot/github_actions/actions/download-artifact-7
2 parents d25d376 + 65133a2 commit e84a2ec

648 files changed

Lines changed: 4593 additions & 4392 deletions

File tree

Some content is hidden

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

.github/workflows/pre-commit.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
9+
env:
10+
# Forks and Dependabot don't have access to secrets
11+
HAS_SECRETS: ${{ secrets.PRE_COMMIT != '' }}
12+
13+
jobs:
14+
pre-commit:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Dump GitHub context
18+
env:
19+
GITHUB_CONTEXT: ${{ toJson(github) }}
20+
run: echo "$GITHUB_CONTEXT"
21+
- uses: actions/checkout@v5
22+
name: Checkout PR for own repo
23+
if: env.HAS_SECRETS == 'true'
24+
with:
25+
# To be able to commit it needs to fetch the head of the branch, not the
26+
# merge commit
27+
ref: ${{ github.head_ref }}
28+
# And it needs the full history to be able to compute diffs
29+
fetch-depth: 0
30+
# A token other than the default GITHUB_TOKEN is needed to be able to trigger CI
31+
token: ${{ secrets.PRE_COMMIT }}
32+
# pre-commit lite ci needs the default checkout configs to work
33+
- uses: actions/checkout@v5
34+
name: Checkout PR for fork
35+
if: env.HAS_SECRETS == 'false'
36+
with:
37+
# To be able to commit it needs the head branch of the PR, the remote one
38+
ref: ${{ github.event.pull_request.head.sha }}
39+
fetch-depth: 0
40+
- name: Set up Python
41+
uses: actions/setup-python@v6
42+
with:
43+
python-version: "3.14"
44+
- name: Setup uv
45+
uses: astral-sh/setup-uv@v7
46+
with:
47+
cache-dependency-glob: |
48+
requirements**.txt
49+
pyproject.toml
50+
uv.lock
51+
- name: Install Dependencies
52+
run: |
53+
uv venv
54+
uv pip install -r requirements.txt
55+
- name: Run prek - pre-commit
56+
id: precommit
57+
run: uvx prek run --from-ref origin/${GITHUB_BASE_REF} --to-ref HEAD --show-diff-on-failure
58+
continue-on-error: true
59+
- name: Commit and push changes
60+
if: env.HAS_SECRETS == 'true'
61+
run: |
62+
git config user.name "github-actions[bot]"
63+
git config user.email "github-actions[bot]@users.noreply.github.com"
64+
git add -A
65+
if git diff --staged --quiet; then
66+
echo "No changes to commit"
67+
else
68+
git commit -m "🎨 Auto format"
69+
git push
70+
fi
71+
- uses: pre-commit-ci/[email protected]
72+
if: env.HAS_SECRETS == 'false'
73+
with:
74+
msg: 🎨 Auto format
75+
- name: Error out on pre-commit errors
76+
if: steps.precommit.outcome == 'failure'
77+
run: exit 1
78+
79+
# https://github.com/marketplace/actions/alls-green#why
80+
pre-commit-alls-green: # This job does nothing and is only used for the branch protection
81+
if: always()
82+
needs:
83+
- pre-commit
84+
runs-on: ubuntu-latest
85+
steps:
86+
- name: Dump GitHub context
87+
env:
88+
GITHUB_CONTEXT: ${{ toJson(github) }}
89+
run: echo "$GITHUB_CONTEXT"
90+
- name: Decide whether the needed jobs succeeded or failed
91+
uses: re-actors/alls-green@release/v1
92+
with:
93+
jobs: ${{ toJSON(needs) }}

.github/workflows/smokeshow.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ env:
1515

1616
jobs:
1717
smokeshow:
18-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1918
runs-on: ubuntu-latest
2019
steps:
2120
- name: Dump GitHub context
@@ -25,12 +24,10 @@ jobs:
2524
- uses: actions/checkout@v6
2625
- uses: actions/setup-python@v6
2726
with:
28-
python-version: '3.9'
27+
python-version: '3.13'
2928
- name: Setup uv
3029
uses: astral-sh/setup-uv@v7
3130
with:
32-
version: "0.4.15"
33-
enable-cache: true
3431
cache-dependency-glob: |
3532
requirements**.txt
3633
pyproject.toml

.github/workflows/test.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ jobs:
2222
os: [ ubuntu-latest, windows-latest, macos-latest ]
2323
python-version: [ "3.14" ]
2424
include:
25-
- os: macos-latest
26-
python-version: "3.8"
2725
- os: windows-latest
2826
python-version: "3.9"
2927
- os: ubuntu-latest
@@ -57,7 +55,7 @@ jobs:
5755
- name: Install Dependencies
5856
run: uv pip install -r requirements-tests.txt
5957
- name: Lint
60-
if: matrix.python-version != '3.7' && matrix.python-version != '3.8' && matrix.python-version != '3.9'
58+
if: matrix.python-version != '3.9'
6159
run: bash scripts/lint.sh
6260
- run: mkdir coverage
6361
- run: bash ./scripts/test-files.sh
@@ -84,7 +82,7 @@ jobs:
8482
- uses: actions/checkout@v6
8583
- uses: actions/setup-python@v6
8684
with:
87-
python-version: '3.8'
85+
python-version: '3.13'
8886
- name: Setup uv
8987
uses: astral-sh/setup-uv@v7
9088
with:
@@ -103,14 +101,14 @@ jobs:
103101
run: uv pip install -r requirements-tests.txt
104102
- run: ls -la coverage
105103
- run: coverage combine coverage
106-
- run: coverage report
107104
- run: coverage html --show-contexts --title "Coverage for ${{ github.sha }}"
108105
- name: Store coverage HTML
109106
uses: actions/upload-artifact@v5
110107
with:
111108
name: coverage-html
112109
path: htmlcov
113110
include-hidden-files: true
111+
- run: coverage report --fail-under=100
114112

115113
# https://github.com/marketplace/actions/alls-green#why
116114
check: # This job does nothing and is only used for the branch protection

.pre-commit-config.yaml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
3-
default_language_version:
4-
python: python3.10
53
repos:
64
- repo: https://github.com/pre-commit/pre-commit-hooks
75
rev: v6.0.0
86
hooks:
9-
- id: check-added-large-files
10-
- id: check-toml
11-
- id: check-yaml
7+
- id: check-added-large-files
8+
- id: check-toml
9+
- id: check-yaml
1210
args:
1311
- --unsafe
14-
- id: end-of-file-fixer
15-
- id: trailing-whitespace
16-
- repo: https://github.com/astral-sh/ruff-pre-commit
17-
rev: v0.14.8
12+
- id: end-of-file-fixer
13+
- id: trailing-whitespace
14+
15+
- repo: local
1816
hooks:
19-
- id: ruff
20-
args:
21-
- --fix
22-
- id: ruff-format
23-
ci:
24-
autofix_commit_msg: 🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
25-
autoupdate_commit_msg: ⬆ [pre-commit.ci] pre-commit autoupdate
17+
- id: local-ruff-check
18+
name: ruff check
19+
entry: uv run ruff check --force-exclude --fix --exit-non-zero-on-fix
20+
require_serial: true
21+
language: unsupported
22+
types: [python]
23+
24+
- id: local-ruff-format
25+
name: ruff format
26+
entry: uv run ruff format --force-exclude --exit-non-zero-on-format
27+
require_serial: true
28+
language: unsupported
29+
types: [python]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<em>Typer, build great CLIs. Easy to code. Based on Python type hints.</em>
77
</p>
88
<p align="center">
9-
<a href="https://github.com/fastapi/typer/actions?query=workflow%3ATest" target="_blank">
10-
<img src="https://github.com/fastapi/typer/workflows/Test/badge.svg" alt="Test">
9+
<a href="https://github.com/fastapi/typer/actions?query=workflow%3ATest+event%3Apush+branch%3Amaster" target="_blank">
10+
<img src="https://github.com/fastapi/typer/actions/workflows/test.yml/badge.svg?event=push&branch=master" alt="Test">
1111
</a>
1212
<a href="https://github.com/fastapi/typer/actions?query=workflow%3APublish" target="_blank">
1313
<img src="https://github.com/fastapi/typer/workflows/Publish/badge.svg" alt="Publish">

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
<em>Typer, build great CLIs. Easy to code. Based on Python type hints.</em>
1313
</p>
1414
<p align="center">
15-
<a href="https://github.com/fastapi/typer/actions?query=workflow%3ATest" target="_blank">
16-
<img src="https://github.com/fastapi/typer/workflows/Test/badge.svg" alt="Test">
15+
<a href="https://github.com/fastapi/typer/actions?query=workflow%3ATest+event%3Apush+branch%3Amaster" target="_blank">
16+
<img src="https://github.com/fastapi/typer/actions/workflows/test.yml/badge.svg?event=push&branch=master" alt="Test">
1717
</a>
1818
<a href="https://github.com/fastapi/typer/actions?query=workflow%3APublish" target="_blank">
1919
<img src="https://github.com/fastapi/typer/workflows/Publish/badge.svg" alt="Publish">

docs/management-tasks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ A PR should have a specific use case that it is solving.
9090
* If the PR is for a feature, it should have docs.
9191
* Unless it's a feature we want to discourage, like support for a corner case that we don't want users to use.
9292
* The docs should include a source example file, not write Python directly in Markdown.
93-
* If the source example(s) file can have different syntax for Python 3.8, 3.9, 3.10, there should be different versions of the file, and they should be shown in tabs in the docs.
93+
* If the source example(s) file can have different syntax for Python different Python versions, there should be different versions of the file, and they should be shown in tabs in the docs.
9494
* There should be tests testing the source example.
9595
* Before the PR is applied, the new tests should fail.
9696
* After applying the PR, the new tests should pass.

docs/release-notes.md

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

33
## Latest Changes
44

5+
### Internal
6+
7+
* 👷 Update secrets check. PR [#1471](https://github.com/fastapi/typer/pull/1471) by [@YuriiMotov](https://github.com/YuriiMotov).
8+
* ✅ Add missing tests for code examples. PR [#1465](https://github.com/fastapi/typer/pull/1465) by [@YuriiMotov](https://github.com/YuriiMotov).
9+
* 🔧 Update pre-commit to use local Ruff instead of hook, unpin `prek`. PR [#1466](https://github.com/fastapi/typer/pull/1466) by [@YuriiMotov](https://github.com/YuriiMotov).
10+
* ⬆ Bump mypy from 1.14.1 to 1.18.2. PR [#1382](https://github.com/fastapi/typer/pull/1382) by [@dependabot[bot]](https://github.com/apps/dependabot).
11+
12+
## 0.21.0
13+
14+
### Breaking Changes
15+
16+
* ➖ Drop support for Python 3.8. PR [#1464](https://github.com/fastapi/typer/pull/1464) by [@tiangolo](https://github.com/tiangolo).
17+
* ➖ Drop support for Python 3.8 in CI. PR [#1463](https://github.com/fastapi/typer/pull/1463) by [@YuriiMotov](https://github.com/YuriiMotov) and [@tiangolo](https://github.com/tiangolo).
18+
19+
### Docs
20+
21+
* 📝 Update code examples to Python 3.9. PR [#1459](https://github.com/fastapi/typer/pull/1459) by [@YuriiMotov](https://github.com/YuriiMotov).
22+
23+
### Internal
24+
25+
* 💚 Move `ruff` dependency to shared `requirements-docs-tests.txt` to fix "Build docs" workflow in CI. PR [#1458](https://github.com/fastapi/typer/pull/1458) by [@YuriiMotov](https://github.com/YuriiMotov).
26+
* ⬆ Bump markdown-include-variants from 0.0.5 to 0.0.8. PR [#1442](https://github.com/fastapi/typer/pull/1442) by [@dependabot[bot]](https://github.com/apps/dependabot).
27+
* 👷 Add pre-commit workflow. PR [#1453](https://github.com/fastapi/typer/pull/1453) by [@tiangolo](https://github.com/tiangolo).
28+
* 👷 Configure coverage, error on main tests, don't wait for Smokeshow. PR [#1448](https://github.com/fastapi/typer/pull/1448) by [@YuriiMotov](https://github.com/YuriiMotov).
29+
* 👷 Run Smokeshow always, even on test failures. PR [#1447](https://github.com/fastapi/typer/pull/1447) by [@YuriiMotov](https://github.com/YuriiMotov).
30+
* 🔨 Add Typer script to generate example variants for Python files. PR [#1452](https://github.com/fastapi/typer/pull/1452) by [@tiangolo](https://github.com/tiangolo).
31+
32+
## 0.20.1
33+
534
### Features
635

736
* ✨ 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).
837

38+
### Fixes
39+
40+
* 🐛 Ensure that `options_metavar` is passed through correctly. PR [#816](https://github.com/fastapi/typer/pull/816) by [@gar1t](https://github.com/gar1t).
41+
* 🐛 Ensure an optional argument is shown in brackets, even when `metavar` is set. PR [#1409](https://github.com/fastapi/typer/pull/1409) by [@svlandeg](https://github.com/svlandeg).
42+
* 🐛 Ensure that the default `rich_markup_mode` is interpreted correctly. PR [#1304](https://github.com/fastapi/typer/pull/1304) by [@svlandeg](https://github.com/svlandeg).
43+
44+
### Refactors
45+
46+
* ♻️ Refactor the handling of `shellingham`. PR [#1347](https://github.com/fastapi/typer/pull/1347) by [@nathanjmcdougall](https://github.com/nathanjmcdougall).
47+
948
### Docs
1049

50+
* 📝 Ensure that bold letters are rendered correctly in `printing.md`. PR [#1365](https://github.com/fastapi/typer/pull/1365) by [@svlandeg](https://github.com/svlandeg).
51+
* 🩺 Update test badge to only reflect pushes to `master`. PR [#1414](https://github.com/fastapi/typer/pull/1414) by [@svlandeg](https://github.com/svlandeg).
1152
* 📝 Update console output on the Rich help formatting page. PR [#1430](https://github.com/fastapi/typer/pull/1430) by [@svlandeg](https://github.com/svlandeg).
1253
* 📝 Update emoji used in Rich help formatting tutorial. PR [#1429](https://github.com/fastapi/typer/pull/1429) by [@svlandeg](https://github.com/svlandeg).
1354
* 📝 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).
@@ -16,6 +57,7 @@
1657

1758
### Internal
1859

60+
* 🔨 Add `--showlocals` to `test.sh`. PR [#1169](https://github.com/fastapi/typer/pull/1169) by [@rickwporter](https://github.com/rickwporter).
1961
* ⬆ Bump ruff from 0.14.6 to 0.14.8. PR [#1436](https://github.com/fastapi/typer/pull/1436) by [@dependabot[bot]](https://github.com/apps/dependabot).
2062
*[pre-commit.ci] pre-commit autoupdate. PR [#1434](https://github.com/fastapi/typer/pull/1434) by [@pre-commit-ci[bot]](https://github.com/apps/pre-commit-ci).
2163
* ✅ Update tests to use `mod.app` . PR [#1427](https://github.com/fastapi/typer/pull/1427) by [@svlandeg](https://github.com/svlandeg).

docs/tutorial/app-dir.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
You can get the application directory where you can, for example, save configuration files with `typer.get_app_dir()`:
44

5-
{* docs_src/app_dir/tutorial001.py hl[12] *}
5+
{* docs_src/app_dir/tutorial001_py39.py hl[12] *}
66

77
It will give you a directory for storing configurations appropriate for your CLI program for the current user in each operating system.
88

docs/tutorial/arguments/default.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ That way the *CLI argument* will be optional *and also* have a default value.
88

99
We can also use `typer.Argument()` to make a *CLI argument* have a default value other than `None`:
1010

11-
{* docs_src/arguments/default/tutorial001_an.py hl[8] *}
11+
{* docs_src/arguments/default/tutorial001_an_py39.py hl[9] *}
1212

1313
/// tip
1414

@@ -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[9:10,14] *}
55+
{* docs_src/arguments/default/tutorial002_an_py39.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

0 commit comments

Comments
 (0)