diff --git a/docs/README.md b/docs/README.md index 1a9d9852c4..12de02829a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -151,16 +151,18 @@ if sys.version_info >= (3, 10): print(sys.stdlib_module_names) ``` -By default, the lower bound of the project's [`requires-python`](<(https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#python-requires)>) field (from the `pyproject.toml`) is +By default, the lower bound of the project's [`requires-python`](https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#python-requires) field (from the `pyproject.toml`) is used as the target Python version, ensuring that features and symbols only available in newer Python versions are not used. -If the `requires-python` field is not available, the latest stable version supported by ty is used, -which is currently 3.13. +If the `requires-python` field is not available but a virtual environment *has* been +configured or detected, ty will try to infer the Python version being used from the virtual +environment's metadata. -ty will not infer the Python version from the Python environment at this time. +If no virtual environment is present or inferring the Python version from the metadata fails, +ty will fall back to the latest stable Python version supported by ty (currently 3.13). -The Python version may be explicitly specified using the +The Python version may also be explicitly specified using the [`python-version`](./reference/configuration.md#python-version) setting or the [`--python-version`](./reference/cli.md#ty-check--python-version) flag.