-
-
Notifications
You must be signed in to change notification settings - Fork 306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Context formatting of project.dependencies is not standard compliant? #1331
Comments
My instinct is to close this because it's up to the user whether or not they require such features and therefore may not be compliant with the spec i.e. users who do not absolutely require this functionality will necessarily not use it. UV just added support for this use case: astral-sh/uv#2475 (comment) If you want, I could add a warning in the documentation? |
I personally think deviating from standards is dangerous and has the potential to create a lot of confusion. uv worked around it in one case, but for instance So I guess, yes, calling that out the documentation as a warning would be a good step. |
Okay, how does this sound: when Hatch introduces workspaces (which would be what users actually want) then I will change the functionality in Hatchling to be such that an option would be required to enable context formatting on static fields. There are other options like that: https://hatch.pypa.io/latest/config/metadata/#allowing-direct-references |
Actually wait, that is the current behavior because Hatchling will by default error for direct references such as local paths. So back to the beginning I suppose all I can do is add a warning because this is already doubly opt-in: once for usage and then enabling the option to make usage work. |
I suspect |
I don't know how to make the situation better than a doubly opt-in option. I could of course remove the feature but then there are users that require it. |
This seems like a pretty straightforward violation of the standards to me. Hatch should have enforced use of dynamic and put the extra information elsewhere, or not used PEP 621. (Or Hatch should swallow the world and provide its own frontend / locking / etc) Note there is one standards violating thing Hatch could do that would help. Which is, Hatch could still enforce that you have to declare
This means that anything checking |
It seems that hatchling supports context formatting in
project.dependencies
orproject.optional_dependencies
, so resulting metadata in the built artifacts differs from what is specified in pyproject.toml.However, the pyproject.toml spec says: A build back-end MUST honour statically-specified metadata (which means the metadata did not list the key in dynamic)..
So it seems that hatchling is deviating from the spec in this respect?
This is potentially problematic as some tools may rely on metadata in pyproject.toml being static as an optimization to bypass a potentially costly PEP 517 metadata preparation step. For instance this kind optimization is considered for implementation of
pip install --only-deps
.What do you think?
The text was updated successfully, but these errors were encountered: