Skip to content
Latchkey

What Is a .python-version file?

a .python-version file explained, including what it does and how it matters in CI/CD.

A .python-version file declares the Python version a project uses, read by pyenv.

What it is

It ensures the same interpreter version locally and in CI, avoiding subtle behavior differences across Python releases.

Why it matters in CI/CD

In CI, actions/setup-python can read it via python-version-file so the runner installs the matching interpreter.

Key takeaways

  • .python-version pins the Python version.
  • pyenv and setup-python read it.
  • Keeps interpreter versions consistent.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →