Add export option: py_hermetic_scripts#20763
Conversation
|
Just exploring design space: what do you think about a separate option In my mind, that seems like it might be nicer if/when we allow non-hermtic immutable venvs too, but potentially in the short term might lead to having to have a dedicated error about "cannot specify |
|
To support non-hermetic scripts with symlinked immutable, we would probably have to have a separate cache. I think that would eliminate a lot of the benefits of using the symlink. So if someone wants to use non-hermetic scripts, they should probably go with a mutable venv. I could turn this into a boolean, and error if it is true when the mode is symlinked immutable. I'm not sure that that is better. If we added a
This is the whati have implemented: [export]
py_resolve_format = "mutable_virtualenv_with_non_hermetic_scripts"
py_editable_in_resolve = [...]This is one possible Boolean: [export]
py_resolve_format = "mutable_virtualenv"
py_hermetic_scripts = false # defaults to true
py_editable_in_resolve = [...]And this is another: [export]
py_resolve_format = "mutable_virtualenv"
py_non_hermetic_scripts = true # defaults to false
py_editable_in_resolve = [...]Considering those options, I think I prefer the option with I will adjust this PR accordingly. |
I'm not entirely clued in, but without context, I also prefer |
|
Thanks @huonw. The I didn't add any validation logic that errors if someone has |
For me, I think pants should not complain about options not being in effect. |
huonw
left a comment
There was a problem hiding this comment.
Thanks, looks great.
Keying off the the py_editable_in_resolve option behaviour sounds good, but I'm in two minds about the validation for both of the options. Not enough to block the incremental improvement, though.
In particular, if someone has the following, it seems... unhelpful for Pants to blithely ignore py_hermetic_scripts and not provide the user any hints about it. If they're not getting the behaviour they need, it becomes up to them to either remember to go check the docs, or more likely (people don't read docs 😅 ) first spend a bunch of dig into the (immutable) venv and notice that the scripts are still hermetic.
# pants.toml
[export]
py_resolve_format = "symlinked_immutable_virtualenv"
py_hermetic_scripts = FalseI agree with the point about strict validation being annoying if overriding options on the CLI, though, so, happy to get this in.
Also removes a reference to legacy exports which were deprecated and removed in earlier releases.
| NOTE: If you are using legacy exports (not using the '--resolve' option), then | ||
| this option has no effect. Legacy exports will not include any editable installs. |
There was a problem hiding this comment.
Oops. We didn't remove this note when legacy exports were removed.
This implements #17764 but only for
mutable_virtualenv. If we also want to do something for symlinked immutable, then I will remove the Closes line below.Closes: #17764