astral-sh / uv

An extremely fast Python package installer and resolver, written in Rust.
https://astral.sh/
Apache License 2.0
14.67k stars 415 forks source link

Skip `get_requires_for_build_wheel` for build backends that always return `[]` #861

Open charliermarsh opened 5 months ago

charliermarsh commented 5 months ago

This is a probably-unsafe optimization we could perform, but e.g., poetry-core always returns [] (https://github.com/python-poetry/poetry-core/blob/21b00338544f52df7c3ba320f5f242a2fc815b65/src/poetry/core/masonry/api.py#L20C1-L20C1). So if we're using a version of poetry-core that we know always returns [], we could skip that step entirely.

charliermarsh commented 5 months ago

I looked at some of the others and:

Not sure what else is popular.

charliermarsh commented 5 months ago

@konstin - I feel like this would be a pretty sketchy but maybe interesting to you.

charliermarsh commented 5 months ago

(Not sure if we should do this.)

konstin commented 5 months ago

maturin also has it hardcoded: https://github.com/PyO3/maturin/blob/1369b2779a05645fe5e96fec98ef2cdffb6400eb/maturin/__init__.py#L122-L127

konstin commented 5 months ago

To list our options:

charliermarsh commented 5 months ago

Hoping the last item is fine.

charliermarsh commented 5 months ago

Although the first item would be my second choice.

sbidoul commented 4 months ago

setuptools doesn't need it (I think)

Actually setuptools does need get_requires_for_build_wheel. By default it returns wheel, but it also returns setup_requires entries.

Related: https://github.com/astral-sh/uv/issues/1582

charliermarsh commented 4 months ago

@sbidoul -- Thank you!