Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

OwenKephart
Copy link
Contributor

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

@OwenKephart OwenKephart force-pushed the 02-03-_components_update_component_naming_scheme branch 3 times, most recently from 7d57bfa to 6239e40 Compare February 3, 2025 21:50
@OwenKephart OwenKephart force-pushed the 02-03-_components_update_component_naming_scheme branch from 6239e40 to df3cf5a Compare February 3, 2025 21:55
Copy link
Member

@schrockn schrockn left a 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.

@smackesey
Copy link
Collaborator

I was concerned that names like foo@bar weren't going to be valid click command names but it turns out they are!

@OwenKephart OwenKephart force-pushed the 02-03-_components_update_component_naming_scheme branch 3 times, most recently from 0660c07 to 1f03c36 Compare February 4, 2025 00:03
@OwenKephart OwenKephart force-pushed the 02-03-_components_update_component_naming_scheme branch from 1f03c36 to 362effc Compare February 4, 2025 00:56
@OwenKephart OwenKephart requested a review from schrockn February 4, 2025 00:56
Comment on lines +126 to +128
def from_string(s: str) -> "ComponentTypeKey":
name, package = s.split("@")
return ComponentTypeKey(name=name, package=package)
Copy link
Member

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

Comment on lines +118 to +120
class ComponentTypeKey:
name: str
package: str
Copy link
Member

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":
Copy link
Member

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)
Copy link
Member

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

Comment on lines +16 to +27
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}"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar naming question

Copy link
Member

@schrockn schrockn left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants