-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Switch build backend to hatchling #12173
Switch build backend to hatchling #12173
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.
why did you delete the manifest? note that data files we have in the package for testing cannot be part of the source package otherwise it's too big.
Do we really have to live on the edge? setuptools is really the standard and if it has problem why not fix it rather coming up with a new way that much fewer people are likely to know and are able to maintain? #grumpy agramfort
;)
Yes I checked, these files are excluded :) I will check again just to be sure.
It's just an experiment for now to see if it works and how much change it would require. Like I said in #12169 I can also live with doing But also note that in the medium-to-long-run, we will have to move away from Moving the dependencies into |
That said, it will be easier to maintain a couple years down the road, because this is now the standardized way of doing things |
I am very much in favor of moving completely to However, I would rethink our current extra dependencies. In particular, I don't like that we still keep some We could also remove the Regarding Alex's comment about |
How about this: I'd also like to emphasize that Hatch and hatchling are developed by the PyPA team and they use it for example for Black. So it's not just a fancy new experimental thing, but a tool developed and used by the group that makes and maintains the packaging standards. As for moving dev and doc build dependencies into pyproject.toml as well, this is ultimately a matter of taste, I would say. Esp for the doc deps, these are rather "concrete" (explicit installation of dev versions of many packages, directly from their git repo), hence I'm leaning toward leaving them in a requirements file. And for the testing deps, if we move them to pyproject.toml, the workflow for developers changes. I didn't dare touch it for this reason... Black also has the dev deps only in a requirements file. In the end, again, it's probably a matter of taste. (For NPM projects, you always list dev deps in a separate section inside package.json, which I actually always liked) |
How does that work now? I don't see new added lines for that in the diff 🤔 In general In am in favor of this move. Especially, because I agree with:
and
|
FWIW they even use hatchling as the default build backend in their tutorials:
For file inclusion: by default, now pretty much everything inside the package dir is included automatically. There are some exceptions and our testing datasets seem to be among those. We can make it explicit, though. Exclusions can be specified like here: CI error shows that I'm still failing to include some files. We just have to use the |
👍 for making exclusions explicit. |
Thanks!
IMHO, explicit would be more transparent and readable. |
I don't mind trying out But @hoechenberger it might indeed be easier to start out with a first PR that pushes us toward
I don't think we should do that here -- @hoechenberger has done a good job so far of keeping the current PR backward compatible. Things like removing |
@larsoner Will do. Do you have any opinion regarding the dev dependencies? Would you rather see them added to pyproject.toml too, or keep them separate in requirements files? What about the current |
IMO the end result should be no
|
Works for me @drammock ! |
Yes, I actually came up with this solution on my first iteration but didn't dare push it for fear of too much change (and too little time for proper change management on my side) 😅😅 I've got something to work with now. |
@hoechenberger how about we try this out with mne-bids-pipeline for a few months first? Then if all is good there then we switch MNE-Python over, too. |
Yes why not I'm already using hatchling with mne-python-stubs and it works beautifully, maybe this can serve as a starting point |
Maintainer of Hatch/Hatchling here! Let me know if I can be of assistance 🙂 |
Fixes #12169
build
frontend to begin with, before moving on topip
) forces us to let go of some setuptools-specific implementation details. Specifically, we have to say goodbye toMANIFEST.in
and dynamic dependency generation insetup.py
– which is a good thing! Dependencies have to be specified inside ofpyproject.toml
requirements_base.txt
toproject.dependencies
(no behavior change whenpip
-installingmne
)requirements_hdf5.txt
toproject.optional-dependencies.hdf5
(no behavior change whenpip
-installingmne[hdf5]
)requirements.txt
toproject.optional-dependencies.full
(new option:pip install mne[full]
)This allowed me to delete those
requirements
files. They were only containing abstract dependencies; hence,pyproject.toml
is the better place for those dependency specifications anyway.(btw there were also inconsistencies e.g. between the NumPy versions listed in
requirements_base.txt
andrequirements.txt
)As for the
[test]
variant we currently have – I found this isn't documented anywhere. Instead, all our contribution docs state thatrequirements_testing.txt
should be used. To keep friction as low as possible, I keptrequirements_testing.txt
andrequirements_testing_extra.txt
, but removed themne[test]
variant in order not to have to duplicate dependency specifications.For the doc requirements, I also didn't change any of the existing behavior (no new variant; we stick with
requirements_doc.txt
)After these changes were complete, I could remove
setup.py
.generate_codemeta.py
needs to be updated – I don't really know what this is used for and what the best approach here would be, but since I removedsetup.py
andrequirements.txt
, these lines will certainly not work anymore:mne-python/tools/generate_codemeta.py
Lines 110 to 122 in ec87fd8
The changes to
.git_archival.txt
shall ensure that VCS version detection also works when downloading an archive of the repository (maybe some of you remember that this used to be a problem after we switched to usingsetuptools-scm
)💬 Any feedback would be greatly appreciated. Please test as "regular" install; as editable install; install from sdist; install from wheel. Thank you! 😊