Skip to content

Commit dc40eff

Browse files
committed
fix: support PEP 639 SPDX license identifiers in pyproject.toml (#295)
1 parent 291b264 commit dc40eff

2 files changed

Lines changed: 7 additions & 22 deletions

File tree

comfy_cli/registry/config_parser.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,6 @@ def extract_node_configuration(
304304
license_data = project_data.get("license", {})
305305
if isinstance(license_data, str):
306306
license = License(text=license_data)
307-
typer.echo(
308-
'Warning: License should be in one of these two formats: license = {file = "LICENSE"} OR license = {text = "MIT License"}. Please check the documentation: https://docs.comfy.org/registry/specifications.'
309-
)
310307
elif isinstance(license_data, dict):
311308
if "file" in license_data or "text" in license_data:
312309
license = License(file=license_data.get("file", ""), text=license_data.get("text", ""))

tests/comfy_cli/registry/test_config_parser.py

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,14 @@ def test_extract_node_configuration_success(mock_toml_data):
8787
assert result.tool_comfy.models[0] == Model(location="model1.bin", model_url="https://example.com/model1")
8888

8989

90-
def test_extract_node_configuration_license_text():
90+
@pytest.mark.parametrize(
91+
"license_str",
92+
["MIT", "Apache-2.0", "GPL-3.0-or-later", "MIT License"],
93+
)
94+
def test_extract_node_configuration_license_spdx_string(license_str):
9195
mock_data = {
9296
"project": {
93-
"license": "MIT License",
97+
"license": license_str,
9498
},
9599
}
96100
with (
@@ -101,7 +105,7 @@ def test_extract_node_configuration_license_text():
101105
result = extract_node_configuration("fake_path.toml")
102106
assert result is not None, "Expected PyProjectConfig, got None"
103107
assert isinstance(result, PyProjectConfig)
104-
assert result.project.license == License(text="MIT License")
108+
assert result.project.license == License(text=license_str)
105109

106110

107111
def test_extract_node_configuration_license_text_dict():
@@ -124,22 +128,6 @@ def test_extract_node_configuration_license_text_dict():
124128
)
125129

126130

127-
def test_extract_license_incorrect_format():
128-
mock_data = {
129-
"project": {"license": "MIT"},
130-
}
131-
with (
132-
patch("os.path.isfile", return_value=True),
133-
patch("builtins.open", mock_open()),
134-
patch("tomlkit.load", return_value=mock_data),
135-
):
136-
result = extract_node_configuration("fake_path.toml")
137-
138-
assert result is not None, "Expected PyProjectConfig, got None"
139-
assert isinstance(result, PyProjectConfig)
140-
assert result.project.license == License(text="MIT")
141-
142-
143131
def test_extract_node_configuration_with_os_classifiers():
144132
mock_data = {
145133
"project": {

0 commit comments

Comments
 (0)