pyproject declared no runtime dependencies at all -- numpy and pillow sat in the dev extra, so the built wheel required nothing. They move to [project] dependencies, and requirements.txt carries the same two for ComfyUI Manager, which does not read pyproject. tests/test_packaging.py fails if the two lists drift, and asserts they stay unpinned lower bounds so installing this node cannot disturb the host ComfyUI environment. [tool.mypy] has been configured since the beginning but mypy could never run: the checkout directory is hyphenated and carries the __init__.py ComfyUI needs as an entrypoint, which is not a legal package name. explicit_package_bases and files fix that. numpy then broke the run by shipping 3.12-syntax stubs that mypy parses even under python_version 3.10 -- follow_imports_for_stubs skips them rather than weakening the version target. folder_paths, injected by ComfyUI at runtime, joins the ignore_missing_imports list. Bare `mypy` now reports success on all three source files. Also adds the [build-system] table the build was relying on pip's legacy fallback to supply, names the wheel's package explicitly so auto-discovery cannot start shipping tests/, replaces the PEP 639-deprecated license table with an SPDX expression, adds [project.urls], and gitignores the build/ and egg-info/ artifacts that a real build now produces. No runtime behaviour changes. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
"""Packaging metadata checks.
|
|
|
|
The runtime dependency list exists twice -- pyproject.toml for pip, and
|
|
requirements.txt for ComfyUI Manager, which does not read pyproject. Neither
|
|
file can be dropped, so the only defence against drift is a test.
|
|
"""
|
|
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
|
|
|
|
def _declared_requirements():
|
|
lines = ROOT.joinpath("requirements.txt").read_text().splitlines()
|
|
return [line.strip() for line in lines if line.strip() and not line.startswith("#")]
|
|
|
|
|
|
def test_requirements_matches_pyproject_dependencies():
|
|
# tomllib is stdlib from 3.11; the CI matrix still covers this on 3.12/3.13.
|
|
tomllib = pytest.importorskip("tomllib")
|
|
with ROOT.joinpath("pyproject.toml").open("rb") as f:
|
|
pyproject = tomllib.load(f)
|
|
assert _declared_requirements() == pyproject["project"]["dependencies"]
|
|
|
|
|
|
def test_requirements_are_unpinned_lower_bounds():
|
|
"""A custom node must not pin the host ComfyUI environment's packages."""
|
|
for requirement in _declared_requirements():
|
|
assert ">=" in requirement, requirement
|
|
assert not any(op in requirement for op in ("==", "<", "~=")), requirement
|