When calling the register() api to register option...
# general
When calling the register() api to register options:
register("--some-option", type=str, help="bla bla bla.")
Is there a way to specify that the option is required ? (I tried passing required=True) but I am getting an error:
InvalidKwarg: Invalid registration kwarg required.
looking here: https://github.com/pantsbuild/pants/blob/e59706d9aef5c0d6ca528478ccd8b2e6eb43c739/src/python/pants/option/parser.py#L549 nothing seems like an obvious choice.
there isn’t, no.
i think that part of the reason for that is that none of the built in backends or existing plugins have required options, because it can slow down onboarding
if you’ve opted-in to enabling a plugin though, it might be reasonable for it to stop you and ask for required options. cc @happy-kitchen-89482
What's the example use-case?
I have a rule that needs to specify a python version (in order to resolve requirements) the currently, the rule defaults to python 3.6, which means when I run the rule, I thinks I am using 3.6 while in reality I am using 3.8 (I have
interpreter_constraints = ["CPython>=3.8,<4"]
I am thinking about changing the rule to accept PythonSetup instead of declaring its own platform & python version... which is probably the right way to go.
👍 1
yea, it should.
@happy-kitchen-89482: sidenote, we don’t support scoped subsystem dependencies in v2, but we probably should
not sure how many of these use-sites will end up wanting to use that later.
Hmm, scoped deps are complicated, are we sure we want that?
I guess the motivating use case for them still exists