Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
build: Switch to using Hatchling as build backend #2095
build: Switch to using Hatchling as build backend #2095
Changes from 33 commits
7ab62c1
eda4b1e
d79fe48
1377f19
c1cc7cf
3395c50
7e4c78c
e5b3e40
fab3baf
38cda4a
4b09eec
174da49
10668ec
3cfce28
d73b955
a0ba25f
da9f3e8
898dcf1
ebb29a9
eb23550
2e6c999
635e9c4
0cd6311
8df4a84
1715356
02263a8
9687fae
1f3750c
ae5b0d7
68c180c
1bf9c0e
4a4da3e
9ca5b12
f3ebf0e
6770b70
d1fe796
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay so with the addition of
only-include
theschemas
dir is getting properly picked up by the sdist.I'm a bit confused though given the docs https://hatch.pypa.io/latest/config/build/#packages
what "final component" means. Though there seems to be no difference in behavior between including or not including
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
packages
is likeonly-include
combined withsources
, wheresources
would besources = ["src"]
for this example. It means thatpackages = ["src/this/that/foo/bar"]
would behave likei.e. the final path component (
bar
) is the name of the package as included in the final wheel (because it's taken relative tosources
).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So is the reason that removing
didn't have any effect is because we're using
only-include
for[tool.hatch.build.targets.sdist]
and we only have one package directory in
src/
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, the original issue that we were fixing with
only-include
has been fixed (I think) by copying the schemas into the docs at docs time: 81a429eSo we don't need this explicitly. I found that reverting
9ca5b12
didn't leave the schemas out of the sdist or wheel for me. If you revert9ca5b12
and keep4a4da3e
, what do you see?i.e., I think the default Hatch build configuration should pick everything up. But, if you want to use e.g.
only-include
, you can for other reasonsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just being verbose here for ease. This might be your understanding too, but I want to be sure we are all on the same page! :)
Python
build --wheel
is doing the recommended thing ofsdist → wheel
. Hatch's default file inclusion logic always picks up thepyhf/schemas
directory, but the symlinked schemas indocs/_extras/
cause this to fail. Eliminating these from the SDist (manually, withonly-include
et al.) means that the wheel builder then succeeds with default inclusion logic, assuming that indeed we gosdist → wheel
.Meanwhile,
hatch build --target wheel
doesn't dosdist → wheel
, and therefore the wheel build suffers the same problem as the sdist; the schemas are found, but encountered under the wrong (excluded) path (docs/_extras
)So we definitely need an
only-include
like directive in bothtargets.sdist
andtargets.wheel
whilst we have these duplicate schemas.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's exactly correct. From
python -m build --help
:so my
python -m build --wheel .
is building from the srcdir, and not from sdist (the default behavior).I agree on the rest though, except that I think from the above
targets.wheel
doesn't need theonly-include
like directive but that I want to leave it in regardless.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gah, then "
Python build --wheel
is not doing the recommended thing ofsdist → wheel
" 😆Admission time ... I discovered my environment didn't fully upgrade; I was evaluating
hatch
behaviour in-part based upon CLI exploration. I upgradedhatchling
to the newest version explicitly, and the different results that I was seeing evaporated. I had been confused that we seemed to be drawing different conclusions.Now Ofek's points make more sense — for the SDist, we need to curtail the default search for the above reasons, but the wheel builder works fine due to the comment from Ofek that you linked!
So my view is different now; we don't need that setting, and we only added it because it fixes an annoying build problem. As long as hatchling's PEP 517 hook produces a good wheel when used without an intermediate sdist (which it does), it should be fine to remove it. So, your call, but I think you can safely remove it!
Sorry for the wild goose chase. I had thought I was being helpful, but with the above context I can see it was actually just confusing things!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing to apologize about, you have been beyond helpful. :)
✔️ 👍 We are in agreement on understanding now!
We can remove it but keeping it in skips all of
https://github.com/pypa/hatch/blob/hatchling-v1.12.2/backend/src/hatchling/builders/wheel.py#L172-L200
which while I'm sure is only a few microseconds, seems like a "why not just leave in 2 lines?" question to me now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hatch currently does not build the wheel from the source distribution. I plan to do that but I don't have time currently. It would actually be useful if you did open an issue so I can track it
This file was deleted.
This file was deleted.