Skip to content

Commit de078a6

Browse files
committed
Merge branch 'master' into multiple-arguments-via-separated-lists
2 parents ae11002 + fda56d0 commit de078a6

File tree

117 files changed

+3395
-1693
lines changed

Some content is hidden

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

117 files changed

+3395
-1693
lines changed

.github/actions/comment-docs-preview-in-pr/Dockerfile

Lines changed: 0 additions & 7 deletions
This file was deleted.

.github/actions/comment-docs-preview-in-pr/action.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

.github/actions/comment-docs-preview-in-pr/app/main.py

Lines changed: 0 additions & 68 deletions
This file was deleted.

.github/workflows/build-docs.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
docs: ${{ steps.filter.outputs.docs }}
1919
steps:
2020
- uses: actions/checkout@v4
21-
# For pull requests it's not necessary to checkout the code but for master it is
21+
# For pull requests it's not necessary to checkout the code but for the main branch it is
2222
- uses: dorny/paths-filter@v3
2323
id: filter
2424
with:
@@ -28,9 +28,12 @@ jobs:
2828
- docs/**
2929
- docs_src/**
3030
- requirements-docs.txt
31+
- requirements-docs-insiders.txt
3132
- pyproject.toml
3233
- mkdocs.yml
3334
- mkdocs.insiders.yml
35+
- mkdocs.maybe-insiders.yml
36+
- mkdocs.no-insiders.yml
3437
- .github/workflows/build-docs.yml
3538
- .github/workflows/deploy-docs.yml
3639
@@ -49,32 +52,28 @@ jobs:
4952
uses: actions/setup-python@v5
5053
with:
5154
python-version: "3.11"
52-
- uses: actions/cache@v3
55+
- uses: actions/cache@v4
5356
id: cache
5457
with:
5558
path: ${{ env.pythonLocation }}
56-
key: ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-docs.txt') }}-v02
59+
key: ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-docs.txt', 'requirements-docs-insiders.txt') }}-v02
5760
- name: Install docs extras
5861
if: steps.cache.outputs.cache-hit != 'true'
5962
run: pip install -r requirements-docs.txt
6063
- name: Install Material for MkDocs Insiders
6164
if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' ) && steps.cache.outputs.cache-hit != 'true'
62-
run: |
63-
pip install git+https://${{ secrets.TYPER_MKDOCS_MATERIAL_INSIDERS }}@github.com/squidfunk/mkdocs-material-insiders.git
64-
pip install git+https://${{ secrets.TYPER_MKDOCS_MATERIAL_INSIDERS }}@github.com/pawamoy-insiders/griffe-typing-deprecated.git
65-
pip install git+https://${{ secrets.TYPER_MKDOCS_MATERIAL_INSIDERS }}@github.com/pawamoy-insiders/mkdocstrings-python.git
66-
- uses: actions/cache@v3
65+
run: pip install -r requirements-docs-insiders.txt
66+
env:
67+
TOKEN: ${{ secrets.TYPER_MKDOCS_MATERIAL_INSIDERS }}
68+
- uses: actions/cache@v4
6769
with:
6870
key: mkdocs-cards-${{ github.ref }}-v1
6971
path: .cache
72+
- name: Verify README
73+
run: python ./scripts/docs.py verify-readme
7074
- name: Build Docs
71-
if: github.event_name == 'pull_request' && github.secret_source != 'Actions'
72-
run: python -m mkdocs build
73-
- name: Build Docs with Insiders
74-
if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' )
75-
run: python -m mkdocs build --config-file mkdocs.insiders.yml
76-
77-
- uses: actions/upload-artifact@v3
75+
run: python ./scripts/docs.py build
76+
- uses: actions/upload-artifact@v4
7877
with:
7978
name: docs-site
8079
path: ./site/**

.github/workflows/deploy-docs.yml

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ on:
66
types:
77
- completed
88

9+
permissions:
10+
deployments: write
11+
issues: write
12+
pull-requests: write
13+
statuses: write
14+
915
jobs:
1016
deploy-docs:
1117
runs-on: ubuntu-latest
@@ -15,22 +21,39 @@ jobs:
1521
GITHUB_CONTEXT: ${{ toJson(github) }}
1622
run: echo "$GITHUB_CONTEXT"
1723
- uses: actions/checkout@v4
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.11"
28+
- uses: actions/cache@v4
29+
id: cache
30+
with:
31+
path: ${{ env.pythonLocation }}
32+
key: ${{ runner.os }}-python-github-actions-${{ env.pythonLocation }}-${{ hashFiles('requirements-github-actions.txt') }}-v01
33+
- name: Install GitHub Actions dependencies
34+
if: steps.cache.outputs.cache-hit != 'true'
35+
run: pip install -r requirements-github-actions.txt
36+
- name: Deploy Docs Status Pending
37+
run: python ./scripts/deploy_docs_status.py
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
41+
RUN_ID: ${{ github.run_id }}
42+
1843
- name: Clean site
1944
run: |
2045
rm -rf ./site
2146
mkdir ./site
22-
- name: Download Artifact Docs
23-
id: download
24-
uses: dawidd6/[email protected]
47+
- uses: actions/download-artifact@v4
2548
with:
26-
if_no_artifact_found: ignore
27-
github_token: ${{ secrets.GITHUB_TOKEN }}
28-
workflow: build-docs.yml
29-
run_id: ${{ github.event.workflow_run.id }}
30-
name: docs-site
3149
path: ./site/
50+
pattern: docs-site
51+
merge-multiple: true
52+
github-token: ${{ secrets.GITHUB_TOKEN }}
53+
run-id: ${{ github.event.workflow_run.id }}
3254
- name: Deploy to Cloudflare Pages
33-
if: steps.download.outputs.found_artifact == 'true'
55+
# hashFiles returns an empty string if there are no files
56+
if: hashFiles('./site/*')
3457
id: deploy
3558
uses: cloudflare/pages-action@v1
3659
with:
@@ -41,8 +64,10 @@ jobs:
4164
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
4265
branch: ${{ ( github.event.workflow_run.head_repository.full_name == github.repository && github.event.workflow_run.head_branch == 'master' && 'main' ) || ( github.event.workflow_run.head_sha ) }}
4366
- name: Comment Deploy
44-
if: steps.deploy.outputs.url != ''
45-
uses: ./.github/actions/comment-docs-preview-in-pr
46-
with:
47-
token: ${{ secrets.GITHUB_TOKEN }}
48-
deploy_url: "${{ steps.deploy.outputs.url }}"
67+
run: python ./scripts/deploy_docs_status.py
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
DEPLOY_URL: ${{ steps.deploy.outputs.url }}
71+
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
72+
RUN_ID: ${{ github.run_id }}
73+
IS_DONE: "true"

.github/workflows/issue-manager.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
- labeled
1515
workflow_dispatch:
1616

17+
permissions:
18+
issues: write
19+
1720
jobs:
1821
issue-manager:
1922
if: github.repository_owner == 'tiangolo'

.github/workflows/smokeshow.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ jobs:
2424

2525
- run: pip install smokeshow
2626

27-
- uses: dawidd6/action-download-artifact@v3.1.4
27+
- uses: actions/download-artifact@v4
2828
with:
29-
workflow: test.yml
30-
commit: ${{ github.event.workflow_run.head_sha }}
29+
name: coverage-html
30+
path: htmlcov
31+
github-token: ${{ secrets.GITHUB_TOKEN }}
32+
run-id: ${{ github.event.workflow_run.id }}
3133

32-
- run: smokeshow upload coverage-html
34+
- run: smokeshow upload htmlcov
3335
env:
3436
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
3537
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 100

.github/workflows/test-redistribute.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ jobs:
4646
run: |
4747
cd dist/typer*/
4848
pip install -r requirements-tests.txt
49+
env:
50+
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
4951
- name: Run source distribution tests
5052
if: ${{ matrix.package != 'typer-cli' }}
5153
run: |
@@ -55,3 +57,15 @@ jobs:
5557
run: |
5658
cd dist
5759
pip wheel --no-deps typer*.tar.gz
60+
61+
# https://github.com/marketplace/actions/alls-green#why
62+
test-redistribute-alls-green: # This job does nothing and is only used for the branch protection
63+
if: always()
64+
needs:
65+
- test-redistribute
66+
runs-on: ubuntu-latest
67+
steps:
68+
- name: Decide whether the needed jobs succeeded or failed
69+
uses: re-actors/alls-green@release/v1
70+
with:
71+
jobs: ${{ toJSON(needs) }}

