-
-
Notifications
You must be signed in to change notification settings - Fork 285
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
remove hard dependency on editables #1255
Conversation
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.
This is an interesting idea! The current change will break the hatch build
command because when Hatch builds projects that use Hatchling the usual mechanisms are elided for simplicity. Specifically, you would have to manually add editables
to this line.
Can you please explain precisely how this would help with bootstrapping?
Thanks for the feedback!
I was under the impression that
There's no loop it breaks or anything (editables just needs flit_core to build), but it's nice having one less package in the initial dependency tree. |
Instead of a hard dependency on editables, include it in get_requires_for_build_editable. This makes it easier to bootstrap Python and makes installation slightly faster for the typical case.
aae8687
to
89afb89
Compare
You can by doing |
Ah, I see. I don't think that's documented anywhere (or at least I couldn't find it), but I wouldn't want to introduce a change that completely breaks it. I'll push a follow up to add to https://github.com/pypa/hatch/blob/hatch-v1.9.3/src/hatch/cli/build/__init__.py#L112. |
To fix the error in CI you will have to add another line to this step and install the backend in editable mode similar to what we do for tests: hatch/.github/workflows/build-hatch.yml Line 114 in d163da9
|
Also, cool blog! I was reading this: https://gtmx.me/blog/week-of-2023-12-10/ Am I understanding correctly that after this is merged Fedora packagers would have an easier time? Specifically, I noticed that you decided to switch a package away from Hatchling.
|
cc @musicinmybrain @hroncok also for Fedora |
Thanks for this! |
Thanks! I really need to get back to my weekly reports...
Yes, this should make bootstrapping slightly easier, and I assume it'll help Fedora's downstreams (Red Hat Enterprise Linux et al.) to reduce the amount of packages it has to support. If the patch a huge burden to maintain, it's probably not worth merging, but I don't believe that's the case.
Ah, that decision was unrelated to this. My goal is for tomcli to eventually become the "blessed" way for Fedora packagers to read from and patch pyproject.toml, so I'd like it to have a very small dependency footprint so we can use it early in the overall Python dependency tree. tomcli is currently used in the hatch package to print a list of test dependencies from hatch.toml to feed to our Python dependency generator. I do prefer hatch for my other personal projects. Last year, we also switched all the antsibull* projects (Ansible build tools) from poetry to hatch, and we have been much happier with it. |
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.
Thank you!
Co-authored-by: Ofek Lev <ofekmeister@gmail.com> a5f62c2
I guess I just ran into that. ImportError: cannot import name 'EDITABLES_REQUIREMENT' from 'hatchling.builders.constants' I just upgraded to python 3.12.2 because of an OSTYPE issue, and rebuilt some packages, including hatch, just now. And I hit that. Instructions for a quick fix would be more than welcome. |
Can you please explain exactly how to reproduce the error? I haven't even released. |
I built from source. Latest. I tend to do that. Here's how to, perhaps, reproduce: pyenv install 3.12.2
pyenv shell 3.12.2
pip install build
pushd hatch.git
git checkout a5f62c2f298e7da39f1ca19877a362e8e97c2c24
python -m build --wheel
pip install dist/*.whl
popd
hatch new bugproject This last command yields the ImportError about EDITABLES_REQUIREMENT from hatchling.builders.constants. |
Perhaps hatchling also needs to be installed from git? |
Yes that's it exactly, the actual release will make sure the versions are compatible. |
Perhaps. But with version 1.9.3, on tag |
Yes, because it predates this change which has been done in both hatch and hatchling. |
So that `test_editable_mode_hatch` won't fail due to pypa/hatch#1255
Changelog: https://hatch.pypa.io/dev/history/hatchling/#hatchling-v1.22.4 Remove now optional editables dependency [1]. [1] pypa/hatch#1255 Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Since hatchling 1.22.4, editables is not a hard dependency, (it is provided by the get_requires_for_build_editable hook (pypa/hatch#1255). We need to add it as a build dependency.
Instead of a hard dependency on editables, include it in get_requires_for_build_editable. This makes it easier to bootstrap Python and makes installation slightly faster for the typical case.