Files
Av007 ca66f6d342 chore: cleanup nodes.py, fix root WEB_DIRECTORY, docs and pyproject
nodes.py:
- move json/urllib/logging imports to module top
- replace inline imports inside _get_balance with module-level log
- extract endpoint/key constants instead of inline literals
- add from __future__ import annotations for cleaner typing
- document the error-path padding to 4-tuple matching RETURN_TYPES

Root __init__.py:
- expose WEB_DIRECTORY pointing at custom_nodes/credit_tracker/js so the
  live-update extension loads when the repo is installed as custom_fns/

pyproject.toml:
- fix invalid build-backend (was setuptools.backends.legacy:build)
- bump to 0.2.0, add author/homepage fields

README + CONFLUENCE:
- document balance check, block_if_insufficient, and optional wired inputs
- update sample output to include Balance / After run / Status lines
- drop stale "no API calls" line and inaccurate "41 models total" claim
- mention JS pricing mirror must be updated alongside Python PRICING

Made-with: Cursor
2026-04-17 12:42:41 +03:00

23 lines
828 B
Python

"""
ComfyUI custom node entry point.
Loaded by ComfyUI when this repo is cloned into custom_nodes/ (as custom_fns/).
Adds the repo's own custom_nodes/ subfolder to sys.path so credit_tracker
is importable as a proper package with relative imports intact.
"""
import os
import sys
_here = os.path.dirname(os.path.abspath(__file__))
_pkg_parent = os.path.join(_here, "custom_nodes")
if _pkg_parent not in sys.path:
sys.path.insert(0, _pkg_parent)
from credit_tracker import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS # noqa: E402
# Path is relative to THIS file so ComfyUI serves the JS extension correctly
# whether the repo is installed as custom_fns/ or credit_tracker/ directly.
WEB_DIRECTORY = "./custom_nodes/credit_tracker/js"
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS", "WEB_DIRECTORY"]