.github/workflows/test.yml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,23 @@ on:
1414

1515
jobs:
1616
test:
17-
runs-on: ubuntu-latest
1817
strategy:
1918
matrix:
20-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
19+
os: [ ubuntu-latest, windows-latest, macos-latest ]
20+
python-version: [ "3.12" ]
21+
include:
22+
- os: ubuntu-latest
23+
python-version: "3.7"
24+
- os: macos-latest
25+
python-version: "3.8"
26+
- os: windows-latest
27+
python-version: "3.9"
28+
- os: ubuntu-latest
29+
python-version: "3.10"
30+
- os: macos-latest
31+
python-version: "3.11"
2132
fail-fast: false
33+
runs-on: ${{ matrix.os }}
2234
steps:
2335
- name: Dump GitHub context
2436
env:
@@ -32,7 +44,8 @@ jobs:
3244
# Issue ref: https://github.com/actions/setup-python/issues/436
3345
# cache: "pip"
3446
# cache-dependency-path: pyproject.toml
35-
- uses: actions/cache@v3
47+
- uses: actions/cache@v4
48+
if: ${{ runner.os != 'macOS' }}
3649
id: cache
3750
with:
3851
path: ${{ env.pythonLocation }}
@@ -50,9 +63,9 @@ jobs:
5063
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
5164
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
5265
- name: Store coverage files
53-
uses: actions/upload-artifact@v3
66+
uses: actions/upload-artifact@v4
5467
with:
55-
name: coverage
68+
name: coverage-${{ runner.os }}-${{ matrix.python-version }}
5669
path: coverage
5770

