---
name: "Setup Python"
description: "Set up a specific version of Python and add the command-line tools to the PATH."
author: "GitHub"
inputs:
  python-version:
    description: "Version range or exact version of Python or PyPy to use, using SemVer's version range syntax. Reads from .python-version if unset."
  python-version-file:
    description: "File containing the Python version to use. Example: .python-version"
  cache:
    description: "Used to specify a package manager for caching in the default directory. Supported values: pip, pipenv, poetry."
    required: false
  architecture:
    description: "The target architecture (x86, x64, arm64) of the Python or PyPy interpreter."
  check-latest:
    description: "Set this option if you want the action to check for the latest available version that satisfies the version spec."
    default: false
  token:
    description: "The token used to authenticate when fetching Python distributions from https://github.com/actions/python-versions. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting."
    default: ${{ github.server_url == 'https://github.com' && github.token || '' }}
  cache-dependency-path:
    description: "Used to specify the path to dependency files. Supports wildcards or a list of file names for caching multiple dependencies."
  update-environment:
    description: "Set this option if you want the action to update environment variables."
    default: true
  allow-prereleases:
    description: "When 'true', a version range passed to 'python-version' input will match prerelease versions if no GA versions are found. Only 'x.y' version range is supported for CPython."
    default: false
  freethreaded:
    description: "When 'true', use the freethreaded version of Python."
    default: false
  pip-version:
    description: "Used to specify the version of pip to install with the Python. Supported format: major[.minor][.patch]."
outputs:
  python-version:
    description: "The installed Python or PyPy version. Useful when given a version range as input."
  cache-hit:
    description: "A boolean value to indicate a cache entry was found"
  python-path:
    description: "The absolute path to the Python or PyPy executable."
runs:
  using: 'node24'
  main: 'dist/setup/index.js'
  post: 'dist/cache-save/index.js'
  post-if: success()
branding:
  icon: 'code'
  color: 'yellow'
