-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[cli-refactor] Type and validate python_pointer_opts at entry point #27501
Conversation
container_context: Optional[str] = None, | ||
location_name: Optional[str] = None, | ||
instance_ref=None, | ||
inject_env_vars_from_instance: bool = False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These defaults are unnecessary and misleading-- click
will always call the function with values for all args, so no default is ever used.
5d7ae2e
to
5ab09e4
Compare
a82982f
to
2e6cb01
Compare
5ab09e4
to
a58be30
Compare
2e6cb01
to
ed80169
Compare
) -> None: | ||
python_pointer_opts = PythonPointerOpts.extract_from_cli_options(other_opts) | ||
assert_no_remaining_opts(other_opts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert_no_remaining_opts
ensures we didn't forget to list any other options in the signature-- all options are accounted for by either being explicitly listed, or extracted from the other_opts
dict into a typed object.
7563e7b
to
83a1ae9
Compare
a58be30
to
9c0b023
Compare
9c0b023
to
0b89790
Compare
0ae237a
to
cfd3e5d
Compare
0b89790
to
97522d5
Compare
cfd3e5d
to
6658a41
Compare
## Summary #27501 introduced a change where we must pass the working directory to `dagster assets materialize` - adds that to our dg docs tests
## Summary & Motivation #27501 added typing and validation of args for all CLI entry points that accept a "python pointer" (i.e. pointer to a single code location). This PR continues that theme for all commands that accept a workspace specification. All commands that operate on a workspace now immediately parse passed workspace-specifyng options into the new typed `WorkspaceOpts` object. All these commands have also had their signatures cleaned up. Many of the helper methods used within these commands (which previously operated on untyped bags of "kwargs") have also been refactored. ## How I Tested These Changes Existing test suite (with some refactors to handle new `WorkspaceOpts`).
…agster-io#27501) ## Summary & Motivation First PR in the stack that replaces passing around "kwargs" with entry point validation and typing. - Add a `PythonPointerOpts` value object corresponding to the `@python_pointer_opts` decorator. - Wherever `@python_pointer_opts` is used: - Immediately parse the untyped bag of cli_opts into a `PythonPointerOpts` object. - Generally clean up the signatures of the targeted click commands, ensuring all other opts are passed as arguments instead of inside the generic bag of CLI opts. ## How I Tested These Changes Existing test suite.
## Summary dagster-io#27501 introduced a change where we must pass the working directory to `dagster assets materialize` - adds that to our dg docs tests
dagster-io#27559) ## Summary & Motivation dagster-io#27501 introduced a regression in setting the working directory of code pointers correctly for certain entry points-- this fixes it. ## How I Tested These Changes Docs beta snippet that was failing now passes.
…er-io#27540) ## Summary & Motivation dagster-io#27501 added typing and validation of args for all CLI entry points that accept a "python pointer" (i.e. pointer to a single code location). This PR continues that theme for all commands that accept a workspace specification. All commands that operate on a workspace now immediately parse passed workspace-specifyng options into the new typed `WorkspaceOpts` object. All these commands have also had their signatures cleaned up. Many of the helper methods used within these commands (which previously operated on untyped bags of "kwargs") have also been refactored. ## How I Tested These Changes Existing test suite (with some refactors to handle new `WorkspaceOpts`).
Summary & Motivation
First PR in the stack that replaces passing around "kwargs" with entry point validation and typing.
PythonPointerOpts
value object corresponding to the@python_pointer_opts
decorator.@python_pointer_opts
is used:PythonPointerOpts
object.How I Tested These Changes
Existing test suite.