-
-
Notifications
You must be signed in to change notification settings - Fork 646
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
Allow Targets to express that fields are mutually exclusive #9561
Comments
In the context of what rule? Those two fields are definitely not mutually exclusive in the context of creating a PEX file. You can specify both directly to the Pex CLI and get a sensible result. |
Sorry for my delay in replying...As discussed in #12612 (comment), agreed that Pex does not enforce -- Another case for this issue: With #12612, I'd like to require that We could enforce that in the rule, but it would be nice to use the Target API because it allows for the error to be more eager, e.g. to trigger when running |
Another example: I'm adding |
Closes #11619. This will benefit from #9561 to ensure both `script` and `entry_point` are not set at the same time. For now, `entry_point` wins out. This means that we no longer make `entry_point` required because it's valid to set `script` instead. So, we deprecate `entry_point="<none>"` to indicate there is no entry point - now you leave off both the `script` and `entry_point` fields. [ci skip-rust] [ci skip-build-wheels]
Closes #9561, and applies this new mechanism to validate that a `pex_binary` does not set both `script` and `entry_point`. At first, I considered a more constrained solution like plugin authors indicating which fields are mutually exclusive. Instead, this is more flexible. [ci skip-rust] [ci skip-build-wheels]
Two times now while writing bindings for the Target API, I've encountered mutually exclusive fields. That is, if one is configured, the other should not be.
For example,
platforms
should not be specified at the same time ascompatibility
forpython_binary
.--
There is no way to validate that because all validation happens at the Field level, independent of any other Field.
Almost certainly, we should have a new entry_point on
Target
called something likeadditional_validation()
.The text was updated successfully, but these errors were encountered: