Open tiptenbrink opened 1 month ago
Interesting, I've never seen this -- thanks for raising. Looks like it's https://github.com/pypa/pip/issues/11325 in pip.
Interesting. I wonder if there should be a way to express this in the CLI as well.
Small note: If anyone is running into my specific use case: if you use hatchling instead of setuptools as your build backend, pyright will work by default.
Also faced with this issue unfortunately; https://github.com/microsoft/LightGBM/pull/6493
TLDR; LightGBM throws errors on build arguments it doesn't understand. Hence it fails to uv sync
when I have both editable installations (requiring editable_mode=strict
) and LightGBM
.
Arguably, LightGBM
should ignore the arguments. However, there is also a case to be made that we should not pass the editable build args to each individual item.
Considering some options here...
--config-setting <package-name>__<key>=<val>
e.g. --config-setting foo__editable_mode=strict
--config-setting <package>=<key=val>
e.g. --config-setting foo=editable_mode=strict
--config-setting-includes <package>
only pass config settings to the given packages--config-setting-excludes <package
pass config settings to all packages but the given packages--config-setting-includes <package>=<key>
only pass the given config setting to the given packages--config-setting-excludes <package>=<key>
do not pass the given config setting to the given packages
In #1460, the CLI gained support for passing config_settings to the build backend. However, sometimes you want to pass these settings only for specific requirements (or simply you don't want to have to write it in the CLI each time).
If you use
pip install -r requirements.txt
, this is a valid line inside a requirements.txt:However,
uv
will fail with:Now, I can still get things to work if I pass the
--config-settings editable_mode=strict
to the CLI, but it's quite tedious to always have to do that. Furthermore, maybe I'd not want to pass it for a different requirement, but now it applies to all of them.Note that the same also doesn't work with
uv pip compile
(when putting the--config-settings editable_mode=strict
inside a requirements.in) and also not withuv pip sync
.It would be awesome if
uv
could parse the--config-settings
inside a requirements.txt file.Why is this useful?
If you use an editable install of a package built with setuptools, you need to pass either
editable_mode=compat
oreditable_mode=strict
in order for pyright/pylance typing to work for the package (see this StackOverflow question). Supporting this means that it becomes a lot simpler to depend on other local packages without requiring them to be fully factored out as PyPI or Git repository packages (all you need is a very basic pyproject.toml with setuptools as the build backend).My example setup looks like this:
Also, thanks for this great project! Using it has been a blast so far!