5871
coverage-combine:
@@ -71,17 +84,18 @@ jobs:
7184
# cache: "pip"
7285
# cache-dependency-path: pyproject.toml
7386
- name: Get coverage files
74-
uses: actions/download-artifact@v3
87+
uses: actions/download-artifact@v4
7588
with:
76-
name: coverage
89+
pattern: coverage-*
7790
path: coverage
91+
merge-multiple: true
7892
- run: pip install coverage[toml]
7993
- run: ls -la coverage
8094
- run: coverage combine coverage
8195
- run: coverage report
8296
- run: coverage html --show-contexts --title "Coverage for ${{ github.sha }}"
8397
- name: Store coverage HTML
84-
uses: actions/upload-artifact@v3
98+
uses: actions/upload-artifact@v4
8599
with:
86100
name: coverage-html
87101
path: htmlcov

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ htmlcov
1212
.pytest_cache
1313
coverage.xml
1414
.coverage*
15+
.cache

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<p align="center">
2-
<a href="https://typer.tiangolo.com"><img src="https://typer.tiangolo.com/img/logo-margin/logo-margin-vector.svg" alt="Typer"></a>
2+
<a href="https://typer.tiangolo.com"><img src="https://typer.tiangolo.com/img/logo-margin/logo-margin-vector.svg#only-light" alt="Typer"></a>
3+
34
</p>
45
<p align="center">
56
<em>Typer, build great CLIs. Easy to code. Based on Python type hints.</em>

0 commit comments

Comments
 (0)