pax_global_header 0000666 0000000 0000000 00000000064 15064466163 0014525 g ustar 00root root 0000000 0000000 52 comment=dc07284d09f284c13cad0bec2f5ee5bebceeb31d typer-0.19.2/ 0000775 0000000 0000000 00000000000 15064466163 0012761 5 ustar 00root root 0000000 0000000 typer-0.19.2/.env 0000664 0000000 0000000 00000000203 15064466163 0013545 0 ustar 00root root 0000000 0000000 # Environment variables automatically read by VS Code, e.g. running tests # For tests, a large terminal width TERMINAL_WIDTH=3000 typer-0.19.2/.github/ 0000775 0000000 0000000 00000000000 15064466163 0014321 5 ustar 00root root 0000000 0000000 typer-0.19.2/.github/DISCUSSION_TEMPLATE/ 0000775 0000000 0000000 00000000000 15064466163 0017277 5 ustar 00root root 0000000 0000000 typer-0.19.2/.github/DISCUSSION_TEMPLATE/questions.yml 0000664 0000000 0000000 00000012271 15064466163 0022057 0 ustar 00root root 0000000 0000000 labels: [question] body: - type: markdown attributes: value: | Thanks for your interest in Typer! ๐ Please follow these instructions, fill every question, and do every step. ๐ I'm asking this because answering questions and solving problems in GitHub is what consumes most of the time. I end up not being able to add new features, fix bugs, review pull requests, etc. as fast as I wish because I have to spend too much time handling questions. All that, on top of all the incredible help provided by a bunch of community members that give a lot of their time to come here and help others. If more Typer users came to help others like them just a little bit more, it would be much less effort for them (and you and me ๐ ). By asking questions in a structured way (following this) it will be much easier to help you. And there's a high chance that you will find the solution along the way and you won't even have to submit it and wait for an answer. ๐ As there are too many questions, I'll have to discard and close the incomplete ones. That will allow me (and others) to focus on helping people like you that follow the whole process and help us help you. ๐ค - type: checkboxes id: checks attributes: label: First Check description: Please confirm and check all the following options. options: - label: I added a very descriptive title here. required: true - label: I used the GitHub search to find a similar question and didn't find it. required: true - label: I searched the Typer documentation, with the integrated search. required: true - label: I already searched in Google "How to X in Typer" and didn't find any information. required: true - label: I already read and followed all the tutorials in the docs and didn't find an answer. required: true - label: I already checked if it is not related to Typer but to [Click](https://github.com/pallets/click). required: true - type: checkboxes id: help attributes: label: Commit to Help description: | After submitting this, I commit to one of: * Read open issues with questions until I find 2 issues where I can help someone and add a comment to help there. * I already hit the "watch" button in this repository to receive notifications and I commit to help at least 2 people that ask questions in the future. * Review one Pull Request by downloading the code and following all the [review process](https://typer.tiangolo.com/help-typer/#review-pull-requests). options: - label: I commit to help with one of those options ๐ required: true - type: textarea id: example attributes: label: Example Code description: | Please add a self-contained, [minimal, reproducible, example](https://stackoverflow.com/help/minimal-reproducible-example) with your use case. If I (or someone) can copy it, run it, and see it right away, there's a much higher chance I (or someone) will be able to help you. placeholder: | import typer def main(name: str): typer.echo(f"Hello {name}") if __name__ == "__main__": typer.run(main) render: python validations: required: true - type: textarea id: description attributes: label: Description description: | What is the problem, question, or error? Write a short description telling me what you are doing, what you expect to happen, and what is currently happening. placeholder: | * Create a small Typer script. * Open a Terminal with Ninja-Turtle-Shell. * Trigger autocompletion hitting TAB. * I don't see any completion in the terminal using Ninja-Turtle-Shell. * I expected to see autocompletion there. validations: required: true - type: dropdown id: os attributes: label: Operating System description: What operating system are you on? multiple: true options: - Linux - Windows - macOS - Other validations: required: true - type: textarea id: os-details attributes: label: Operating System Details description: You can add more details about your operating system here, in particular if you chose "Other". - type: input id: typer-version attributes: label: Typer Version description: | What Typer version are you using? You can find the Typer version with: ```bash python -c "import typer; print(typer.__version__)" ``` validations: required: true - type: input id: python-version attributes: label: Python Version description: | What Python version are you using? You can find the Python version with: ```bash python --version ``` validations: required: true - type: textarea id: context attributes: label: Additional Context description: Add any additional context information or screenshots you think are useful. typer-0.19.2/.github/FUNDING.yml 0000664 0000000 0000000 00000000023 15064466163 0016131 0 ustar 00root root 0000000 0000000 github: [tiangolo] typer-0.19.2/.github/ISSUE_TEMPLATE/ 0000775 0000000 0000000 00000000000 15064466163 0016504 5 ustar 00root root 0000000 0000000 typer-0.19.2/.github/ISSUE_TEMPLATE/config.yml 0000664 0000000 0000000 00000001363 15064466163 0020477 0 ustar 00root root 0000000 0000000 blank_issues_enabled: false contact_links: - name: Security Contact about: Please report security vulnerabilities to security@tiangolo.com - name: Question or Problem about: Ask a question or ask about a problem in GitHub Discussions. url: https://github.com/fastapi/typer/discussions/categories/questions - name: Feature Request about: To suggest an idea or ask about a feature, please start with a question saying what you would like to achieve. There might be a way to do it already. url: https://github.com/fastapi/typer/discussions/categories/questions - name: Show and tell about: Show what you built with Typer or to be used with Typer. url: https://github.com/fastapi/typer/discussions/categories/show-and-tell typer-0.19.2/.github/ISSUE_TEMPLATE/privileged.yml 0000664 0000000 0000000 00000001564 15064466163 0021367 0 ustar 00root root 0000000 0000000 name: Privileged description: You are @tiangolo or he asked you directly to create an issue here. If not, check the other options. ๐ body: - type: markdown attributes: value: | Thanks for your interest in Typer! ๐ If you are not @tiangolo or he didn't ask you directly to create an issue here, please start the conversation in a [Question in GitHub Discussions](https://github.com/fastapi/typer/discussions/categories/questions) instead. - type: checkboxes id: privileged attributes: label: Privileged issue description: Confirm that you are allowed to create an issue here. options: - label: I'm @tiangolo or he asked me directly to create an issue here. required: true - type: textarea id: content attributes: label: Issue Content description: Add the content of the issue here. typer-0.19.2/.github/dependabot.yml 0000664 0000000 0000000 00000000465 15064466163 0017156 0 ustar 00root root 0000000 0000000 version: 2 updates: # GitHub Actions - package-ecosystem: "github-actions" directory: "/" schedule: interval: "daily" commit-message: prefix: โฌ # Python - package-ecosystem: "pip" directory: "/" schedule: interval: "daily" commit-message: prefix: โฌ typer-0.19.2/.github/labeler.yml 0000664 0000000 0000000 00000000776 15064466163 0016464 0 ustar 00root root 0000000 0000000 docs: - all: - changed-files: - any-glob-to-any-file: - docs/** - docs_src/** - all-globs-to-all-files: - '!typer/**' - '!pyproject.toml' internal: - all: - changed-files: - any-glob-to-any-file: - .github/** - scripts/** - .gitignore - .pre-commit-config.yaml - pdm_build.py - requirements*.txt - all-globs-to-all-files: - '!docs/**' - '!typer/**' - '!pyproject.toml' typer-0.19.2/.github/workflows/ 0000775 0000000 0000000 00000000000 15064466163 0016356 5 ustar 00root root 0000000 0000000 typer-0.19.2/.github/workflows/add-to-project.yml 0000664 0000000 0000000 00000000560 15064466163 0021716 0 ustar 00root root 0000000 0000000 name: Add to Project on: pull_request_target: issues: types: - opened - reopened jobs: add-to-project: name: Add to project runs-on: ubuntu-latest steps: - uses: actions/add-to-project@v1.0.2 with: project-url: https://github.com/orgs/fastapi/projects/2 github-token: ${{ secrets.PROJECTS_TOKEN }} typer-0.19.2/.github/workflows/build-docs.yml 0000664 0000000 0000000 00000005474 15064466163 0021140 0 ustar 00root root 0000000 0000000 name: Build Docs on: push: branches: - master pull_request: types: - opened - synchronize env: UV_SYSTEM_PYTHON: 1 jobs: changes: runs-on: ubuntu-latest # Required permissions permissions: pull-requests: read # Set job outputs to values from filter step outputs: docs: ${{ steps.filter.outputs.docs }} steps: - uses: actions/checkout@v5 # For pull requests it's not necessary to checkout the code but for the main branch it is - uses: dorny/paths-filter@v3 id: filter with: filters: | docs: - README.md - docs/** - docs_src/** - requirements-docs.txt - requirements-docs-insiders.txt - pyproject.toml - mkdocs.yml - mkdocs.insiders.yml - mkdocs.maybe-insiders.yml - mkdocs.no-insiders.yml - .github/workflows/build-docs.yml - .github/workflows/deploy-docs.yml - data/** build-docs: needs: - changes if: ${{ needs.changes.outputs.docs == 'true' }} runs-on: ubuntu-latest steps: - name: Dump GitHub context env: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v5 - name: Set up Python uses: actions/setup-python@v6 with: python-version: "3.11" - name: Setup uv uses: astral-sh/setup-uv@v6 with: version: "0.4.15" enable-cache: true cache-dependency-glob: | requirements**.txt pyproject.toml - name: Install docs extras run: uv pip install -r requirements-docs.txt - name: Install Material for MkDocs Insiders if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' ) run: uv pip install -r requirements-docs-insiders.txt env: TOKEN: ${{ secrets.TYPER_MKDOCS_MATERIAL_INSIDERS }} - uses: actions/cache@v4 with: key: mkdocs-cards-${{ github.ref }}-v1 path: .cache - name: Verify README run: python ./scripts/docs.py verify-readme - name: Build Docs run: python ./scripts/docs.py build - uses: actions/upload-artifact@v4 with: name: docs-site path: ./site/** include-hidden-files: true # https://github.com/marketplace/actions/alls-green#why docs-all-green: # This job does nothing and is only used for the branch protection if: always() needs: - build-docs runs-on: ubuntu-latest steps: - name: Decide whether the needed jobs succeeded or failed uses: re-actors/alls-green@release/v1 with: jobs: ${{ toJSON(needs) }} allowed-skips: build-docs typer-0.19.2/.github/workflows/conflict.yml 0000664 0000000 0000000 00000000763 15064466163 0020710 0 ustar 00root root 0000000 0000000 name: "Conflict detector" on: push: pull_request_target: types: [synchronize] jobs: main: permissions: contents: read pull-requests: write runs-on: ubuntu-latest steps: - name: Check if PRs have merge conflicts uses: eps1lon/actions-label-merge-conflict@v3 with: dirtyLabel: "conflicts" repoToken: "${{ secrets.GITHUB_TOKEN }}" commentOnDirty: "This pull request has a merge conflict that needs to be resolved." typer-0.19.2/.github/workflows/deploy-docs.yml 0000664 0000000 0000000 00000004736 15064466163 0021335 0 ustar 00root root 0000000 0000000 name: Deploy Docs on: workflow_run: workflows: - Build Docs types: - completed permissions: deployments: write issues: write pull-requests: write statuses: write env: UV_SYSTEM_PYTHON: 1 jobs: deploy-docs: runs-on: ubuntu-latest steps: - name: Dump GitHub context env: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v5 - name: Set up Python uses: actions/setup-python@v6 with: python-version: "3.11" - name: Setup uv uses: astral-sh/setup-uv@v6 with: version: "0.4.15" enable-cache: true cache-dependency-glob: | requirements**.txt pyproject.toml - name: Install GitHub Actions dependencies run: uv pip install -r requirements-github-actions.txt - name: Deploy Docs Status Pending run: python ./scripts/deploy_docs_status.py env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COMMIT_SHA: ${{ github.event.workflow_run.head_sha }} RUN_ID: ${{ github.run_id }} - name: Clean site run: | rm -rf ./site mkdir ./site - uses: actions/download-artifact@v5 with: path: ./site/ pattern: docs-site merge-multiple: true github-token: ${{ secrets.GITHUB_TOKEN }} run-id: ${{ github.event.workflow_run.id }} - name: Deploy to Cloudflare Pages # hashFiles returns an empty string if there are no files if: hashFiles('./site/*') id: deploy env: PROJECT_NAME: typertiangolo 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 ) }} uses: cloudflare/wrangler-action@v3 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} command: pages deploy ./site --project-name=${{ env.PROJECT_NAME }} --branch=${{ env.BRANCH }} - name: Comment Deploy run: python ./scripts/deploy_docs_status.py env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} DEPLOY_URL: ${{ steps.deploy.outputs.deployment-url }} COMMIT_SHA: ${{ github.event.workflow_run.head_sha }} RUN_ID: ${{ github.run_id }} IS_DONE: "true" typer-0.19.2/.github/workflows/issue-manager.yml 0000664 0000000 0000000 00000002251 15064466163 0021641 0 ustar 00root root 0000000 0000000 name: Issue Manager on: schedule: - cron: "13 21 * * *" issue_comment: types: - created issues: types: - labeled pull_request_target: types: - labeled workflow_dispatch: permissions: issues: write pull-requests: write jobs: issue-manager: if: github.repository_owner == 'fastapi' runs-on: ubuntu-latest steps: - name: Dump GitHub context env: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" - uses: tiangolo/issue-manager@0.5.1 with: token: ${{ secrets.GITHUB_TOKEN }} config: > { "answered": { "delay": 864000, "message": "Assuming the original need was handled, this will be automatically closed now. But feel free to add more comments or create new issues or PRs." }, "waiting": { "delay": 2628000, "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." } } typer-0.19.2/.github/workflows/labeler.yml 0000664 0000000 0000000 00000001474 15064466163 0020515 0 ustar 00root root 0000000 0000000 name: Labels on: pull_request_target: types: - opened - synchronize - reopened # For label-checker - labeled - unlabeled jobs: labeler: permissions: contents: read pull-requests: write runs-on: ubuntu-latest steps: - uses: actions/labeler@v6 if: ${{ github.event.action != 'labeled' && github.event.action != 'unlabeled' }} - run: echo "Done adding labels" # Run this after labeler applied labels check-labels: needs: - labeler permissions: pull-requests: read runs-on: ubuntu-latest steps: - uses: docker://agilepathway/pull-request-label-checker:latest with: one_of: breaking,security,feature,bug,refactor,upgrade,docs,lang-all,internal repo_token: ${{ secrets.GITHUB_TOKEN }} typer-0.19.2/.github/workflows/latest-changes.yml 0000664 0000000 0000000 00000002465 15064466163 0022012 0 ustar 00root root 0000000 0000000 name: Latest Changes on: pull_request_target: branches: - master types: - closed workflow_dispatch: inputs: number: description: PR number required: true debug_enabled: description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' required: false default: 'false' jobs: latest-changes: runs-on: ubuntu-latest steps: - name: Dump GitHub context env: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v5 with: # To allow latest-changes to commit to the main branch token: ${{ secrets.TYPER_LATEST_CHANGES }} # Allow debugging with tmate - name: Setup tmate session uses: mxschmitt/action-tmate@v3 if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }} with: limit-access-to-actor: true - uses: tiangolo/latest-changes@0.4.0 with: token: ${{ secrets.GITHUB_TOKEN }} latest_changes_file: docs/release-notes.md latest_changes_header: '## Latest Changes' end_regex: '^## ' debug_logs: true label_header_prefix: '### ' typer-0.19.2/.github/workflows/publish.yml 0000664 0000000 0000000 00000001702 15064466163 0020547 0 ustar 00root root 0000000 0000000 name: Publish on: release: types: - created jobs: publish: runs-on: ubuntu-latest strategy: matrix: package: - typer-slim - typer - typer-cli permissions: id-token: write steps: - name: Dump GitHub context env: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v5 - 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 - name: Build distribution env: TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }} run: python -m build - name: Publish uses: pypa/gh-action-pypi-publish@v1.13.0 typer-0.19.2/.github/workflows/smokeshow.yml 0000664 0000000 0000000 00000002666 15064466163 0021132 0 ustar 00root root 0000000 0000000 name: Smokeshow on: workflow_run: workflows: - Test types: - completed permissions: statuses: write env: UV_SYSTEM_PYTHON: 1 jobs: smokeshow: if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest steps: - name: Dump GitHub context env: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v5 - uses: actions/setup-python@v6 with: python-version: '3.9' - name: Setup uv uses: astral-sh/setup-uv@v6 with: version: "0.4.15" enable-cache: true cache-dependency-glob: | requirements**.txt pyproject.toml - run: uv pip install -r requirements-github-actions.txt - uses: actions/download-artifact@v5 with: name: coverage-html path: htmlcov github-token: ${{ secrets.GITHUB_TOKEN }} run-id: ${{ github.event.workflow_run.id }} - run: smokeshow upload htmlcov env: SMOKESHOW_GITHUB_STATUS_DESCRIPTION: Coverage {coverage-percentage} SMOKESHOW_GITHUB_COVERAGE_THRESHOLD: 100 SMOKESHOW_GITHUB_CONTEXT: coverage SMOKESHOW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SMOKESHOW_GITHUB_PR_HEAD_SHA: ${{ github.event.workflow_run.head_sha }} SMOKESHOW_AUTH_KEY: ${{ secrets.SMOKESHOW_AUTH_KEY }} typer-0.19.2/.github/workflows/test-redistribute.yml 0000664 0000000 0000000 00000003716 15064466163 0022572 0 ustar 00root root 0000000 0000000 name: Test Redistribute on: push: branches: - master pull_request: types: - opened - synchronize jobs: test-redistribute: runs-on: ubuntu-latest strategy: matrix: package: - typer-slim - typer - typer-cli steps: - name: Dump GitHub context env: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v5 - 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 - name: Build source distribution env: TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }} run: python -m build --sdist - name: Decompress source distribution run: | cd dist tar xvf typer*.tar.gz - name: Install test dependencies if: ${{ matrix.package != 'typer-cli' }} run: | cd dist/typer*/ pip install -r requirements-tests.txt env: TIANGOLO_BUILD_PACKAGE: ${{ matrix.package }} - name: Run source distribution tests if: ${{ matrix.package != 'typer-cli' }} run: | cd dist/typer*/ bash scripts/test.sh - name: Build wheel distribution run: | cd dist pip wheel --no-deps typer*.tar.gz # https://github.com/marketplace/actions/alls-green#why test-redistribute-alls-green: # This job does nothing and is only used for the branch protection if: always() needs: - test-redistribute runs-on: ubuntu-latest steps: - name: Decide whether the needed jobs succeeded or failed uses: re-actors/alls-green@release/v1 with: jobs: ${{ toJSON(needs) }} typer-0.19.2/.github/workflows/test.yml 0000664 0000000 0000000 00000007236 15064466163 0020070 0 ustar 00root root 0000000 0000000 name: Test on: push: branches: - master pull_request: types: - opened - synchronize schedule: # cron every week on monday - cron: "0 0 * * 1" env: UV_SYSTEM_PYTHON: 1 jobs: test: strategy: matrix: os: [ ubuntu-latest, windows-latest, macos-latest ] python-version: [ "3.13" ] include: - os: macos-latest python-version: "3.8" - os: windows-latest python-version: "3.9" - os: ubuntu-latest python-version: "3.10" - os: macos-latest python-version: "3.11" - os: windows-latest python-version: "3.12" fail-fast: false runs-on: ${{ matrix.os }} steps: - name: Dump GitHub context env: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v5 - name: Set up Python uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }} - name: Setup uv uses: astral-sh/setup-uv@v6 with: version: "0.4.15" enable-cache: true cache-dependency-glob: | requirements**.txt pyproject.toml - name: Install Dependencies run: uv pip install -r requirements-tests.txt - name: Lint if: matrix.python-version != '3.7' && matrix.python-version != '3.8' && matrix.python-version != '3.9' run: bash scripts/lint.sh - run: mkdir coverage - run: bash ./scripts/test-files.sh - name: Test run: bash scripts/test.sh env: COVERAGE_FILE: coverage/.coverage.${{ runner.os }}-py${{ matrix.python-version }} CONTEXT: ${{ runner.os }}-py${{ matrix.python-version }} - name: Store coverage files uses: actions/upload-artifact@v4 with: name: coverage-${{ runner.os }}-${{ matrix.python-version }} path: coverage include-hidden-files: true coverage-combine: needs: [test] runs-on: ubuntu-latest steps: - name: Dump GitHub context env: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v5 - uses: actions/setup-python@v6 with: python-version: '3.8' - name: Setup uv uses: astral-sh/setup-uv@v6 with: version: "0.4.15" enable-cache: true cache-dependency-glob: | requirements**.txt pyproject.toml - name: Get coverage files uses: actions/download-artifact@v5 with: pattern: coverage-* path: coverage merge-multiple: true - name: Install Dependencies run: uv pip install -r requirements-tests.txt - run: ls -la coverage - run: coverage combine coverage - run: coverage report - run: coverage html --show-contexts --title "Coverage for ${{ github.sha }}" - name: Store coverage HTML uses: actions/upload-artifact@v4 with: name: coverage-html path: htmlcov include-hidden-files: true # https://github.com/marketplace/actions/alls-green#why check: # This job does nothing and is only used for the branch protection if: always() needs: - coverage-combine runs-on: ubuntu-latest steps: - name: Dump GitHub context env: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" - name: Decide whether the needed jobs succeeded or failed uses: re-actors/alls-green@release/v1 with: jobs: ${{ toJSON(needs) }} typer-0.19.2/.gitignore 0000664 0000000 0000000 00000000166 15064466163 0014754 0 ustar 00root root 0000000 0000000 .vscode *.pyc __pycache__ .venv* env dist .mypy_cache .idea site htmlcov .pytest_cache coverage.xml .coverage* .cache typer-0.19.2/.pre-commit-config.yaml 0000664 0000000 0000000 00000001336 15064466163 0017245 0 ustar 00root root 0000000 0000000 # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks default_language_version: python: python3.10 repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: - id: check-added-large-files - id: check-toml - id: check-yaml args: - --unsafe - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.13.1 hooks: - id: ruff args: - --fix - id: ruff-format ci: autofix_commit_msg: ๐จ [pre-commit.ci] Auto format from pre-commit.com hooks autoupdate_commit_msg: โฌ [pre-commit.ci] pre-commit autoupdate typer-0.19.2/CITATION.cff 0000664 0000000 0000000 00000001067 15064466163 0014657 0 ustar 00root root 0000000 0000000 # This CITATION.cff file was generated with cffinit. # Visit https://bit.ly/cffinit to generate yours today! cff-version: 1.2.0 title: Typer message: >- If you use this software, please cite it using the metadata from this file. type: software authors: - given-names: Sebastiรกn family-names: Ramรญrez email: tiangolo@gmail.com identifiers: repository-code: 'https://github.com/fastapi/typer' url: 'https://typer.tiangolo.com' abstract: >- Typer, build great CLIs. Easy to code. Based on Python type hints. keywords: - typer - click license: MIT typer-0.19.2/CONTRIBUTING.md 0000664 0000000 0000000 00000000175 15064466163 0015215 0 ustar 00root root 0000000 0000000 Please read the [Development - Contributing](https://typer.tiangolo.com/contributing/) guidelines in the documentation site. typer-0.19.2/LICENSE 0000664 0000000 0000000 00000002076 15064466163 0013773 0 ustar 00root root 0000000 0000000 The MIT License (MIT) Copyright (c) 2019 Sebastiรกn Ramรญrez Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. typer-0.19.2/README.md 0000664 0000000 0000000 00000033746 15064466163 0014255 0 ustar 00root root 0000000 0000000
Typer, build great CLIs. Easy to code. Based on Python type hints.
--- **Documentation**: https://typer.tiangolo.com **Source Code**: https://github.com/fastapi/typer --- Typer is a library for building CLI applications that users will **love using** and developers will **love creating**. Based on Python type hints. It's also a command line tool to run scripts, automatically converting them to CLI applications. The key features are: * **Intuitive to write**: Great editor support. Completion everywhere. Less time debugging. Designed to be easy to use and learn. Less time reading docs. * **Easy to use**: It's easy to use for the final users. Automatic help, and automatic completion for all shells. * **Short**: Minimize code duplication. Multiple features from each parameter declaration. Fewer bugs. * **Start simple**: The simplest example adds only 2 lines of code to your app: **1 import, 1 function call**. * **Grow large**: Grow in complexity as much as you want, create arbitrarily complex trees of commands and groups of subcommands, with options and arguments. * **Run scripts**: Typer includes a `typer` command/program that you can use to run scripts, automatically converting them to CLIs, even if they don't use Typer internally. ## FastAPI of CLIs **Typer** is FastAPI's little sibling, it's the FastAPI of CLIs. ## Installation Create and activate a virtual environment and then install **Typer**:rich: to show nicely formatted errors automatically.
* shellingham: to automatically detect the current shell when installing completion.
* With `shellingham` you can just use `--install-completion`.
* Without `shellingham`, you have to pass the name of the shell to install completion for, e.g. `--install-completion bash`.
### `typer-slim`
If you don't want the extra standard optional dependencies, install `typer-slim` instead.
When you install with:
```bash
pip install typer
```
...it includes the same code and dependencies as:
```bash
pip install "typer-slim[standard]"
```
The `standard` extra dependencies are `rich` and `shellingham`.
**Note**: The `typer` command is only included in the `typer` package.
## License
This project is licensed under the terms of the MIT license.
typer-0.19.2/SECURITY.md 0000664 0000000 0000000 00000002210 15064466163 0014545 0 ustar 00root root 0000000 0000000 # Security Policy
Security is very important for Typer and its community. ๐
Learn more about it below. ๐
## Versions
The latest versions of Typer are supported.
You are encouraged to [write tests](https://typer.tiangolo.com/tutorial/testing/) for your application and update your Typer version frequently after ensuring that your tests are passing. This way you will benefit from the latest features, bug fixes, and **security fixes**.
## Reporting a Vulnerability
If you think you found a vulnerability, and even if you are not sure about it, please report it right away by sending an email to: security@tiangolo.com. Please try to be as explicit as possible, describing all the steps and example code to reproduce the security issue.
I (the author, [@tiangolo](https://twitter.com/tiangolo)) will review it thoroughly and get back to you.
## Public Discussions
Please restrain from publicly discussing a potential security vulnerability. ๐
It's better to discuss privately and try to find a solution first, to limit the potential impact as much as possible.
---
Thanks for your help!
The Typer community and I thank you for that. ๐
typer-0.19.2/data/ 0000775 0000000 0000000 00000000000 15064466163 0013672 5 ustar 00root root 0000000 0000000 typer-0.19.2/data/members.yml 0000664 0000000 0000000 00000000100 15064466163 0016036 0 ustar 00root root 0000000 0000000 members:
- login: tiangolo
- login: svlandeg
- login: patrick91
typer-0.19.2/docs/ 0000775 0000000 0000000 00000000000 15064466163 0013711 5 ustar 00root root 0000000 0000000 typer-0.19.2/docs/about/ 0000775 0000000 0000000 00000000000 15064466163 0015023 5 ustar 00root root 0000000 0000000 typer-0.19.2/docs/about/index.md 0000664 0000000 0000000 00000000102 15064466163 0016445 0 ustar 00root root 0000000 0000000 # About
About **Typer**, its design, inspiration, and more. ๐ค
typer-0.19.2/docs/alternatives.md 0000664 0000000 0000000 00000011505 15064466163 0016736 0 ustar 00root root 0000000 0000000 # Alternatives, Inspiration and Comparisons
What inspired **Typer**, how it compares to other alternatives and what it learned from them.
## Intro
**Typer** wouldn't exist if not for the previous work of others.
There have been many tools created before that have helped inspire its creation.
## Previous tools
### `argparse`
`argparse` is the Python standard library's module to write CLIs.
It provides a better alternative than reading the *CLI Parameters* as a `list` of `str` and parsing everything by hand.
/// check | Inspired **Typer** to
Provide a better development experience than just reading *CLI Parameters* by hand.
///
### Hug
Hug is a library to create APIs and CLIs, it uses parameters in functions to declare the required data.
It inspired a lot of the ideas in **FastAPI** and **Typer**.
/// check | Inspired **Typer** to
Use function parameters to declare *CLI arguments* and *CLI options* as it simplifies a lot the development experience.
///
### Plac
Plac is another library to create CLIs using parameters in functions, similar to Hug.
/// check | Inspired **Typer** to
Provide a simple way to use a function as a command line app, without having to create a complete app, with `typer.run(some_function)`.
///
### Pydantic
Pydantic is a library to handle data validation using standard modern Python type annotations.
It powers **FastAPI** underneath.
It is not used by **Typer**, but it inspired a lot of the design (through **FastAPI**).
/// check | Inspired **Typer** to
Use standard Python type annotations to declare types instead of library-specific types or classes and use them for data validation and documentation.
///
### Click
Click is one of the most widely used libraries to create CLIs in Python.
It's a very powerful tool and there are many CLIs built with it. It is what powers **Typer** underneath.
It also uses functions with parameters for *CLI arguments* and *CLI options*, but the declaration of the specific *CLI arguments*, *CLI options*, types, etc, is done in decorators on top of the function. This requires some code repetition (e.g. a *CLI Option* name `--verbose` and a variable name `verbose`) and synchronization between two places related to the same information (the decorator and the parameter function).
It uses decorators on top of functions to modify the actual value of those functions, converting them to instances of a specific class. This is a clever trick, but code editors can't provide great support for autocompletion that way.
It was built with some great ideas and design using the features available in the language at the time (Python 2.x).
/// check | **Typer** uses it for
Everything. ๐
**Typer** mainly adds a layer on top of Click, making the code simpler and easier to use, with autocompletion everywhere, etc, but providing all the powerful features of Click underneath.
As someone pointed out: "Nice to see it is built on Click but adds the type stuff. Me gusta!"
///
### `click-completion`
`click-completion` is a plug-in for Click. It was created to extend completion support for shells when Click only had support for Bash completion.
Previous versions of **Typer** had deep integrations with `click-completion` and used it as an optional dependency. But now all the completion logic is implemented internally in **Typer** itself, the internal logic was heavily inspired and using some parts of `click-completion`.
And now **Typer** improved it to have new features, tests, some bug fixes (for issues in plain `click-completion` and Click), and better support for shells, including modern versions of PowerShell (e.g. the default versions that come with Windows 10).
/// check | Inspired **Typer** to
Provide auto completion for all the shells.
///
### FastAPI
I created **FastAPI** to provide an easy way to build APIs with autocompletion for everything in the code (and some other features).
**Typer** is the "FastAPI of CLIs".
It uses the same design and usage of FastAPI as much as possible. So, if you have used FastAPI, you know how to use Typer.
typer-0.19.2/docs/contributing.md 0000664 0000000 0000000 00000017252 15064466163 0016751 0 ustar 00root root 0000000 0000000 # Development - Contributing
First, you might want to see the basic ways to [help Typer and get help](help-typer.md){.internal-link target=_blank}.
## Developing
If you already cloned the typer repository and you want to deep dive in the code, here are some guidelines to set up your environment.
### Virtual Environment
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:
**Typer** is FastAPI's little sibling.
It follows the same design and ideas. If you know **FastAPI**, you already know **Typer**... more or less.
## Just Modern Python
It's all based on standard **Python type** declarations. No new syntax to learn. Just standard modern Python.
If you need a 2 minute refresher of how to use Python types (even if you don't use FastAPI or Typer), check the FastAPI tutorial section: Python types intro.
You will also see a 20 seconds refresher on the section [Tutorial - User Guide: First Steps](tutorial/first-steps.md){.internal-link target=_blank}.
## Editor support
**Typer** was designed to be easy and intuitive to use, to ensure the best development experience. With autocompletion everywhere.
You will rarely need to come back to the docs.
Here's how your editor might help you:
* in Visual Studio Code:

* in PyCharm:

You will get completion for everything. That's something no other CLI library provides right now.
No more guessing what type was that variable, if it could be `None`, etc.
### Short
It has sensible **defaults** for everything, with optional configurations everywhere. All the parameters can be fine-tuned to do what you need, customize the help, callbacks per parameter, make them required or not, etc.
But by default, it all **"just works"**.
## User friendly CLI apps
The resulting CLI apps created with **Typer** have the nice features of many "pro" command line programs you probably already love.
* Automatic help options for the main CLI program and all its subcommands.
* Automatic command and subcommand structure handling (you will see more about subcommands in the Tutorial - User Guide).
* Automatic completion for the CLI app in all operating systems, in all the shells (Bash, Zsh, Fish, PowerShell), so that the final user of your app can just hit TAB and get the available options or subcommands. *
/// note | * Auto completion
Auto completion works when you create a package (installable with `pip`). Or when using the `typer` command.
**Typer** uses `shellingham` to auto-detect the current shell when installing completion. If you don't want to include `shellingham`, install `typer-slim`.
**Typer** will automatically create 2 *CLI options*:
* `--install-completion`: Install completion for the current shell.
* `--show-completion`: Show completion for the current shell, to copy it or customize the installation.
If you didn't add `shellingham` (if you installed `pip install typer-slim`) those *CLI options* take a value with the name of the shell to install completion for, e.g.:
* `--install-completion bash`.
* `--show-completion powershell`.
Then you can tell the user to install completion after installing your CLI program and the rest will just work.
///
/// tip
**Typer**'s completion is implemented internally, it uses ideas and components from Click and ideas from `click-completion`, but it doesn't use `click-completion` and re-implements some of the relevant parts of Click.
Then it extends those ideas with features and bug fixes. For example, **Typer** programs also support modern versions of PowerShell (e.g. in Windows 10) among all the other shells.
///
## The power of Click
Click is one of the most popular tools for building CLIs in Python.
**Typer** is based on it, so you get all its benefits.
But you can write simpler code with the benefits of modern Python.
## Tested
* 100% test coverage.
* 100% type annotated code base.
* Used in production applications.
typer-0.19.2/docs/help-typer.md 0000664 0000000 0000000 00000027460 15064466163 0016335 0 ustar 00root root 0000000 0000000 # Help Typer - Get Help
Are you liking **Typer**?
Would you like to help Typer, other users, and the author?
Or would you like to get help with **Typer**?
There are very simple ways to help (several involve just one or two clicks).
And there are several ways to get help too.
## Subscribe to the newsletter
You can subscribe to the (infrequent) [**FastAPI and friends** newsletter](/newsletter/){.internal-link target=_blank} to stay updated about:
* News about FastAPI and friends, including Typer ๐
* Guides ๐
* Features โจ
* Breaking changes ๐จ
* Tips and tricks โ
## Star **Typer** in GitHub
You can "star" Typer in GitHub (clicking the star button at the top right): https://github.com/fastapi/typer.
By adding a star, other users will be able to find it more easily and see that it has been already useful for others.
## Watch the GitHub repository for releases
You can "watch" Typer in GitHub (clicking the "watch" button at the top right): https://github.com/fastapi/typer.
There you can select "Releases only".
By doing it, you will receive notifications (in your email) whenever there's a new release (a new version) of **Typer** with bug fixes and new features.
## Connect with the author
You can connect with me (Sebastiรกn Ramรญrez / `tiangolo`), the author.
You can:
* Follow me on **GitHub**.
* See other Open Source projects I have created that could help you.
* Follow me to see when I create a new Open Source project.
* Follow me on **Twitter**.
* Tell me how you use Typer (I love to hear that).
* Hear when I make announcements or release new tools.
* Connect with me on **Linkedin**.
* Hear when I make announcements or release new tools (although I use Twitter more often ๐คทโโ).
* Read what I write (or follow me) on **Dev.to** or **Medium**.
* Read other ideas, articles, and read about tools I have created.
* Follow me to read when I publish something new.
## Tweet about **Typer**
Tweet about **Typer** and let me and others know why you like it.
I love to hear about how **Typer** is being used, what have you liked in it, in which project/company you are using it, etc.
## Help others with questions in GitHub
You can try and help others with their questions in:
* GitHub Discussions
* GitHub Issues
In many cases you might already know the answer for those questions. ๐ค
Just remember, the most important point is: try to be kind. People come with their frustrations and in many cases don't ask in the best way, but try as best as you can to be kind. ๐ค
The idea is for the **Typer** community to be kind and welcoming. At the same time, don't accept bullying or disrespectful behavior towards others. We have to take care of each other.
---
Here's how to help others with questions (in discussions or issues):
### Understand the question
* Check if you can understand what is the **purpose** and use case of the person asking.
* Then check if the question (the vast majority are questions) is **clear**.
* In many cases the question asked is about an imaginary solution from the user, but there might be a **better** one. If you can understand the problem and use case better, you might be able to suggest a better **alternative solution**.
* If you can't understand the question, ask for more **details**.
### Reproduce the problem
For most of the cases and most of the questions there's something related to the person's **original code**.
In many cases they will only copy a fragment of the code, but that's not enough to **reproduce the problem**.
* You can ask them to provide a minimal, reproducible, example, that you can **copy-paste** and run locally to see the same error or behavior they are seeing, or to understand their use case better.
* If you are feeling too generous, you can try to **create an example** like that yourself, just based on the description of the problem. Just have in mind that this might take a lot of time and it might be better to ask them to clarify the problem first.
### Suggest solutions
* After being able to understand the question, you can give them a possible **answer**.
* In many cases, it's better to understand their **underlying problem or use case**, because there might be a better way to solve it than what they are trying to do.
### Ask to close
If they reply, there's a high chance you would have solved their problem, congrats, **you're a hero**! ๐ฆธ
* Now, if that solved their problem, you can ask them to:
* In GitHub Discussions: mark the comment as the **answer**.
* In GitHub Issues: **close** the issue**.
## Watch the GitHub repository
You can "watch" Typer in GitHub (clicking the "watch" button at the top right): https://github.com/fastapi/typer.
If you select "Watching" instead of "Releases only" you will receive notifications when someone creates a new issue or question. You can also specify that you only want to be notified about new issues, or discussions, or PRs, etc.
Then you can try and help them solve those questions.
## Ask Questions
You can create a new question in the GitHub repository, for example to:
* Ask a **question** or ask about a **problem**.
* Suggest a new **feature**.
**Note**: if you do it, then I'm going to ask you to also help others. ๐
## Review Pull Requests
You can help me review pull requests from others.
Again, please try your best to be kind. ๐ค
---
Here's what to have in mind and how to review a pull request:
### Understand the problem
* First, make sure you **understand the problem** that the pull request is trying to solve. It might have a longer discussion in a GitHub Discussion or issue.
* There's also a good chance that the pull request is not actually needed because the problem can be solved in a **different way**. Then you can suggest or ask about that.
### Don't worry about style
* Don't worry too much about things like commit message styles, I will squash and merge customizing the commit manually.
* Also don't worry about style rules, there are already automated tools checking that.
And if there's any other style or consistency need, I'll ask directly for that, or I'll add commits on top with the needed changes.
### Check the code
* Check and read the code, see if it makes sense, **run it locally** and see if it actually solves the problem.
* Then **comment** saying that you did that, that's how I will know you really checked it.
/// info
Unfortunately, I can't simply trust PRs that just have several approvals.
Several times it has happened that there are PRs with 3, 5 or more approvals, probably because the description is appealing, but when I check the PRs, they are actually broken, have a bug, or don't solve the problem they claim to solve. ๐
So, it's really important that you actually read and run the code, and let me know in the comments that you did. ๐ค
///
* If the PR can be simplified in a way, you can ask for that, but there's no need to be too picky, there might be a lot of subjective points of view (and I will have my own as well ๐), so it's better if you can focus on the fundamental things.
### Tests
* Help me check that the PR has **tests**.
* Check that the tests **fail** before the PR. ๐จ
* Then check that the tests **pass** after the PR. โ
* Many PRs don't have tests, you can **remind** them to add tests, or you can even **suggest** some tests yourself. That's one of the things that consume most time and you can help a lot with that.
* Then also comment what you tried, that way I'll know that you checked it. ๐ค
## Create a Pull Request
You can [contribute](contributing.md){.internal-link target=_blank} to the source code with Pull Requests, for example:
* To fix a typo you found on the documentation.
* To propose new documentation sections.
* To fix an existing issue/bug.
* Make sure to add tests.
* To add a new feature.
* Make sure to add tests.
* Make sure to add documentation if it's relevant.
## Help Maintain Typer
Help me maintain **Typer**! ๐ค
There's a lot of work to do, and for most of it, **YOU** can do it.
The main tasks that you can do right now are:
* [Help others with questions in GitHub](#help-others-with-questions-in-github){.internal-link target=_blank} (see the section above).
* [Review Pull Requests](#review-pull-requests){.internal-link target=_blank} (see the section above).
Those two tasks are what **consume time the most**. That's the main work of maintaining Typer.
If you can help me with that, **you are helping me maintain Typer** and making sure it keeps **advancing faster and better**. ๐
## Join the chat
Join the ๐ฅ FastAPI and Friends Discord chat server ๐ฅ and hang out with others in the community. There's a `#typer` channel.
/// tip
For questions, ask them in GitHub Discussions, there's a much better chance you will receive help there.
Use the chat only for other general conversations.
///
### Don't use the chat for questions
Have in mind that as chats allow more "free conversation", it's easy to ask questions that are too general and more difficult to answer, so, you might not receive answers.
In GitHub, the template will guide you to write the right question so that you can more easily get a good answer, or even solve the problem yourself even before asking. And in GitHub I can make sure I always answer everything, even if it takes some time. I can't personally do that with the chat. ๐
Conversations in the chat are also not as easily searchable as in GitHub, so questions and answers might get lost in the conversation.
On the other side, there are thousands of users in the chat, so there's a high chance you'll find someone to talk to there, almost all the time. ๐
## Sponsor the author
You can also financially support the author (me) through GitHub sponsors.
There you could buy me a coffee โ๏ธ to say thanks. ๐
## Sponsor the tools that power Typer
As you have seen in the documentation, Typer is built on top of Click.
You can also sponsor:
* Pallets Project (Click maintainers) via the PSF or via Tidelift
---
Thanks! ๐
typer-0.19.2/docs/img/ 0000775 0000000 0000000 00000000000 15064466163 0014465 5 ustar 00root root 0000000 0000000 typer-0.19.2/docs/img/favicon.png 0000664 0000000 0000000 00000025240 15064466163 0016623 0 ustar 00root root 0000000 0000000 PNG
IHDR ๔xิ๚ pHYs พ5๓l tEXtSoftware www.inkscape.org๎< IDATxํ{๕๑๗c&Sย0ต7ๅE9eW*[าูuwไื=D๙ษ๎hทSิvฝ%vJ*ีฆฆคธC1ใๆ|ร0ืต>kญ๏๋๙x|=0๋๚พ3+฿ท๋บึ๕
y' เ8๋ ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8 ( 8(:ภ!$TARใ, aคFqฐ3$ติ^R#I
%5Pq ภ๛$ญ.้kIK๚TRnธ<ฯzฺnิER;Iๅ (tPา'๔คฬ 'ช ฤKบQROI$ b bTกคw%อ๔/I~OเwHtณคฟHช๏็ pิfIใ%MU๑Y_๘U Bn4Fลง ฟถJบ_า?ๆGh iขคซJ ฤG๚IZSๆ9 !I%ญ? แาQาจx->-ง{ ฒคitบ R{Mาv๊Oง 4๔คบง๚B เปฎดแT^tช ZHZ" "ลน*~PSyัฉ>TใT&