-
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
[components] Update component naming scheme #27512
base: master
Are you sure you want to change the base?
[components] Update component naming scheme #27512
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
7d57bfa
to
6239e40
Compare
6239e40
to
df3cf5a
Compare
python_modules/libraries/dagster-components/dagster_components/core/component_decl_builder.py
Outdated
Show resolved
Hide resolved
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.
not so bad. Let's not splat @
calls around the codebase. Ideally we would pass around a datastructure that represents a type inside a module or package as much as possible, rather than a string.
I was concerned that names like |
0660c07
to
1f03c36
Compare
1f03c36
to
362effc
Compare
def from_string(s: str) -> "ComponentTypeKey": | ||
name, package = s.split("@") | ||
return ComponentTypeKey(name=name, package=package) |
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.
makes sense to have error checking here
class ComponentTypeKey: | ||
name: str | ||
package: str |
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.
I think we need to bikeshed here.
Elsewhere we use the term "component name" to refer to the full string but here name is only the local name. We need to come up with consitent nomenclature.
return f"{self.name}@{self.package}" | ||
|
||
@staticmethod | ||
def from_string(s: str) -> "ComponentTypeKey": |
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.
s
should have a meaningful name
@@ -324,7 +324,10 @@ def component_check_command( | |||
|
|||
try: | |||
json_schema = ( | |||
component_registry.get(component_dir, component_name).component_params_schema or {} | |||
component_registry.get( | |||
component_dir, RemoteComponentKey.from_string(component_name) |
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.
example of inconsistent use of component_name
class RemoteComponentKey: | ||
name: str | ||
package: str | ||
|
||
@staticmethod | ||
def from_string(s: str) -> "RemoteComponentKey": | ||
name, package = s.split("@") | ||
return RemoteComponentKey(name=name, package=package) | ||
|
||
def to_string(self) -> str: | ||
return f"{self.name}@{self.package}" | ||
|
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.
similar naming question
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.
This is a pretty important PR as it introduces new terms to our ontology and we should do it deliberately.
Things to name
- The full string "foo@bar" (component identifier)?
- The first component of that string (name?)
- The second component of that string (module? code container") It is either a file or a package. Curious what @smackesey thinks
- The data structure that structures "foo@bar"
We should define this ontology, document it, put it in the PR summary, and then use it consistently in the code base.
Summary & Motivation
This updates the naming scheme of our components to be
<name>@<namespace>
instead of<namespace>.<name>
.This also updates some terminology throughout the codepaths to distinguish between the name of a component (which does not include the namespace), and the registry key (which is the unique identifier). Previously, we used the term "name" for both of these cases, which was confusing.
How I Tested These Changes
Changelog
NOCHANGELOG