Skip to content

Commit 63fc320

Browse files
authored
Merge branch 'master' into kwargs-as-options
2 parents bb95baa + 6382ee2 commit 63fc320

677 files changed

Lines changed: 8324 additions & 5234 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/DISCUSSION_TEMPLATE/questions.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,15 @@ body:
6464
placeholder: |
6565
import typer
6666
67+
app = typer.Typer()
6768
69+
@app.command()
6870
def main(name: str):
6971
typer.echo(f"Hello {name}")
7072
7173
7274
if __name__ == "__main__":
73-
typer.run(main)
75+
app()
7476
render: python
7577
validations:
7678
required: true

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ updates:
88
commit-message:
99
prefix:
1010
# Python
11-
- package-ecosystem: "pip"
11+
- package-ecosystem: "uv"
1212
directory: "/"
1313
schedule:
1414
interval: "daily"

.github/workflows/build-docs.yml

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ on:
88
- opened
99
- synchronize
1010

11-
env:
12-
UV_SYSTEM_PYTHON: 1
13-
1411
jobs:
1512
changes:
1613
runs-on: ubuntu-latest
@@ -21,7 +18,7 @@ jobs:
2118
outputs:
2219
docs: ${{ steps.filter.outputs.docs }}
2320
steps:
24-
- uses: actions/checkout@v5
21+
- uses: actions/checkout@v6
2522
# For pull requests it's not necessary to checkout the code but for the main branch it is
2623
- uses: dorny/paths-filter@v3
2724
id: filter
@@ -31,13 +28,10 @@ jobs:
3128
- README.md
3229
- docs/**
3330
- docs_src/**
34-
- requirements-docs.txt
35-
- requirements-docs-insiders.txt
3631
- pyproject.toml
32+
- uv.lock
3733
- mkdocs.yml
38-
- mkdocs.insiders.yml
39-
- mkdocs.maybe-insiders.yml
40-
- mkdocs.no-insiders.yml
34+
- mkdocs.env.yml
4135
- .github/workflows/build-docs.yml
4236
- .github/workflows/deploy-docs.yml
4337
- data/**
@@ -52,35 +46,29 @@ jobs:
5246
env:
5347
GITHUB_CONTEXT: ${{ toJson(github) }}
5448
run: echo "$GITHUB_CONTEXT"
55-
- uses: actions/checkout@v5
49+
- uses: actions/checkout@v6
5650
- name: Set up Python
5751
uses: actions/setup-python@v6
5852
with:
59-
python-version: "3.11"
53+
python-version-file: ".python-version"
6054
- name: Setup uv
61-
uses: astral-sh/setup-uv@v6
55+
uses: astral-sh/setup-uv@v7
6256
with:
63-
version: "0.4.15"
6457
enable-cache: true
6558
cache-dependency-glob: |
66-
requirements**.txt
6759
pyproject.toml
60+
uv.lock
6861
- name: Install docs extras
69-
run: uv pip install -r requirements-docs.txt
70-
- name: Install Material for MkDocs Insiders
71-
if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' )
72-
run: uv pip install -r requirements-docs-insiders.txt
73-
env:
74-
TOKEN: ${{ secrets.TYPER_MKDOCS_MATERIAL_INSIDERS }}
75-
- uses: actions/cache@v4
62+
run: uv sync --locked --no-dev --group docs
63+
- uses: actions/cache@v5
7664
with:
7765
key: mkdocs-cards-${{ github.ref }}-v1
7866
path: .cache
7967
- name: Verify README
80-
run: python ./scripts/docs.py verify-readme
68+
run: uv run ./scripts/docs.py verify-readme
8169
- name: Build Docs
82-
run: python ./scripts/docs.py build
83-
- uses: actions/upload-artifact@v4
70+
run: uv run ./scripts/docs.py build
71+
- uses: actions/upload-artifact@v6
8472
with:
8573
name: docs-site
8674
path: ./site/**

.github/workflows/deploy-docs.yml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ permissions:
1212
pull-requests: write
1313
statuses: write
1414

15-
env:
16-
UV_SYSTEM_PYTHON: 1
17-
1815
jobs:
1916
deploy-docs:
2017
runs-on: ubuntu-latest
@@ -23,33 +20,32 @@ jobs:
2320
env:
2421
GITHUB_CONTEXT: ${{ toJson(github) }}
2522
run: echo "$GITHUB_CONTEXT"
26-
- uses: actions/checkout@v5
23+
- uses: actions/checkout@v6
2724
- name: Set up Python
2825
uses: actions/setup-python@v6
2926
with:
30-
python-version: "3.11"
27+
python-version-file: ".python-version"
3128
- name: Setup uv
32-
uses: astral-sh/setup-uv@v6
29+
uses: astral-sh/setup-uv@v7
3330
with:
34-
version: "0.4.15"
3531
enable-cache: true
3632
cache-dependency-glob: |
37-
requirements**.txt
3833
pyproject.toml
34+
uv.lock
3935
- name: Install GitHub Actions dependencies
40-
run: uv pip install -r requirements-github-actions.txt
36+
run: uv sync --locked --no-dev --group github-actions
4137
- name: Deploy Docs Status Pending
42-
run: python ./scripts/deploy_docs_status.py
38+
run: uv run ./scripts/deploy_docs_status.py
4339
env:
4440
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4541
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
4642
RUN_ID: ${{ github.run_id }}
47-
43+
STATE: "pending"
4844
- name: Clean site
4945
run: |
5046
rm -rf ./site
5147
mkdir ./site
52-
- uses: actions/download-artifact@v5
48+
- uses: actions/download-artifact@v7
5349
with:
5450
path: ./site/
5551
pattern: docs-site
@@ -68,11 +64,19 @@ jobs:
6864
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
6965
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
7066
command: pages deploy ./site --project-name=${{ env.PROJECT_NAME }} --branch=${{ env.BRANCH }}
67+
- name: Deploy Docs Status Error
68+
if: failure()
69+
run: uv run ./scripts/deploy_docs_status.py
70+
env:
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
73+
RUN_ID: ${{ github.run_id }}
74+
STATE: "error"
7175
- name: Comment Deploy
72-
run: python ./scripts/deploy_docs_status.py
76+
run: uv run ./scripts/deploy_docs_status.py
7377
env:
7478
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7579
DEPLOY_URL: ${{ steps.deploy.outputs.deployment-url }}
7680
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
7781
RUN_ID: ${{ github.run_id }}
78-
IS_DONE: "true"
82+
STATE: "success"

.github/workflows/issue-manager.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
env:
2828
GITHUB_CONTEXT: ${{ toJson(github) }}
2929
run: echo "$GITHUB_CONTEXT"
30-
- uses: tiangolo/issue-manager@0.5.1
30+
- uses: tiangolo/issue-manager@0.6.0
3131
with:
3232
token: ${{ secrets.GITHUB_TOKEN }}
3333
config: >
@@ -38,6 +38,10 @@ jobs:
3838
},
3939
"waiting": {
4040
"delay": 2628000,
41-
"message": "As this PR has been waiting for the original user for a while but seems to be inactive, it's now going to be closed. But if there's anyone interested, feel free to create a new PR."
41+
"message": "As this PR has been waiting for the original user for a while but seems to be inactive, it's now going to be closed. But if there's anyone interested, feel free to create a new PR.",
42+
"reminder": {
43+
"before": "P3D",
44+
"message": "Heads-up: this will be closed in 3 days unless there’s new activity."
45+
}
4246
}
4347
}

.github/workflows/latest-changes.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
env:
2525
GITHUB_CONTEXT: ${{ toJson(github) }}
2626
run: echo "$GITHUB_CONTEXT"
27-
- uses: actions/checkout@v5
27+
- uses: actions/checkout@v6
2828
with:
2929
# To allow latest-changes to commit to the main branch
3030
token: ${{ secrets.TYPER_LATEST_CHANGES }}
@@ -34,7 +34,7 @@ jobs:
3434
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
3535
with:
3636
limit-access-to-actor: true
37-
- uses: tiangolo/latest-changes@0.4.0
37+
- uses: tiangolo/latest-changes@0.4.1
3838
with:
3939
token: ${{ secrets.GITHUB_TOKEN }}
4040
latest_changes_file: docs/release-notes.md

.github/workflows/pre-commit.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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@v6
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@v6
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-file: ".python-version"
44+
- name: Setup uv
45+
uses: astral-sh/setup-uv@v7
46+
with:
47+
cache-dependency-glob: |
48+
pyproject.toml
49+
uv.lock
50+
- name: Install Dependencies
51+
run: uv sync --locked
52+
- name: Run prek - pre-commit
53+
id: precommit
54+
run: uvx prek run --from-ref origin/${GITHUB_BASE_REF} --to-ref HEAD --show-diff-on-failure
55+
continue-on-error: true
56+
- name: Commit and push changes
57+
if: env.HAS_SECRETS == 'true'
58+
run: |
59+
git config user.name "github-actions[bot]"
60+
git config user.email "github-actions[bot]@users.noreply.github.com"
61+
git add -A
62+
if git diff --staged --quiet; then
63+
echo "No changes to commit"
64+
else
65+
git commit -m "🎨 Auto format"
66+
git push
67+
fi
68+
- uses: pre-commit-ci/lite-action@v1.1.0
69+
if: env.HAS_SECRETS == 'false'
70+
with:
71+
msg: 🎨 Auto format
72+
- name: Error out on pre-commit errors
73+
if: steps.precommit.outcome == 'failure'
74+
run: exit 1
75+
76+
# https://github.com/marketplace/actions/alls-green#why
77+
pre-commit-alls-green: # This job does nothing and is only used for the branch protection
78+
if: always()
79+
needs:
80+
- pre-commit
81+
runs-on: ubuntu-latest
82+
steps:
83+
- name: Dump GitHub context
84+
env:
85+
GITHUB_CONTEXT: ${{ toJson(github) }}
86+
run: echo "$GITHUB_CONTEXT"
87+
- name: Decide whether the needed jobs succeeded or failed
88+
uses: re-actors/alls-green@release/v1
89+
with:
90+
jobs: ${{ toJSON(needs) }}

.github/workflows/publish.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,22 @@ jobs:
1616
- typer-cli
1717
permissions:
1818
id-token: write
19+
contents: read
1920
steps:
2021
- name: Dump GitHub context
2122
env:
2223
GITHUB_CONTEXT: ${{ toJson(github) }}
2324
run: echo "$GITHUB_CONTEXT"
24-
- uses: actions/checkout@v5
25+
- uses: actions/checkout@v6
2526
- name: Set up Python
2627
uses: actions/setup-python@v6
2728
with:
28-
python-version: "3.10"
29-
# Issue ref: https://github.com/actions/setup-python/issues/436
30-
# cache: "pip"
31-
# cache-dependency-path: pyproject.toml
32-
- name: Install build dependencies
33-
run: pip install build
29+
python-version-file: ".python-version"
30+
- name: Install uv
31+
uses: astral-sh/setup-uv@v7
3432
- name: Build distribution
33+
run: uv build
3534
env:
3635
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
37-
run: python -m build
3836
- name: Publish
39-
uses: pypa/gh-action-pypi-publish@v1.13.0
37+
run: uv publish

.github/workflows/smokeshow.yml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,32 @@ on:
1010
permissions:
1111
statuses: write
1212

13-
env:
14-
UV_SYSTEM_PYTHON: 1
15-
1613
jobs:
1714
smokeshow:
18-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1915
runs-on: ubuntu-latest
2016
steps:
2117
- name: Dump GitHub context
2218
env:
2319
GITHUB_CONTEXT: ${{ toJson(github) }}
2420
run: echo "$GITHUB_CONTEXT"
25-
- uses: actions/checkout@v5
21+
- uses: actions/checkout@v6
2622
- uses: actions/setup-python@v6
2723
with:
28-
python-version: '3.9'
24+
python-version-file: ".python-version"
2925
- name: Setup uv
30-
uses: astral-sh/setup-uv@v6
26+
uses: astral-sh/setup-uv@v7
3127
with:
32-
version: "0.4.15"
33-
enable-cache: true
3428
cache-dependency-glob: |
35-
requirements**.txt
3629
pyproject.toml
37-
- run: uv pip install -r requirements-github-actions.txt
38-
- uses: actions/download-artifact@v5
30+
uv.lock
31+
- run: uv sync --locked --no-dev --group github-actions
32+
- uses: actions/download-artifact@v7
3933
with:
4034
name: coverage-html
4135
path: htmlcov
4236
github-token: ${{ secrets.GITHUB_TOKEN }}
4337
run-id: ${{ github.event.workflow_run.id }}
44-
- run: smokeshow upload htmlcov
38+
- run: uv run smokeshow upload htmlcov
4539
env:
4640
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
4741
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 100

0 commit comments

Comments
 (0)