Skip to content

ENH: add tool.meson-python.wheel.exclude setting #766

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dnicolodi
Copy link
Member

@dnicolodi dnicolodi commented Jun 14, 2025

I am not entirely sure we want to include this facility: it may potentially be abused when better solutions exist. However, I think it is better than the solution we currently recommend https://mesonbuild.com/meson-python/how-to-guides/shared-libraries.html#shared-library-from-subproject of adding specific options to subprojects to exclude this or that parts from the installation.

@dnicolodi dnicolodi force-pushed the wheel-exclude branch 5 times, most recently from e61dd88 to 6b98023 Compare June 14, 2025 13:36
@dnicolodi
Copy link
Member Author

Another idea I was toying with is to extend the filtering by meson install tags to allow to specify different tags per subproject. meson-python does not rely on the meson implementation of the filtering anyway, thus extending the facility is possible.

@dnicolodi dnicolodi added the enhancement New feature or request label Jun 24, 2025
@rgommers rgommers changed the title EHN: add tool.meson-python.wheel.exclude setting ENH: add tool.meson-python.wheel.exclude setting Jul 15, 2025
Copy link
Contributor

@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.

Thanks @dnicolodi! I like this. Agreed that these unmappable install locations/targets are a pain point, and this is a nice and ergonomic solution I think.

The wheel.exclude name is good, and it matches the name in scikit-build-core which is helpful.

One question about using introspection metadata locations. I can see that working, but there's also an alternative of using wheel locations - I'm not quite sure which is better.


[tool.meson-python.wheel]
# Meson versions before 1.3.0 install data files in {datadir}/{project name}/,
# later versions install in the more correct {datadir}/{dubproject name}/
Copy link
Contributor

Choose a reason for hiding this comment

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

typo dubproject

@@ -5,3 +5,8 @@
[build-system]
build-backend = 'mesonpy'
requires = ['meson-python']

[tool.meson-python.wheel]
# Meson versions before 1.3.0 install data files in {datadir}/{project name}/,
Copy link
Contributor

Choose a reason for hiding this comment

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

It'd be fine to support this for meson>=1.3.0 only I think.

@rgommers
Copy link
Contributor

Another idea I was toying with is to extend the filtering by meson install tags to allow to specify different tags per subproject. meson-python does not rely on the meson implementation of the filtering anyway, thus extending the facility is possible.

That may still require changes to the subproject itself (e.g., there are multiple shared libraries and you need only one of them), so is less general. I prefer wheel.exclude because of that.

@dnicolodi
Copy link
Member Author

We could also consider implementing both wheel.exclude and wheel.include so that the first could be used to exclude a whole subtree and the latter to include selected files in the same subtree.

@rgommers
Copy link
Contributor

We could also consider implementing both wheel.exclude and wheel.include so that the first could be used to exclude a whole subtree and the latter to include selected files in the same subtree.

I can see the appeal of that, yes. Especially on projects with lots of install targets, that seems nice. Although the cases where you can't make things concise with excluding install tags + wheel.exclude may be a small minority.

This could be done immediately, or later if there's demand. Given this PR is very nice and clean, may be okay to add it immediately?

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

Successfully merging this pull request may close these issues.

2 participants