-
Notifications
You must be signed in to change notification settings - Fork 69
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
Assorted cleanups around recording the version number #691
Conversation
3bd9a45
to
6ed5120
Compare
mesonpy is not supposed to be used as a library, thus having the version number in the __version__ attribute is not that useful. Keeping the version number in only one place makes it impossible to fail to keep the version number in sync. Having the version number in pyproject.toml along the other metadata is the most obvious thing.
6ed5120
to
0d521aa
Compare
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.
Thanks @dnicolodi! LGTM locally and GHA changes look right, so let's give them a go.
Can |
It will likely also break sklearn's build. |
How does it break building contourpy? meson-python does not have a public API, importing |
are the usages. Both look reasonable things to want to do to me (one looks like it is logging the version and one looks like it is doing an extra version check), but I'm not actively involved in either project (other than trying to build them) so can not really defend the code or agree it should be changed. |
meson-python has never documented the |
That code in Cc @ianthomas23 for ContourPy and @lesteve for scikit-learn. Could you please have a look at this? I'd recommend dropping the version check completely (it's a bit ugly/slow, and I've never seen a real need for doing this check in NumPy, SciPy or elsewhere), but if you do want a version check then |
|
The version check in scikit-learn looks strange as it is "only needed when going through pip" but pip already checks that for you based on build-system.requires? The contourpy stuff isn't a version check. It's adding a It's true this could probably be done via importlib.metadata instead. |
Yes I can change it in ContourPy, no problem. As some have mentioned here it is not checking the version, it is recording the version used to build so I can check it at runtime. Such information is very useful, e.g. just last week to see what wheels have been released with the problematic pybind11 2.13.1 (pybind/pybind11#5420). |
Using One of the reason we wanted to check the meson-python version was that there were bug fixes in meson-python 0.16, without them some of the scikit-learn tests fail with a failure that is not easy to diagnose. This is probably related to improvements in meson-python editable install #569.
The thing is that there are cases where you don't want to use |
Maybe you should simply not have Footnotes
|
That will be fragile with from-source builds. E.g., if a package depending on I think wanting to check a version number is reasonable if there were problems with editable installs. I'd just switch it to |
Using |
There is a very very long thread on Python discourse about the topic. It resulted in these guidelines https://packaging.python.org/en/latest/discussions/versioning/#accessing-version-information-at-runtime where it is clearly stated that relying on |
That is explicitly not a guideline, only a discussion. And even so, the page doesn't suggest you shouldn't use But for a package that absolutely did provide it, the discussion you linked to trivially reads as "okay, good job -- you verified that meson-python does provide it, therefore you may rely on it" which is in fact what at least two projects went ahead and did. I see nowhere in your appeal to authority, that the authority says what you say it does. We are left, instead, with a library-level API change following a common convention that people were relying on, which has now switched to a different and one-way-incompatible (subset) convention and the need for people to adapt. |
Please can we have If it helps, I am happy to take on the responsibility of a future PR to remove it here, liaising with @lesteve to ensure we get the timing correct for all parties. |
See comments to #690