Skip to content

Latest commit

 

History

History
170 lines (111 loc) · 6.36 KB

README.md

File metadata and controls

170 lines (111 loc) · 6.36 KB

Icon GitHub Action: Setup Python

Setup Python

Marketplace Release License Stars PRs Welcome

Overview

Install Python and uv, cache downloads and synchronize locked dependencies.

Use a uv project with committed pyproject.toml, uv.lock and preferably .python-version. Explicit python-version takes precedence; otherwise uv selects from .python-version and requires-python.

Setup runs uv sync --locked: missing or stale locks fail instead of being rewritten. It installs uv's default dependency groups; optional extras require caller configuration. Configure [tool.uv].default-groups for additional groups. Declare Ruff, Black, mypy, pytest and pytest-cov in these groups to use the default lint and test actions. The fixture shows a typed src/ package with project-owned tool configuration.

Set install-dependencies: "false" for runtime-only jobs or caller-managed dependencies; pyproject.toml is still required. Working directories must stay inside the checkout. Build backends execute code during installation; Python has no general equivalent to npm's ignore-scripts switch.

Standalone setup

Check out the project before setup. Use a Linux runner supporting Node.js 24 actions and pin all actions from this repository to the same reviewed commit. Later lint, test and audit actions reuse this environment.

steps:
  - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
    with:
      persist-credentials: false
  - uses: hoverkraft-tech/ci-github-python/actions/setup-python@main
    with:
      working-directory: .

See the continuous integration workflow for orchestration and version matrices.

Usage

- uses: hoverkraft-tech/ci-github-python/actions/setup-python@4b801b911424c68370a3e713bc5404151ab4d772 # main
  with:
    # uv project directory inside the checkout.
    # Default: `.`
    working-directory: .

    # Explicit Python version. Empty uses the project's .python-version or requires-python.
    python-version: ""

    # Pinned uv release.
    # Default: `0.13.9`
    uv-version: 0.13.9

    # Synchronize locked dependencies and the project. Disable for tooling-only jobs.
    # Default: `true`
    install-dependencies: "true"

Inputs

Input Description Required Default
working-directory uv project directory inside the checkout. false .
python-version Explicit Python version. Empty uses the project's .python-version or requires-python. false -
uv-version Pinned uv release. false 0.13.9
install-dependencies Synchronize locked dependencies and the project. Disable for tooling-only jobs. false true

Outputs

Output Description
uv-version Installed uv version.

Contributing

Contributions are welcome! Please see the contributing guidelines for more details.

License

This project is licensed under the MIT License.

SPDX-License-Identifier: MIT

Copyright © 2026 hoverkraft

For more details, see the license.


This documentation was automatically generated by CI Dokumentor.