8000 Support filtering variant dependencies from build reqs by mgorny · Pull Request #1 · wheelnext/build · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Support filtering variant dependencies from build reqs #1

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mgorny
Copy link
@mgorny mgorny commented Apr 12, 2025

xref: wheelnext/variantlib#32

The idea is that e.g. in numpy we can do:

[build-system]
build-backend = "mesonpy"
requires = [
    "meson-python @ https://github.com/mgorny/meson-python/archive/wheel-variants.tar.gz",
    "Cython>=3.0.6",  # keep in sync with version check in meson.build
    "variant_x86_64 @ https://github.com/wheelnext/variant_x86_64/archive/main.tar.gz ; 'x86_64' in variants"
]

And build uses variantlib to preprocess the 'x86_64' in variants specifier, so that uv/pip can handle the resulting deps. Not saying the design is neat, but should be good enough for a demo.

Copy link
@rgommers rgommers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks like it'll work as advertised, only some minor comments.

variant_x86_64; 'x86_64' in variants

My one more substantial comment is that the semantics of this syntax may need to become more well-defined. This intuitively feels circular: depend on the x86-64 plugin if x86-64 is in the environment (which perhaps we can only know if we have the x86-64 plugin already?).

@@ -36,6 +36,7 @@ dynamic = ["version"]
dependencies = [
"packaging >= 19.1",
"pyproject_hooks",
"variantlib @ https://github.com/wheelnext/variantlib/archive/main.tar.gz",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these @ https://github.com/wheelnext still easy enough to work with? It seems like a uv workspace with a collection of all these forks of packages as editable is going to be needed at some point.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Easy" is not a word I'd use. It's quite annoying for development work (I basically uv pip install -e ... this package, then uv pip install -e ... variantlib to have it return to the development copy). However, it makes "release" installs easier when variantlib is not yet on the official index.

self,
dependencies: set[str],
config_settings: ConfigSettings | None = None,
) -> set[str]:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic is probably right; a docstring or some code comments will be helpful before merging though. Just from reading the code it's hard to tell, and navigating to evaluate_variant_requirements loses context.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capturing in filter_variants that this is demo-only and specific to pypa/build and probably not quite suitable for a final design will be useful here - at least for me, it's the kind of thing I'd forget over time.

@mgorny
Copy link
Author
mgorny commented Apr 30, 2025

variant_x86_64; 'x86_64' in variants

My one more substantial comment is that the semantics of this syntax may need to become more well-defined. This intuitively feels circular: depend on the x86-64 plugin if x86-64 is in the environment (which perhaps we can only know if we have the x86-64 plugin already?).

This is a slightly different case than runtime dependencies. Here 'x86_64' in variants means "the user has passed -Cvariant=x86_64::... or -Cvariant-name=x86_64::..." — which means we need the plugin at least to be able to verify whether the variant name is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0