fix: make pip install -e . work for ComfyUI portable users

Add explicit [tool.setuptools.packages.find] with include config to prevent
setuptools from discovering asset directories (js/, images/) as packages.
Also add missing aiohttp dependency imported in __init__.py.
This commit is contained in:
Peyton DeNiro
2026-04-19 10:11:47 -05:00
parent 6cdcc235a0
commit 11e5a7739a
2 changed files with 36 additions and 1 deletions
+4 -1
View File
@@ -4,12 +4,15 @@ description = "This custom node allows you to generate pure python code from you
version = "2.1.0"
license = { text = "MIT License" }
requires-python = ">=3.12"
dependencies = ["black"]
dependencies = ["black", "aiohttp"]
[project.urls]
Repository = "https://github.com/pydn/ComfyUI-to-Python-Extension"
# Used by Comfy Registry https://comfyregistry.org
[tool.setuptools.packages.find]
include = ["comfyui_to_python*"]
[tool.comfy]
PublisherId = "pydn"
DisplayName = "ComfyUI-to-Python-Extension"
+32
View File
@@ -31,3 +31,35 @@ class ProjectContractsTest(unittest.TestCase):
self.assertIn('const DEFAULT_SCRIPT_FILENAME = "workflow_api.py";', save_as_script)
self.assertNotIn("prompt(", save_as_script)
def test_pip_install_e_works_with_explicit_package_config(self):
"""`pip install -e .` must succeed — no 'Multiple top-level packages' error.
Setuptools auto-discovers every top-level directory. Without explicit
`[tool.setuptools.packages.find]` the `js/` and `images/` asset dirs
cause the install to abort with
"Multiple top-level packages discovered in a flat-layout".
"""
pyproject = tomllib.loads((REPO_ROOT / "pyproject.toml").read_text(encoding="utf-8"))
setuptools_cfg = pyproject.get("tool", {}).get("setuptools", {})
self.assertIn(
"packages",
setuptools_cfg,
"pyproject.toml must declare [tool.setuptools.packages] to avoid "
"setuptools discovering asset directories as packages during "
"`pip install -e .`",
)
def test_pip_install_e_deps_include_aiohttp(self):
"""`aiohttp` is imported in `__init__.py` and must be a project dependency."""
pyproject = tomllib.loads((REPO_ROOT / "pyproject.toml").read_text(encoding="utf-8"))
deps = pyproject["project"]["dependencies"]
dep_names = [d.split("=")[0].split(">")[0].split("<")[0].split("!")[0].strip().lower() for d in deps]
self.assertIn(
"aiohttp",
dep_names,
"aiohttp is imported in __init__.py and must be listed in project dependencies",
)