diff --git a/.github/workflows/publish_node.yml b/.github/workflows/publish_node.yml index 49e25b5..0e386be 100644 --- a/.github/workflows/publish_node.yml +++ b/.github/workflows/publish_node.yml @@ -18,7 +18,45 @@ jobs: steps: - name: ♻️ Check out code uses: actions/checkout@v4 - - name: 📦 Publish Custom Node - uses: Comfy-Org/publish-node-action@main + + - name: Set up Python + uses: actions/setup-python@v5 with: - personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }} + python-version: "3.10" + + - name: Install comfy-cli + run: pip install comfy-cli + + - name: Extract changelog section for this version + id: changelog + run: | + python - <<'EOF' + import pathlib + import re + + pyproject = pathlib.Path("pyproject.toml").read_text(encoding="utf-8") + version = re.search(r'^\s*version\s*=\s*"([^"]+)"', pyproject, re.M).group(1) + changelog = pathlib.Path("CHANGELOG.md").read_text(encoding="utf-8") + + # Match headings like "## [1.7.0] - 2026-08-27", "## 1.7.0" or "## v1.7.0". + heading = re.compile(rf"^##\s+\[?v?{re.escape(version)}\]?\s*(?:-\s*\d{{4}}-\d{{2}}-\d{{2}})?\s*$", re.M) + match = heading.search(changelog) + if match is None: + print(f"::notice::No CHANGELOG.md section found for v{version}; publishing without a changelog") + pathlib.Path("CHANGELOG_CURRENT.md").write_text("", encoding="utf-8") + else: + end = heading.search(changelog, match.end()) + section = changelog[match.end():end.start() if end else None].strip() + pathlib.Path("CHANGELOG_CURRENT.md").write_text(section + "\n", encoding="utf-8") + EOF + + - name: 📦 Publish Custom Node + run: | + if [ -s CHANGELOG_CURRENT.md ]; then + comfy --skip-prompt --no-enable-telemetry node publish \ + --token "${{ secrets.REGISTRY_ACCESS_TOKEN }}" \ + --changelog-file CHANGELOG_CURRENT.md + else + comfy --skip-prompt --no-enable-telemetry node publish \ + --token "${{ secrets.REGISTRY_ACCESS_TOKEN }}" + fi diff --git a/.vscode/tasks.json b/.vscode/tasks.json index fc81a7d..be83623 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -69,17 +69,6 @@ "panel": "dedicated" }, "problemMatcher": [] - }, - { - "label": "Bump Version (patch)", - "type": "shell", - "command": "${workspaceFolder}/../../venv/bin/python -m bump_my_version bump patch", - "group": "build", - "presentation": { - "reveal": "always", - "panel": "dedicated" - }, - "problemMatcher": [] } ] } diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..53a42b9 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,52 @@ +# AGENTS.md + +Guidance for AI coding assistants working in this repository. + +## Project overview + +`basic_data_handling` is a **ComfyUI custom-node pack**: lightweight Python nodes for common data +manipulation (boolean logic, casting, comparison, control flow, lists, dicts, sets, strings, math, +paths, regex, tensors, time). It has no runtime dependencies beyond ComfyUI itself. + +## Repository layout + +- `src/basic_data_handling/` — node implementations; each `*_nodes.py` module registers its nodes. +- `tests/` — pytest suite mirroring the `src/` modules. +- `web/` — frontend assets (icon, JS). +- `pyproject.toml` — package metadata, Comfy registry config (`[tool.comfy]`), and tool config + (ruff / mypy / pytest). +- `CHANGELOG.md` — release notes in Keep-a-Changelog format; the publish workflow reads the section + matching the current version. +- `.github/workflows/` — CI (`build-pipeline.yml`, `validate.yml`) and registry publishing + (`publish_node.yml`). + +## Versioning & releases (IMPORTANT) + +- **Single source of truth:** `[project] version` in `pyproject.toml`. There is intentionally **no** + `bump-my-version` config — do **not** re-add one; it only duplicates the version string and causes drift. +- To release a new version: + 1. Bump `[project] version` in `pyproject.toml` (semver: MAJOR = breaking, MINOR = feature, PATCH = fix). + 2. Add a `## [X.Y.Z] - YYYY-MM-DD` section to `CHANGELOG.md` (Keep-a-Changelog format). + 3. Push to `main`. `.github/workflows/publish_node.yml` auto-triggers on any push touching + `pyproject.toml` and publishes to the Comfy registry. +- **Changelog → registry:** the publish workflow extracts the `## [X.Y.Z]` section from `CHANGELOG.md` + and sends it via `comfy node publish --changelog-file`. That text is what shows under + **Version history** on the registry page. Published versions are immutable, so the changelog only + appears for the newly published version. +- Registry metadata lives in `[tool.comfy]` (`PublisherId = "stablellama"`, `DisplayName`, `Icon`). + The `name` and `Repository` URL must stay stable — they are the registry node ID. + +## Tooling + +Python venv (repo lives under `ComfyUI/custom_nodes`): `/../../venv/bin/python` + +- Lint: `python -m ruff check .` +- Format: `python -m ruff format .` +- Type check: `python -m mypy .` (strict) +- Tests: `python -m pytest tests/` +- Pre-commit: `python -m pre_commit run --all-files` + +## Workflow / commit policy + +- The human reviews and commits all changes (commits are GPG-signed). Do **not** run `git commit` + yourself; make the changes, optionally stage them, and hand off to the user. diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..37ad080 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,14 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [1.7.0] - 2026-08-27 + +### Added + +- String save node now supports append mode diff --git a/pyproject.toml b/pyproject.toml index 525380a..5b2af7c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "basic_data_handling" -version = "1.6.0" +version = "1.7.0" description = """Basic Python functions for manipulating data that every programmer is used to, lightweight with no additional dependencies. Supported data types: @@ -37,7 +37,6 @@ dependencies = [] [project.optional-dependencies] dev = [ - "bump-my-version", "coverage", # testing "frozendict", # an example not-a-dict-but-mapping class for dict nodes "mypy", # linting