This document explains what each file does and why it's included.
ComfyUI-RandomNumber/
├── __init__.py # Required: ComfyUI entry point
├── random_number_node.py # Required: Node implementation
├── pyproject.toml # Required: Registry compatibility
├── LICENSE # Required: MIT license
├── README.md # Required: Documentation
├── requirements.txt # Best Practice: Dependencies (empty for this node)
├── install.py # Best Practice: Auto-installation script
├── install.sh # Helper: Manual installation script
└── .gitignore # Best Practice: Git configuration
__init__.py - ComfyUI Entry Point
- Exports NODE_CLASS_MAPPINGS and NODE_DISPLAY_NAME_MAPPINGS
- ComfyUI won't load the node without this file
- Imports from random_number_node.py
random_number_node.py - Node Implementation
- Contains the RandomNumber class with all node logic
- Defines inputs (min_value, max_value, seed)
- Defines outputs (int, float)
- Implements the generate() function
- Sets CATEGORY to "Logic/Math" so it appears in the right menu
pyproject.toml - Registry Metadata
- Required for ComfyUI Registry publishing
- Contains version info (semantic versioning)
- Specifies PublisherId and DisplayName
- Declares Python version requirements
- Makes your node discoverable in the Registry
requirements.txt - Dependency List
- Tells ComfyUI Manager what packages to install
- Empty for this node (uses only Python standard library)
- Best practice to include even if empty
install.py - Auto Installation Script
- Executed automatically by ComfyUI Manager after cloning
- Can install dependencies, download models, setup configs
- This one just confirms successful installation
README.md - Primary Documentation
- Installation instructions (Manager + Manual)
- Usage examples and parameter explanations
- Troubleshooting section
- Version history
- Critical for user adoption
LICENSE - MIT License
- Required by pyproject.toml
- Allows commercial and personal use
- MIT is the community standard for ComfyUI nodes
- Provides legal clarity
install.sh - Manual Installation Helper
- Bash script for quick manual installation
- Copies files to correct ComfyUI directory
- Makes installation easier for beginners
.gitignore - Git Configuration
- Prevents committing Python cache files
- Excludes IDE and OS-specific files
- Keeps repository clean
# Extract and run the installation script
unzip ComfyUI-RandomNumber.zip
cd ComfyUI-RandomNumber
bash install.sh
pm2 restart comfyui# Extract and copy to custom_nodes
unzip ComfyUI-RandomNumber.zip
cp -r ComfyUI-RandomNumber /home/localadmin/ComfyUI/custom_nodes/
pm2 restart comfyui- Open ComfyUI Manager
- Search "Random Number"
- Click Install
- Restart ComfyUI
- ✅ Create GitHub repository
- ✅ Push all files to repository
- ✅ Submit PR to ComfyUI-Manager's custom-node-list.json
- ✅ Update PublisherId in pyproject.toml (get from registry.comfy.org)
- ✅ Update GitHub URLs in pyproject.toml and README.md
- ✅ Update copyright in LICENSE file
- ✅ Install comfy-cli:
pip install comfy-cli - ✅ Publish:
comfy node publish
- Complete Documentation - README with examples and troubleshooting
- Registry Compatible - pyproject.toml with proper metadata
- Manager Compatible - install.py and requirements.txt
- Legally Clear - MIT License included
- Well Organized - Logical category (Logic/Math)
- Error Handling - Auto-swaps min/max if needed
- Reproducible - Seed control for consistent results
- Professional Code - Docstrings and comments
Current version: 1.0.0
To update:
- Modify code as needed
- Update version in pyproject.toml (use semantic versioning)
- Update README.md version history
- Commit to GitHub
- Publish to Registry:
comfy node publish
Node doesn't appear:
- Check files are in /home/user/ComfyUI/custom_nodes/ComfyUI-RandomNumber/
- Verify init.py and random_number_node.py are present
- Check ComfyUI logs:
pm2 logs comfyui - Restart ComfyUI completely
Import errors:
- Check Python version:
python --version(needs 3.8+) - Verify file names match import statements
To customize for your own node:
- Replace "yourusername" with your GitHub username in:
- pyproject.toml (2 places)
- README.md (3 places)
- Update PublisherId in pyproject.toml after creating Registry account
- Update LICENSE copyright with your name
- Update node logic in random_number_node.py
- Update documentation in README.md
This structure follows ComfyUI best practices and ensures compatibility with both ComfyUI Manager and the official Registry.