.python-version ファイルとは?
.python-version ファイルの解説。何をするものか、そして CI/CD でなぜ重要かを含みます。
.python-version ファイルは、プロジェクトが使う Python のバージョンを宣言し、pyenv が読み取ります。
何であるか
ローカルと CI で同じインタプリタのバージョンを保証し、Python のリリース間の微妙な動作の違いを避けます。
CI/CD でなぜ重要か
CI では、actions/setup-python が python-version-file を介してそれを読み取れるため、runner が対応するインタプリタをインストールします。
重要なポイント
- .python-version は Python のバージョンを固定します。
- pyenv と setup-python がそれを読み取ります。
- インタプリタのバージョンを一貫させます。
関連ガイド
What Is pyproject.toml?pyproject.toml is the modern Python project config. Learn what it declares for CI.
What Is a GitHub Actions Runner?A runner is the machine that executes a GitHub Actions job. It can be GitHub-hosted, self-hosted, or a manage…
What Is an Interpreter? Running Code Line by LineAn interpreter executes source code directly at runtime instead of compiling it ahead of time. Learn how inte…