5.5 KiB
Publishing the Workflow Templates Packages
This repository now produces seven wheels:
hanzo-studio-workflow-templates-corehanzo-studio-workflow-templates-media-apihanzo-studio-workflow-templates-media-videohanzo-studio-workflow-templates-media-imagehanzo-studio-workflow-templates-media-otherhanzo-studio-subgraph-blueprintshanzo-studio-workflow-templates(meta package that depends on all bundles, built from the rootpyproject.toml)
The meta package is built from the repository root pyproject.toml, not from a packages/meta/ directory. It pins exact versions of each subpackage as dependencies.
Publishing is largely automated via CI. When a PR with template changes merges to main, version bumps and publishing happen automatically. The manual workflow below is provided for reference or recovery scenarios.
Prerequisites
- Install Python 3.12+ and
pipx(recommended) or work inside a virtual environment. - Install the latest
buildandtwine:orpipx install build pipx install twinepython -m pip install --upgrade build twine - Have API tokens for TestPyPI and PyPI with the necessary permissions under the Comfy org (
project:hanzo-studio-workflow-templates-*). Save them somewhere secure—never commit them.
1. Build Wheels Locally
Most publishing is automated via CI (see below). If you need to build locally for testing or recovery:
git checkout main
git pull
./run_full_validation.sh
This script regenerates the manifest, rebuilds all wheels into ./dist/, runs lint/tests, and performs twine check.
Version bumping is handled automatically by CI via scripts/ci_version_manager.py, which runs in the version-check.yml workflow on every PR that touches templates or bundles.json. If you need to manually inspect or trigger version bumps locally, you can run:
python scripts/ci_version_manager.py
This will detect which packages have changed since their last version bump and apply patch-level bumps to the affected subpackages.
2. Dry Run on TestPyPI
- Export the TestPyPI token (or pass with
-u __token__ -p pypi-...):export TWINE_REPOSITORY=testpypi export TWINE_USERNAME="__token__" export TWINE_PASSWORD="pypi-<testpypi-token>" - Upload each wheel/sdist pair. A simple loop:
The blueprints package uses a different naming convention:
for pkg in core media_api media_video media_image media_other blueprints; do twine upload dist/hanzo_studio_workflow_templates_${pkg}-*.whl dist/hanzo_studio_workflow_templates_${pkg}-*.tar.gz doneThe meta package usestwine upload dist/hanzo_studio_subgraph_blueprints-*.whl dist/hanzo_studio_subgraph_blueprints-*.tar.gz_in the wheel file name. Adjust accordingly:twine upload dist/hanzo_studio_workflow_templates-*.whl dist/hanzo_studio_workflow_templates-*.tar.gz - Verify on https://test.pypi.org/project/hanzo-studio-workflow-templates-core/ (repeat for each project). Check the simple index for files.
- Test installation from TestPyPI:
Confirm
python -m venv /tmp/testenv && source /tmp/testenv/bin/activate python -m pip install --upgrade pip python -m pip install --index-url https://test.pypi.org/simple --extra-index-url https://pypi.org/simple hanzo-studio-workflow-templatespython -c "import hanzo_studio_workflow_templates_core; print(len(list(hanzo_studio_workflow_templates_core.iter_templates())))"works and assets resolve.
3. Publish to PyPI
- Switch to production token:
export TWINE_REPOSITORY=pypi export TWINE_USERNAME="__token__" export TWINE_PASSWORD="pypi-<production-token>" - Repeat the upload loop from TestPyPI.
- Verify on https://pypi.org/project/hanzo-studio-workflow-templates-core/ etc.
- Cut a GitHub Release tag (e.g.,
v0.3.0).
GitHub Actions Publishing
Publishing to PyPI is automated via .github/workflows/publish.yml. This workflow:
- Triggers on pushes to
mainthat changepyproject.toml(i.e., when a version-bump PR merges), or via manualworkflow_dispatch. - Detects which packages have new versions by comparing the commit diff.
- Builds and publishes subpackages first, then the meta package, using
twinewith thePYPI_TOKENrepository secret (classic API token auth). - Creates a GitHub Release with auto-generated release notes.
- Includes recovery mode: on manual dispatch, it checks all packages against PyPI and publishes any that are out of sync.
Version bumping on PRs is handled separately by .github/workflows/version-check.yml, which runs scripts/ci_version_manager.py to auto-bump affected packages and commit the changes back to the PR branch.
Recovery & Troubleshooting
- Upload interrupted: rerun
twine uploadfor the failing wheel. Already-uploaded files will be rejected; that's OK. - Wrong file uploaded: delete the release from TestPyPI via UI. For PyPI, reach out to admins; PyPI does not allow overwriting releases.
- Missing token permissions: ensure the token scope includes the new project names (
project:hanzo-studio-workflow-templates-*). PyPI tokens are project-specific. - Build failure: re-run
run_full_validation.shto regenerate assets and confirm tests pass before uploading again. - Packages out of sync with PyPI: trigger the publish workflow manually via
workflow_dispatch; recovery mode will detect and publish any mismatched versions.