Jump to content

.python Version -

asdf is a universal version manager (supports Node.js, Ruby, Go, etc.). It also respects .python-version files, making it a drop-in replacement for pyenv in many workflows.

If you are looking to generate or understand a .python-version file, this is a configuration file used by version managers (like pyenv) to automatically switch Python versions when entering a specific project directory.

How to create one: You can create this file manually or via CLI tools. .python version

Using pyenv:

# Sets the local version to 3.10.5
pyenv local 3.10.5

This automatically creates a .python-version file in your current directory. asdf is a universal version manager (supports Node

Manual Creation: Create a file named .python-version and add the version number as the only content.

3.9.13

How it works: When you cd into that directory, tools like pyenv, rye, or poetry read this file and instantly switch the active Python interpreter to that specific version. This automatically creates a


In your CI pipeline, you can read the file dynamically:

- name: Setup Python
  uses: actions/setup-python@v5
  with:
    python-version-file: '.python-version'

This ensures your CI runs the exact same version as developers.

You might wonder, “Why can’t I just use whatever Python is on my PATH?”

Here are three scenarios that will convince you otherwise:

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.