Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ updates:
commit-message:
prefix: ⬆
# Python
- package-ecosystem: "pip"
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "daily"
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ on:
- opened
- synchronize

env:
UV_SYSTEM_PYTHON: 1

jobs:
changes:
runs-on: ubuntu-latest
Expand All @@ -31,8 +28,8 @@ jobs:
- README.md
- docs/**
- docs_src/**
- requirements-docs.txt
- pyproject.toml
- uv.lock
- mkdocs.yml
- mkdocs.env.yml
- .github/workflows/build-docs.yml
Expand All @@ -53,25 +50,24 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
python-version-file: ".python-version"
- name: Setup uv
uses: astral-sh/setup-uv@v7
with:
version: "0.4.15"
enable-cache: true
cache-dependency-glob: |
requirements**.txt
pyproject.toml
uv.lock
- name: Install docs extras
run: uv pip install -r requirements-docs.txt
run: uv sync --locked --no-dev --group docs
- uses: actions/cache@v5
with:
key: mkdocs-cards-${{ github.ref }}-v1
path: .cache
- name: Verify README
run: python ./scripts/docs.py verify-readme
run: uv run ./scripts/docs.py verify-readme
- name: Build Docs
run: python ./scripts/docs.py build
run: uv run ./scripts/docs.py build
- uses: actions/upload-artifact@v6
with:
name: docs-site
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ permissions:
pull-requests: write
statuses: write

env:
UV_SYSTEM_PYTHON: 1

jobs:
deploy-docs:
runs-on: ubuntu-latest
Expand All @@ -27,19 +24,18 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
python-version-file: ".python-version"
- name: Setup uv
uses: astral-sh/setup-uv@v7
with:
version: "0.4.15"
enable-cache: true
cache-dependency-glob: |
requirements**.txt
pyproject.toml
uv.lock
- name: Install GitHub Actions dependencies
run: uv pip install -r requirements-github-actions.txt
run: uv sync --locked --no-dev --group github-actions
- name: Deploy Docs Status Pending
run: python ./scripts/deploy_docs_status.py
run: uv run ./scripts/deploy_docs_status.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
Expand Down Expand Up @@ -70,14 +66,14 @@ jobs:
command: pages deploy ./site --project-name=${{ env.PROJECT_NAME }} --branch=${{ env.BRANCH }}
- name: Deploy Docs Status Error
if: failure()
run: python ./scripts/deploy_docs_status.py
run: uv run ./scripts/deploy_docs_status.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_SHA: ${{ github.event.workflow_run.head_sha }}
RUN_ID: ${{ github.run_id }}
STATE: "error"
- name: Comment Deploy
run: python ./scripts/deploy_docs_status.py
run: uv run ./scripts/deploy_docs_status.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEPLOY_URL: ${{ steps.deploy.outputs.deployment-url }}
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,15 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.14"
python-version-file: ".python-version"
- name: Setup uv
uses: astral-sh/setup-uv@v7
with:
cache-dependency-glob: |
requirements**.txt
pyproject.toml
uv.lock
- name: Install Dependencies
run: |
uv venv
uv pip install -r requirements.txt
run: uv sync --locked
- name: Run prek - pre-commit
id: precommit
run: uvx prek run --from-ref origin/${GITHUB_BASE_REF} --to-ref HEAD --show-diff-on-failure
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
- typer-cli
permissions:
id-token: write
contents: read
steps:
- name: Dump GitHub context
env:
Expand All @@ -25,15 +26,12 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"
# Issue ref: https://github.com/actions/setup-python/issues/436
# cache: "pip"
# cache-dependency-path: pyproject.toml
- name: Install build dependencies
run: pip install build
python-version-file: ".python-version"
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Build distribution
run: uv build
env:
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
run: python -m build
- name: Publish
uses: pypa/gh-action-pypi-publish@v1.13.0
run: uv publish
11 changes: 4 additions & 7 deletions .github/workflows/smokeshow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ on:
permissions:
statuses: write

env:
UV_SYSTEM_PYTHON: 1

jobs:
smokeshow:
runs-on: ubuntu-latest
Expand All @@ -24,21 +21,21 @@ jobs:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.13'
python-version-file: ".python-version"
- name: Setup uv
uses: astral-sh/setup-uv@v7
with:
cache-dependency-glob: |
requirements**.txt
pyproject.toml
- run: uv pip install -r requirements-github-actions.txt
uv.lock
- run: uv sync --locked --no-dev --group github-actions
- uses: actions/download-artifact@v7
with:
name: coverage-html
path: htmlcov
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- run: smokeshow upload htmlcov
- run: uv run smokeshow upload htmlcov
env:
SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage}
SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 100
Expand Down
18 changes: 8 additions & 10 deletions .github/workflows/test-cpython-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
- cron: "0 0 * * *"
workflow_dispatch:

env:
UV_NO_SYNC: true

jobs:
test-latest-python:
runs-on: ubuntu-latest
Expand All @@ -26,23 +29,18 @@ jobs:
- name: Setup uv
uses: astral-sh/setup-uv@v7
with:
version: "0.4.15"
enable-cache: true
cache-dependency-glob: |
requirements**.txt
pyproject.toml
- name: Create venv with CPython
run: uv venv --python ./.cpython/python .venv
uv.lock
- name: Install Dependencies
run: uv pip install -r requirements-tests.txt
- name: Activate venv
run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
run: uv sync --locked --no-dev --group tests --python ./.cpython/python
- name: Lint
run: bash scripts/lint.sh
run: uv run bash scripts/lint.sh
- run: mkdir coverage
- run: bash ./scripts/test-files.sh
- run: uv run bash scripts/test-files.sh
- name: Test
run: bash scripts/test.sh
run: uv run bash scripts/test.sh
env:
COVERAGE_FILE: coverage/.coverage.ubuntu-cpython-main
CONTEXT: ubuntu-cpython-main
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-redistribute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"
python-version-file: ".python-version"
# Issue ref: https://github.com/actions/setup-python/issues/436
# cache: "pip"
# cache-dependency-path: pyproject.toml
Expand All @@ -45,7 +45,7 @@ jobs:
if: ${{ matrix.package != 'typer-cli' }}
run: |
cd dist/typer*/
pip install -r requirements-tests.txt
pip install --group tests --editable .
env:
TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }}
- name: Run source distribution tests
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- cron: "0 0 * * 1"

