Skip to content

Commit d23beb4

Browse files
author
coderfromthenorth93
committed
Extract supported_os from config and push to the registry service
1 parent 2e36f33 commit d23beb4

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

comfy_cli/registry/api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def publish_node_version(self, node_config: PyProjectConfig, token) -> PublishNo
5454
"name": node_config.tool_comfy.display_name,
5555
"license": license_json,
5656
"repository": node_config.project.urls.repository,
57+
"supported_os": node_config.project.supported_os,
5758
},
5859
"node_version": {
5960
"version": node_config.project.version,

comfy_cli/registry/config_parser.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ def extract_node_configuration(
157157
urls_data = project_data.get("urls", {})
158158
comfy_data = data.get("tool", {}).get("comfy", {})
159159

160+
classifiers = project_data.get("classifiers", [])
161+
supported_os = [c for c in classifiers if c.startswith("Operating System :: ")]
162+
160163
license_data = project_data.get("license", {})
161164
if isinstance(license_data, str):
162165
license = License(text=license_data)
@@ -190,6 +193,7 @@ def extract_node_configuration(
190193
repository=urls_data.get("Repository", ""),
191194
issues=urls_data.get("Issues", ""),
192195
),
196+
supported_os=supported_os, # Add the OS classifiers
193197
)
194198

195199
comfy = ComfyConfig(

comfy_cli/registry/types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class ProjectConfig:
6969
dependencies: List[str] = field(default_factory=list)
7070
license: License = field(default_factory=License)
7171
urls: URLs = field(default_factory=URLs)
72+
supported_os: List[str] = field(default_factory=list)
7273

7374

7475
@dataclass

tests/comfy_cli/registry/test_config_parser.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,27 @@ def test_extract_license_incorrect_format():
127127
assert result is not None, "Expected PyProjectConfig, got None"
128128
assert isinstance(result, PyProjectConfig)
129129
assert result.project.license == License(text="MIT")
130+
131+
132+
def test_extract_node_configuration_with_os_classifiers():
133+
mock_data = {
134+
"project": {
135+
"classifiers": [
136+
"Operating System :: OS Independent",
137+
"Operating System :: Microsoft :: Windows",
138+
"Programming Language :: Python :: 3",
139+
"Topic :: Software Development",
140+
]
141+
}
142+
}
143+
with (
144+
patch("os.path.isfile", return_value=True),
145+
patch("builtins.open", mock_open()),
146+
patch("tomlkit.load", return_value=mock_data),
147+
):
148+
result = extract_node_configuration("fake_path.toml")
149+
150+
assert result is not None
151+
assert len(result.project.supported_os) == 2
152+
assert "Operating System :: OS Independent" in result.project.supported_os
153+
assert "Operating System :: Microsoft :: Windows" in result.project.supported_os

0 commit comments

Comments
 (0)