-
Notifications
You must be signed in to change notification settings - Fork 85
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
Chore: use Hatch build backend #1888
Conversation
b49d0e3
to
d4d8a26
Compare
for more information, see https://pre-commit.ci
I'm not sure I have any interest in using hatch for library development. For applications sure, but I'm not sold on switching over to it for library work yet. |
I'm going to close this as I don't think this is PR ready before a discussion is had. |
OK. My thought process here was to create a draft PR that moves the metadata into the standardised PEP 621 format. Hatch is only one of several build backends that support this new format (e.g. flit, pdm), so one isn't limited to Hatch. For posterity, this really just changes what happens when you run |
@matthewfeickert Hey, Hatch maintainer here!
That's very interesting; what makes you say that? Everyone else says the opposite due to not supporting lock files currently. |
@ofek sorry — low sleep and reading fast when I sent that — I mentally got Congrats on having I'll follow pypa/hatch#276 and once that is revised @agoose77 can open a GitHub Issue in |
This will fix builds for you https://hatch.pypa.io/latest/config/build/#explicit-selection |
@agoose77 can I charge you with reminding me to look into reopening this next week? |
Actually, a follow up question: After our Slack discussion today I'm trying to poke around a bit myself (branch I notice after I build a sdist and wheel that the sdist has a $ rm -rf dist && python -m build . && python -m tarfile --list dist/pyhf*.tar.gz | grep .gitignore
* Creating virtualenv isolated environment...
* Installing packages in isolated environment... (hatch-vcs, hatchling)
* Getting build dependencies for sdist...
* Building sdist...
* Building wheel from sdist
* Creating virtualenv isolated environment...
* Installing packages in isolated environment... (hatch-vcs, hatchling)
* Getting build dependencies for wheel...
* Building wheel...
Successfully built pyhf-0.7.1.dev46+g174da491.d20230118.tar.gz and pyhf-0.7.1.dev46+g174da491.d20230118-py3-none-any.whl
pyhf-0.7.1.dev46+g174da491.d20230118/.gitignore the sdist is not a Git repository, so why is this file included here if I'm explictily excluding it in # ...
[tool.hatch]
version.source = "vcs"
build.hooks.vcs.version-file = "src/pyhf/_version.py"
[tool.hatch.build.targets.sdist]
exclude = [
"/.gitignore",
"/src/conftest.py",
]
include = [
"/src",
"/LICENSE",
"/README.rst",
"/pyproject.toml",
"/AUTHORS",
"/CITATION.cff"
]
[tool.hatch.build.targets.wheel]
packages = ["src/pyhf"]
# ... |
https://hatch.pypa.io/latest/plugins/builder/sdist/#default-file-selection It is so builds are reproducible |
Hm okay thanks. I'll not ask you to explain why including this makes things reproducible (or rather why excluding it leads to unreproducible builds) as I will assume that is covered somewhere on GitHub if I dig enough. I'm still coming from the |
Oh sorry yes I should explain. What I mean is that builds can occur in different contexts and Hatchling tries its best to ensure the artifacts are consistent. So for example, if you build from a Git checkout you would get one set of files because the ignore file is available but when building from a source distribution you would likely get a different set of files without the extra exclusion rules. |
Thanks that's quite generous of your time — I wasn't trying to be sarcastic, I just didn't think it was worth your time as I know you've put in huge amounts of effort to have good reason here.
Ah thanks very much for this nice example. I now understand that this really does mean a |
@agoose77 I can't reopen this PR as |
Description
Setuptools as a build backend is getting fairly long in the tooth. A few consequences of this are:
The new selection of PEP517 builders means that we can simplify our build backend, whilst also making things future-proof!
TODO:
Checklist Before Requesting Reviewer
Before Merging
For the PR Assignees: