Skip to content

Add [tool.hatch.requires-hatch] to enforce runtime constraints on Hatch version#2306

Open
pdhall99 wants to merge 2 commits into
pypa:masterfrom
pdhall99:issue-2156/hatch-version-runtime-constraints
Open

Add [tool.hatch.requires-hatch] to enforce runtime constraints on Hatch version#2306
pdhall99 wants to merge 2 commits into
pypa:masterfrom
pdhall99:issue-2156/hatch-version-runtime-constraints

Conversation

@pdhall99

@pdhall99 pdhall99 commented Jun 3, 2026

Copy link
Copy Markdown

To close #2156

I would appreciate input on:

  • Where to put the Project._check_hatch_version check. It is currently in Project.metadata.
  • Where to put the documentation. I made a new page because I wasn't sure where to put it, but I assume this is not the best solution!

@pdhall99 pdhall99 force-pushed the issue-2156/hatch-version-runtime-constraints branch from cf2f218 to 67cb4ec Compare June 6, 2026 14:40
Comment thread docs/config/requires.md Outdated
Comment thread backend/src/hatchling/metadata/core.py Outdated
@pdhall99 pdhall99 changed the title Add [tool.hatch.requires] to enforce runtime constraints on Hatch version Add [tool.hatch.requires-hatch] to enforce runtime constraints on Hatch version Jun 8, 2026
@pdhall99 pdhall99 force-pushed the issue-2156/hatch-version-runtime-constraints branch 2 times, most recently from 172c0fd to 1b81e7e Compare June 11, 2026 20:48
@pdhall99

Copy link
Copy Markdown
Author

I moved requires_hatch to ProjectConfig to avoid the build problems. But I would appreciate any input on where best to put it.

@cjames23

Copy link
Copy Markdown
Member

I think where it is now makes sense. Can you also add 1-2 tests that require internet that do not have monkeypatching. I would like to make sure the end to end works

@pdhall99 pdhall99 force-pushed the issue-2156/hatch-version-runtime-constraints branch from 1b81e7e to 7020bb8 Compare June 15, 2026 20:37
@pdhall99

pdhall99 commented Jun 15, 2026

Copy link
Copy Markdown
Author

I've added two end-to-end tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce a configuration key to require a minimum hatch version

2 participants