pypa / hatch

Modern, extensible Python project management
https://hatch.pypa.io/latest/
MIT License
6.11k stars 310 forks source link

Support reading the default Python version from `.python-version` #1606

Closed edgarrmondragon closed 4 months ago

edgarrmondragon commented 4 months ago

This file is supported by pyenv, actions/setup-python and uv to select a Python version.

Currently Hatch supports interpreter selection via:

  1. The environment's python field.

    [tool.hatch.envs.<ENV_NAME>]
    python = "3.10"

    https://hatch.pypa.io/latest/config/environment/overview/#python-version

  2. The HATCH_PYTHON environment variable.

It would be nice if Hatch supported reading the interpreter version from .python-version, and end up with the following priority order:

  1. The environment's python
  2. HATCH_PYTHON
  3. The contents of .python-version
ofek commented 4 months ago

duplicate of https://github.com/pypa/hatch/issues/1126

edgarrmondragon commented 4 months ago

Oh, should've actually searched through existing issues 😓