-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
A bit too strict pyproject.toml validation for uv 0.1.16 #2302
Comments
Oh hmm, I don't think this was intentional (from my perspective). Let me take a look... |
Seems like it's because we're now calling |
It works for sure with lates version of |
Awesome :) I'll take a look! |
Until astral-sh/uv#2302 is solved we should disable UV upgrade check as 0.1.16 version of `uv` does not properly validate our pyproject.toml with Draft PEP-0639 extension (licence-files).
Until astral-sh/uv#2302 is solved we should disable UV upgrade check as 0.1.16 version of `uv` does not properly validate our pyproject.toml with Draft PEP-0639 extension (licence-files).
This is weird, the error is coming from setuptools, both uv and pip are making the same It would be helpful, from both uv and pip, if on a build error it printed out the build environment, as otherwise one has to guess what happened on the build resolution. Maybe it already does that in verbose mode? |
One difference I do notice actually, uv is passing in |
My guess is that something happens in pip to prevent it from reading the config file in that case (it looks like it falls back to cwd), but not sure what. I’m probably going to disable it for us too. |
Yeah but I think pip has isolated set to false by default, I could be mistaken. |
I don't see any exception handeling in pip code for that, and what's weird is setuptools has supported If this issue is still open by this evening I'll see if I can reproduce it on uv side and put some breakpoints in the pip code and follow what's happening, as it's very difficult to statically analyze by glancing over it. |
Thanks, I'll try to repro too a little later. |
I think we may ultimately be calling different validation functions, we should be calling the |
Yeah, ok, I think it has to do with this: def warn_distutils_present():
if 'distutils' not in sys.modules:
return
if is_pypy and sys.version_info < (3, 7):
# PyPy for 3.6 unconditionally imports distutils, so bypass the warning
# https://foss.heptapod.net/pypy/pypy/-/blob/be829135bc0d758997b3566062999ee8b23872b4/lib-python/3/site.py#L250
return
import warnings
warnings.warn(
"Distutils was imported before Setuptools, but importing Setuptools "
"also replaces the `distutils` module in `sys.modules`. This may lead "
"to undesirable behaviors or errors. To avoid these issues, avoid "
"using distutils directly, ensure that setuptools is installed in the "
"traditional way (e.g. not an editable install), and/or make sure "
"that setuptools is always imported before distutils."
) |
Confirmed, our imports are getting the shimmed
|
## Summary It turns out that setuptools includes a shim to patch distutils. I'll admit that I don't fully understand why or how it's different, but this is the trick `pip` uses to ensure that it gets the "original" distutils. We actually use distutils in two places: once for the system Python scheme, and once for virtual environments. In virtualenv, they _do_ use the patched distutils, so this could deviate in ways I don't understand. Closes #2302.
Until astral-sh/uv#2302 is solved we should disable UV upgrade check as 0.1.16 version of `uv` does not properly validate our pyproject.toml with Draft PEP-0639 extension (licence-files). GitOrigin-RevId: 66f28f2fc9622813ce8e70fd2c341d73e880c90c
Until astral-sh/uv#2302 is solved we should disable UV upgrade check as 0.1.16 version of `uv` does not properly validate our pyproject.toml with Draft PEP-0639 extension (licence-files). GitOrigin-RevId: 66f28f2fc9622813ce8e70fd2c341d73e880c90c
Until astral-sh/uv#2302 is solved we should disable UV upgrade check as 0.1.16 version of `uv` does not properly validate our pyproject.toml with Draft PEP-0639 extension (licence-files). GitOrigin-RevId: 66f28f2fc9622813ce8e70fd2c341d73e880c90c
Addresses #4204 (comment) Original context in #2302
Problem description
The uv 0.1.16 started to do quite stronger validation of pyproject.toml (IMHO a bit too strong) and I think it's not good as it excludes projects that are using things on a bleeding edge. This covers for example extensions of
pyproject.toml
that are not yet accepted, but already supported by popular tools. This is especially important if the features in pyproject.toml are related to build backend not frontend, because it's quite safe to assume by projects that they can add the features if they know the backend they are using supports it.What happened
When we try to install Airflow in editable mode inside of our image with uv 0.1.16 we get this error (all works fine with uv 0.1.15) - it's the same error with
pip uninstall
andpip install
:Example failure in CI here: https://github.com/apache/airflow/actions/runs/8204894763/job/22440571526?pr=37995#step:6:1817
Context
We have an example of that in Apache Airflow. We are currently using
license-files
keys and.glob
pattern in it coming from (still Draft) https://peps.python.org/pep-0639/ - and the license-files keys is nicely supported byhatchling
1.21.1 which we use as Apache Airflow build backend. This allows us to easily add multiple licences to our sdist/wheel metadata - both Apache Licence 2.0 and 3rd-partylicences of projects that we partially vendored-in. This is a legal requirement for us to add the licences when we redistribute the software and being able to do it using dedicated mechanism for that (even if it is not yet fully accepted) is pretty useful.Here is an extract (important things only) from our pyproject.toml:
I think there are other projects that are using some upcoming features - even knowing that they might get rejected or changed, so I think better approach is to soften the validation - at least to allow some new unknown keys to appear there - maybe raise a warning and allow to silence them with a flag for those who are aware of this limitation and use
uv
for their CI/development tooling at least.The text was updated successfully, but these errors were encountered: