Skip to content

Introduce a configuration key to require a minimum hatch version #2156

@Midnighter

Description

@Midnighter

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions