https://github.com/christian-byrne/python-interpreter-node
Embed scripts into workflows. Alter the node's input/outputs with python. Debug live. ComfyUI OS
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.6%) to scientific vocabulary
Keywords
Repository
Embed scripts into workflows. Alter the node's input/outputs with python. Debug live. ComfyUI OS
Basic Info
Statistics
- Stars: 65
- Watchers: 3
- Forks: 11
- Open Issues: 5
- Releases: 0
Topics
Metadata Files
README.md
Python Interpreter ComfyUI Node 🐍

[!TIP] To install via manager, you must first open the ComfyUI Manager settings and set the
channelsetting todev:See Picture of Specified Setting

Description
- Write Python code that executes when the workflow is queued
- The stdout/err (e.g., prints, error tracebacks) are displayed in the node.
- The input values can be accessed by their UI name.
- The output values are the same as the input values, changes made to input values in the code are reflected in the output values.
Requirements
- python 3.10+
Installation
cdintoComfyUI/custom_nodesdirectorygit clonethis repository
To install via ComfyUI Manager, set the channels setting to dev and search for Python Interpreter in the manager.
Usage
- The variables in the UI (e.g.,
image1,number1,text1, etc.) can be accessed directly in the code by the same namepython print(image1.shape) print(number1 * random.randint(0, 99)) - The output values share the same names as the input values. Changes you make to these variables will be reflected in the output values.
The code will work as expected in almost all cases except for i. re-assignment and ii. passing the variables as arguments to external functions.
- To re-assign a variable, you must use its
to()method, regardless of the variable's type ```python # Instead of number1 = float(number1): number1.to(float(number1))
# Instead of image1 = 0.5 * (image1 + image2): image1.to(0.5 * (image1 + image2))
# Instead of mask1 = 1 - mask1: mask1.to(1 - mask1)
# Instead of text1 = text1.replace("bad", ""): text1.to(text1.replace("bad", ""))
# In-place operators (+=, ++, /=, etc.) will work normally number1++ text1 += " is good"
2. To pass the variables as arguments to functions, just pass the `.data` attribute of the variable instead (regardless of the variable's type)python # Instead of pilimg = ToPILImage()(image1): pilimg = ToPILImage()(image1.data)# Instead of random.sample[number1, number2]: random.sample([number1.data, number2.data])
# Not necessary for built-in functions print(image1) # works print(len(text1)) # works ```
- To re-assign a variable, you must use its
Refer to the Images, Latents, and Masks section of comfydocs.org for info regarding types.
Try to avoid re-assigning the input/output variables to objects of a different type. You may lose access to some instance methods. If it must be done (e.g., to get an ouput of a novel type), just do it at the end of the code, and use your own variables in the meantime.
Examples
Get Complementary Colors from Image -> Interpolate into a Prompt
Expand Image

Paste Input Text on Image
Expand Image

Snippets
- Automatically get color palette and complements from image
- Most recent image in folder
- Paste text on image
- ...More
Disclaimer: Do not put this on a server that is accessible to the public. This node can run any Python code provided by a user, including malicious code.
Owner
- Name: Christian Byrne
- Login: christian-byrne
- Kind: user
- Location: San Francisco
- Company: Comfy-Org
- Twitter: c__byrne
- Repositories: 100
- Profile: https://github.com/christian-byrne
GitHub Events
Total
- Issues event: 9
- Watch event: 23
- Issue comment event: 14
- Push event: 4
- Pull request review event: 1
- Pull request event: 2
- Fork event: 3
- Create event: 1
Last Year
- Issues event: 9
- Watch event: 23
- Issue comment event: 14
- Push event: 4
- Pull request review event: 1
- Pull request event: 2
- Fork event: 3
- Create event: 1
Committers
Last synced: 8 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| christian-byrne | a****m@g****m | 66 |
| IOMisaka | z****a@q****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 11
- Total pull requests: 8
- Average time to close issues: 15 days
- Average time to close pull requests: about 2 hours
- Total issue authors: 10
- Total pull request authors: 3
- Average comments per issue: 1.18
- Average comments per pull request: 0.25
- Merged pull requests: 6
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 8
- Pull requests: 7
- Average time to close issues: 1 day
- Average time to close pull requests: about 3 hours
- Issue authors: 7
- Pull request authors: 3
- Average comments per issue: 1.13
- Average comments per pull request: 0.29
- Merged pull requests: 5
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- christian-byrne (2)
- sraney (1)
- kullervo-wanona (1)
- SencneS (1)
- ShagaONhan (1)
- cardenluo (1)
- ClayShoaf (1)
- geroldmeisinger (1)
- robpridham-bbc (1)
- drmbt (1)
Pull Request Authors
- christian-byrne (8)
- IOMisaka (2)
- robinjhuang (2)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- Pillow >=10.3.0
- Pillow >=10.3.0