Skip to content
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

DOC: add details on default build options used by meson-python #338

Merged
merged 2 commits into from
Mar 21, 2023

Conversation

rgommers
Copy link
Contributor

This follows up on the n_debug default added in gh-325, documents all other default options and they are used, as well as improves the page on using pyproject.toml settings.

@rgommers rgommers added the documentation Improvements or additions to documentation label Mar 10, 2023
@rgommers rgommers force-pushed the doc-default-options branch from 4accafc to 98d14a1 Compare March 12, 2023 06:09
Copy link
Member

@FFY00 FFY00 left a comment

Choose a reason for hiding this comment

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

@rgommers thanks! I have a one comment, and a couple of suggestions, but overall looks good.

Meson offers many `built-in options <https://mesonbuild.com/Builtin-options.html>`__,
and in the vast majority of cases those have good defaults. There are a couple
of cases however where ``meson-python`` either needs to or chooses to override
those with its own defaults. To view what those are for the version of
Copy link
Member

Choose a reason for hiding this comment

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

possible improvement:

We could split the paragraph here and also document why we might choose to override the defaults. I wrote about the reasoning in #325 (comment).

We could also note that the options we do need to set are mostly for build/installation details that should not be relevant to the user. The only exception is the native file, but the user should be able to override the parts of it that make sense (IIRC everything but the Python interpreter).

Copy link
Member

Choose a reason for hiding this comment

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

If we keep meson install I would much prefer if we would get rid of the --prefix and --python.{plat,pure}lib options and use the $DESTDIR environment variable pointing to somewhere in /tmp instead. This would have the additional benefit of putting the installation directory on tmpfs, with possible significant speedups when building large wheels.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

... and also document why we might choose to override the defaults.

This I already have in a fair amount of detail.

We could also note that the options we do need to set are mostly for build/installation details that should not be relevant to the user.

I'll see if I should add a few more words of clarification, but thought it was pretty clear already.

If we keep meson install I would much prefer if we would get rid of the --prefix and --python.{plat,pure}lib options and use the $DESTDIR environment variable pointing to somewhere in /tmp instead.

That sounds potentially useful. Let's cross that bridge when we get to it I'd say; this PR adds docs for the current state of things, and if/when we add $DESTDIR they can be changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could split the paragraph here and also document why we might choose to override the defaults. I wrote about the reasoning in #325 (comment).

I checked it in more detail, and it's effectively the same as what I already have in this PR: "because Meson defaults to values that are appropriate for development, while the main purpose of meson-python is to build release artifacts."

Copy link
Member

Choose a reason for hiding this comment

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

If we keep meson install I would much prefer if we would get rid of the --prefix and --python.{plat,pure}lib options and use the $DESTDIR environment variable pointing to somewhere in /tmp instead.

I don't think this is even a question, is it 🤣? Those options and DESTDIR serve two different purposes. We only set those options for the heuristics, so they can be removed now.

Regarding DESTDIR, we already set it to a subdirectory of working_dir, which currently when using the PEP 517 hooks is always set by tempfile.TemporaryDirectory (in with_temp_working_dir), so isn't that true already?

Copy link
Member

Choose a reason for hiding this comment

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

The working dir is created inside the project directory, thus it is on the same filesystem as the project sources.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, you're right 😅. IIRC I did that to make things work properly for packagers by default, where access to /tmp might be a bit tricky. We can consider changing the default, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll leave this comment thread open, because it seems like useful info. It doesn't apply to this PR directly though; it's discussion of a potential future design change. If that materializes, the docs can simply be updated.

@rgommers rgommers force-pushed the doc-default-options branch from 98d14a1 to a760766 Compare March 14, 2023 22:35
@dnicolodi
Copy link
Member

dnicolodi commented Mar 14, 2023

It would be nice to have this combined somehow with the "Passing arguments to Meson" section. By the way, I just read that section and it contain several inaccuracies and some errors, for example all the pip command lines are wrong. I'm fixing it.

This follows up on the `n_debug` default added in mesonbuildgh-325,
documents all other default options and they are used, as well
as improves the page on using `pyproject.toml` settings.
@rgommers
Copy link
Contributor Author

It would be nice to have this combined somehow with the "Passing arguments to Meson" section.

Ah, that is new. I don't have more time to spend on this right now, maybe end of the week. It looks to me like only the end of the page overlaps. How about leaving the explanation here, and the two examples of overriding arguments can be merged into the other page (so everything after "It is possible to override these defaults, either permanently in your project or at build time.")?

@dnicolodi
Copy link
Member

Seems appropriate. I just noticed that you placed this page in the "Explanations" section. Why? I think it would be better in the "Reference" section. Anyhow, I think we can merge it as it is and tweak it up later.

@FFY00
Copy link
Member

FFY00 commented Mar 14, 2023

I think the page as-is should be in the explanations section, as its main purpose is to explain the reason behind the options we set, but it might make sense to have a page in the reference section detailing the default options we override.

@FFY00
Copy link
Member

FFY00 commented Mar 17, 2023

@rgommers feel free to apply any of the changes suggested, if you want, and then merge.

@rgommers rgommers force-pushed the doc-default-options branch from a760766 to cb1c86c Compare March 21, 2023 20:30
@rgommers
Copy link
Contributor Author

The pre-commit failure is unrelated to this PR, it complains about a missing stacklevel. I'll ignore here.

@rgommers rgommers merged commit d854680 into mesonbuild:main Mar 21, 2023
@rgommers rgommers deleted the doc-default-options branch March 21, 2023 20:40
@rgommers
Copy link
Contributor Author

All comments are addressed and CI is happy enough, so merged. Thanks for the reviews @dnicolodi and @FFY00

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

Successfully merging this pull request may close these issues.

3 participants