env:
UV_SYSTEM_PYTHON: 1
UV_NO_SYNC: true

jobs:
test:
Expand All @@ -34,6 +34,8 @@ jobs:
python-version: "3.13"
fail-fast: false
runs-on: ${{ matrix.os }}
env:
UV_PYTHON: ${{ matrix.python-version }}
steps:
- name: Dump GitHub context
env:
Expand All @@ -47,20 +49,19 @@ jobs:
- name: Setup uv
uses: astral-sh/setup-uv@v7
with:
version: "0.4.15"
enable-cache: true
cache-dependency-glob: |
requirements**.txt
pyproject.toml
uv.lock
- name: Install Dependencies
run: uv pip install -r requirements-tests.txt
run: uv sync --locked --no-dev --group tests
- name: Lint
if: matrix.python-version != '3.9'
run: bash scripts/lint.sh
run: uv run bash scripts/lint.sh
- run: mkdir coverage
- run: bash ./scripts/test-files.sh
- run: uv run bash scripts/test-files.sh
- name: Test
run: bash scripts/test.sh
run: uv run bash scripts/test.sh
env:
COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }}
CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }}
Expand All @@ -82,33 +83,32 @@ jobs:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: '3.13'
python-version-file: ".python-version"
- name: Setup uv
uses: astral-sh/setup-uv@v7
with:
version: "0.4.15"
enable-cache: true
cache-dependency-glob: |
requirements**.txt
pyproject.toml
uv.lock
- name: Get coverage files
uses: actions/download-artifact@v7
with:
pattern: coverage-*
path: coverage
merge-multiple: true
- name: Install Dependencies
run: uv pip install -r requirements-tests.txt
run: uv sync --locked --no-dev --group tests
- run: ls -la coverage
- run: coverage combine coverage
- run: coverage html --show-contexts --title "Coverage for ${{ github.sha }}"
- run: uv run coverage combine coverage
- run: uv run coverage html --show-contexts --title "Coverage for ${{ github.sha }}"
- name: Store coverage HTML
uses: actions/upload-artifact@v6
with:
name: coverage-html
path: htmlcov
include-hidden-files: true
- run: coverage report --fail-under=100
- run: uv run coverage report --fail-under=100

# https://github.com/marketplace/actions/alls-green#why
check: # This job does nothing and is only used for the branch protection
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10
10 changes: 3 additions & 7 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@ First, you might want to see the basic ways to [help Typer and get help](help-ty

If you already cloned the <a href="https://github.com/fastapi/typer" class="external-link" target="_blank">typer repository</a> and you want to deep dive in the code, here are some guidelines to set up your environment.

### Virtual Environment
### Install Requirements Using `uv`

Follow the instructions to create and activate a [virtual environment](virtual-environments.md){.internal-link target=_blank} for the internal code of `typer`.

### Install Requirements Using `pip`

After activating the environment, install the required packages:
Create a virtual environment and install the required packages in one command:

<div class="termy">

```console
$ pip install -r requirements.txt
$ uv sync

---> 100%
```
Expand Down
Loading