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
Use scikit-build-core #812
Use scikit-build-core #812
Conversation
ae41b14
to
c0bc63a
Compare
Docs has:
Don't think that was me! Is it possible to trigger the wheel build on this to see if there are any errors there? |
I also think this is unrelated, I will investigate, but cannot do it on short time scale. Thanks for this. |
You removed pybind11 as a submodule. I liked it as a submodule because it allows me to use a patched pybind11 if necessary. So far it was not necessary, but I like the flexibility. |
I looked through the changes, this looks very good. It is nice to get rid of MANIFEST.in, setup.*, and have all setup in pyproject.toml. I am not sure what the jax issue is, but I haven't run any tests on CI in a while, perhaps just the latest version is buggy. Using pipx to build the sdist is also neat. |
Next week (just got back from a small vacation) I'll work on the editable install feature. Dynamic versions also probably aren't far away, though I want to think a bit to make sure it's somewhat flexible. Using pybind11 from the python package is helpful for things like conda-forge, which want you to use the conda-forge package. It also allows us to patch the conda forge package if needed, etc. Though that wasn't too important for this if you want something different, I was mostly making sure it worked (notice it requires no path setup, it's discovered entirely automatically on including it in the pyproject.toml!) I would highly recommend not patching pybind11, that will increase the maintenance burden. It's very important to get rapid updates from upstream since we are working with the CPython developers every release to adapt to the new CPython API changes and removals (also with PyPy devs). But you could always swap if and when you did need a patch, it's not hard to change to and from a submodule. |
Good point, editable install is very important for my development, so that would be a requirement for me to make the switch. |
Please leave it as a submodule. It is not easy for me to change to and from a submodule, because it affects the builds on conda-forge etc. Patching dependencies locally is obviously a last resort and temporary solution, but I had to do this quite often for ROOT and it is nice to have that flexibility. |
Okay, I can change it next time I edit it - though it's still only a one line change to move to a fork and still take advantage of Python packaging: - "pybind11",
+ "pybind11 @ git+https://github.com/my_user/pybind11@my_branch_or_commit" (I have to do this all the time testing PRs, such as https://github.com/pybind/scikit_build_example/blob/f88b61bd45ea06e0f0e634cb5f5e2f94ea30a1ce/pyproject.toml (neither scikit-build/scikit-build-core nor pybind11 support Windows cross-compiling to ARM currently!) 😆 |
I gave it some more thought and I understand that it is easier for packaging if I use the pybind package instead of the submodule. So how about this. We leave it as it is now, but you promise to help me should I need to go back in the future to a pybind11 submodule to apply temporarily patch? I am worried that it is more than just this, because of conda-forge integration etc. |
Oh, I didn't see that. Latest patch is breaking the build now, because I changed back to dynamic version. iminuit single-sources the version from iminuit.version.py. I would prefer to source it from pyproject.toml (seems more natural), but I also need to source the root-version from somewhere, and that's why I use version.py where I can set both. Is it possible to add (and read from Python) arbitrary extra fields to [project] and read those from Python? If the answer is yes, then I could switch to single-sourcing from pyproject.toml. Different topic: the jax error seems to be related to the fact that the conversion from setup.cfg lost the pinned version for jax and jaxlib. |
The |
50ea7ce
to
8c43742
Compare
Not surprised, I accidentally converted from an older checkout, so a few things from setup.cfg were out of date.
You are allowed to add arbitrary fields to
Sure. Or I can help you get a fix into pybind11 if something like that pops up. ;) FYI, I've got experimental support for Windows ARM cross-compiles in the latest scikit-build-core release. Though next I'm working on updating cmake/ninja with ARM binaries. |
Remaining issue: The editable build is required. Without it, coverage cannot be computed. |
I am going to cherry pick most of the changes that I made here into #817 and then I will rebase this PR. |
33c7db4
to
ce6eff1
Compare
Calling the branch henryiii/chore/scikit-build-core instead of chore/scikit-build-core is messing with my git.
|
@henryiii I am learning meson now. I have been hearing good things about meson for a while, and since scipy is moving to meson, it must be about ready to replace other build systems. I saw that you also contributed to the meson-python backend. As an experiment, I ported pyhepmc to meson. scikit-hep/pyhepmc#57 It does not work yet without editable builds. Like scikit-build-core, meson-python is lacking editable builds, but the main branch already has some patches for that in place, so it looks like it is coming soon. I might directly switch to meson-build then. |
ca29163
to
0d951b7
Compare
Just a little update: meson-python is not feature complete, so I am still interested in scikit-build-core. meson is nice, but very opinionated about certain points which do not compromise any of their goals. For example, they insist on only supporting single quoted strings in meson.build files, using double quotes for a string is a syntax error. I think they should support both, similar to Python, but the issue was immediately rejected. |
0d951b7
to
222079c
Compare
Meson is very opinionated, yes. They will still continue to insist their syntax is "python-like". 😆 I'm funded for three years to work on scikit-build-core, so quite excited for its prospects, and quite a few projects are signed up as well; sadly numpy & scipy had already picked and started on their path by the time the proposal was written. |
222079c
to
7b8cdf5
Compare
For fun, you can try this: $ pip install -e . --config-settings=editable.rebuild=true
Obtaining file:///Users/henryschreiner/git/scikit-hep/iminuit
Installing build dependencies ... done
Checking if build backend supports build_editable ... done
Getting requirements to build editable ... done
Preparing editable metadata (pyproject.toml) ... done
Requirement already satisfied: numpy>=1.21 in ./.venv/lib/python3.11/site-packages (from iminuit==2.21.3) (1.24.2)
Building wheels for collected packages: iminuit
Building editable for iminuit (pyproject.toml) ... done
Created wheel for iminuit: filename=iminuit-2.21.3-cp311-cp311-macosx_13_0_x86_64.whl size=304665 sha256=205bdb06cf7aa36e88c44910f11ff3c720c5986b1b808d98e7a28572823bbc97
Stored in directory: /private/var/folders/_8/xtbws09n017fbzdx9dmgnyyr0000gn/T/pip-ephem-wheel-cache-uizgv9z7/wheels/62/35/41/f343e1b93de090027587867560b61d3e7342041d5d41f4ddfe
Successfully built iminuit
Installing collected packages: iminuit
Attempting uninstall: iminuit
Found existing installation: iminuit 2.21.3
Uninstalling iminuit-2.21.3:
Successfully uninstalled iminuit-2.21.3
Successfully installed iminuit-2.21.3
$ sed -i "" '24i
$ py::print("Hello from live editable mode");
$ ' src/main.cpp
$ python -c 'import iminuit'
Hello from live editable mode 😄 |
That is a cool and impressive feature! It goes beyond what I usually need (I rarely need to touch the C++ layer), so it is not a must-have for me, but it is cool. |
Note:
It worked after It takes really long to run without producing any output, even though I have ccache installed. I think it would be better to produce verbose output when using this feature. The quiet pip is good for end-users, which do not need to see what's under the hood, but as a developer you generally want to know. |
Yes, you should probably always use this with |
🤔 I'm actually unable to find a quote for that in the docs, and the closest I can find is:
Which isn't very close, really.
People keep hitting this issue in every build backend offering editable installs, seems like. Maybe pip should just disable isolation when editable installs are in use! The current state of affairs seems like really bad UX. |
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> iminuit single sources version from iminuit.__version__, replace Piti with Hans as author try to fix doc build single-sourcing version from pyproject.toml fix coverage try ccache fix fix fix local fix jupyter warning fix fix
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
1fc7214
to
9b5c49c
Compare
This would be a bit surprising as well, since it would cause |
@henryiii Thank you very much for this work. |
Using scikit-build-core (closes #811).
Ready for review:
scikit-build-core is not on conda-forge yet (though I might try this patch on it when it does go in).is not supported yet, so that's an expected failure.are not supported yet (though that might be coming soon). [solved by not using dynamic version]If the current version does any build caching,
that's also not supported yet.