pypa/hatch

Introduce a configuration key to require a minimum hatch version

Open

#2,156 创建于 2026年1月8日

在 GitHub 查看
 (4 评论) (0 反应) (1 负责人)Python (4,451 star) (240 fork)batch import
enhancementgood first issue

描述

Description

I would like to add a configuration option to specify a minimum hatch version to parse the configuration, similar to the way it can be done for Python in the pyproject.toml:

[project]
requires-python = ">=3.12"

Maybe the >= can simply be assumed and then the option could be

[tool.hatch]
requires = "1.16.2"

Likely, hatch should evaluate this option first thing and produce a simple error message prompting the user to upgrade hatch if needed.

Use case/motivation

As hatch is accumulating more features, older versions will not know how to interpret them. When such configuration features are critical, it is desirable to alert users to that fact and avoid processing a command. As an example, hatch recently started supporting dependency groups. When I define an environment with dependency groups and use hatch==1.14 to create the environment, the environment is created successfully, but dependency groups are silently ignored and the dependencies are not installed. That behavior is logical to someone following hatch development but is extremely surprising to the average project contributor. Stating the minimum required hatch version in a contribution guide is likely not strong enough.

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

贡献者指南

Introduce a configuration key to require a minimum hatch version · pypa/hatch#2156 | Good First Issue