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

Update help for python resolves with recent improvements #15228

Merged
merged 2 commits into from
Apr 25, 2022

Conversation

Eric-Arellano
Copy link
Contributor

This includes the changes from #14775, which were only applied to 2.10.

[ci skip-rust]
[ci skip-build-wheels]

# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
Copy link
Contributor Author

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

Hats off to @thejcannon for softwrap. This was so much more enjoyable to edit than before.

@@ -85,77 +85,30 @@ class PythonSetup(Subsystem):
),
advanced=True,
)
requirement_constraints = FileOption(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to lower in the file, so that they show up later in help. We don't want any newcomers using this.

Comment on lines +155 to +157
python_sources(
resolve=parametrize("data-science", "web-app"),
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@thejcannon I could not find our discussion from last week about this. Do you remember if this is right? No need for back ticks?

Copy link
Member

Choose a reason for hiding this comment

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

I never verified, but according to Markdown it's code because it's indented. The console will just dump whatever.
So depends on if we care about the console

Copy link
Member

Choose a reason for hiding this comment

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

There are examples for how readme treats this from the docker backend (indented block is code).

So depends on if we care about the console

What do you mean?
As you said, the console dumps whatever, so we don't have to "care about the console", just care about the experience the user has when reading this text on the console, which perhaps is what you meant? In which case I'm in favour of excluding the backticks to reduce the noise, on the console. (as the backticks does nothing for the markdown, when the block is also indented).

Copy link
Member

Choose a reason for hiding this comment

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

help=softwrap(
"""
Configure Docker registries. The schema for a registry entry is as follows:
{
"registry-alias": {
"address": "registry-domain:port",
"default": bool,
"extra_image_tags": [],
"skip_push": bool,
},
...
}
If no registries are provided in a `docker_image` target, then all default

https://www.pantsbuild.org/docs/reference-docker#section-registries

Copy link
Member

Choose a reason for hiding this comment

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

@Eric-Arellano perhaps we want to record this doc nuance in the https://www.pantsbuild.org/docs/style-guide ? :)

Pants will error explaining the incompatibility.

The keys must be defined as resolves in `[python].resolves`.
"""
),
advanced=True,
)
no_binary = StrListOption(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved to lower in the file. We have a block of about 10 lockfile related options, and this was in the middle.

Comment on lines 317 to 333
help=softwrap(
"""
When resolving third-party requirements for your own code (vs. tools you run),
use this constraints file to determine which versions to use.

Mutually exclusive with `[python].enable_resolves`, which we generally recommend as an
improvement over constraints file, including due to less supply chain risk thanks to
`--hash` support.

See https://pip.pypa.io/en/stable/user_guide/#constraints-files for more
information on the format of constraint files and how constraints are applied in
Pex and pip.

This only applies when resolving user requirements, rather than tools you run
like Black and Pytest. To constrain tools, set `[tool].lockfile`, e.g.
`[black].lockfile`.
"""
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is all the same except for the second paragraph, which is copied from 2.10

default=True,
help=softwrap(
"""
(Only relevant when using `[python].requirement_constraints.`) If enabled, when
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This first sentence is new and from 2.10

"--no-binary",
help=softwrap(
"""
Do not use binary packages (i.e., wheels) for these 3rdparty projects.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The text is the same, but I added paragraph breaks. I also re-worded the last paragraph to be more accurate and concise

"--only-binary",
help=softwrap(
"""
Do not use source packages (i.e., sdists) for these 3rdparty projects.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ditto. I added paragraph breaks and re-worded the last paragraph.

Copy link
Contributor

@benjyw benjyw left a comment

Choose a reason for hiding this comment

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

Nice! Some phrasing and grammar comments.

lockfile/constraints file instead of just the relevant subset. This can improve
lockfile file instead of just the relevant subset.

We generally do not recommend this if `[python].lockfile_generator` is set to `"pex"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Help should not usually appeal to history, so the whole performance enhancements story is more complicating than helpful. How about just:

"This yields better performance in some cases, but we generally do not recommend this if ..., as pex lockfiles have equivalent performance, and better cache utilization, in most cases."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Help should not usually appeal to history

Good point. That book I've been reading on technical writing made the same point

Copy link
Contributor

Choose a reason for hiding this comment

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

You've deleted the performance rationale for this option, so readers now have no clue why they might use this. There may still be perf benefits in some cases. We have not yet really proven that subsetting is now better in all cases. So some users may still need this option for performance, and we should mention that this is so. E.g., the phrasing I suggested above.

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 don't think I did? Read the next paragraph

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see, weird sequencing. You have to read through the arguments against using this option before you see any arguments for why you might want to try it. But It's probably fine.

Copy link
Contributor

Choose a reason for hiding this comment

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

I still wouldn't reference "performance enhancements we've made". The reader won't have a baseline of what that means, i.e., performance of what compared to what.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You have to read through the arguments against using this option before you see any arguments for why you might want to try it.

Yeah. Josh is pretty sure we will want to deprecate this once the dust settles. So I'm trying to discourage usage

# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
lockfile/constraints file instead of just the relevant subset. This can improve
lockfile file instead of just the relevant subset.

We generally do not recommend this if `[python].lockfile_generator` is set to `"pex"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see, weird sequencing. You have to read through the arguments against using this option before you see any arguments for why you might want to try it. But It's probably fine.

lockfile/constraints file instead of just the relevant subset. This can improve
lockfile file instead of just the relevant subset.

We generally do not recommend this if `[python].lockfile_generator` is set to `"pex"`
Copy link
Contributor

Choose a reason for hiding this comment

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

I still wouldn't reference "performance enhancements we've made". The reader won't have a baseline of what that means, i.e., performance of what compared to what.

@Eric-Arellano Eric-Arellano merged commit 9726c85 into pantsbuild:main Apr 25, 2022
@Eric-Arellano Eric-Arellano deleted the refresh-python-help branch April 25, 2022 19:52
@Eric-Arellano Eric-Arellano removed this from the 2.11.x milestone Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants