Pure Python ISF shader renderer with PyOpenGL and json5
Project description
pyvvisf
Pure Python ISF (Interactive Shader Format) renderer built on PyOpenGL.
pyvvisf parses and renders ISF shaders from Python — to images or to an interactive window — without any C++ build step. It is a modern, pure-Python alternative to VVISF-GL, with enhanced error reporting that mirrors the official ISF online editor's diagnostics. Originally written to power ai-shader-tool, it gives AI agents (and humans) a way to validate, render, and inspect generated shaders. The majority of code in this repository was built with AI.
Docs | PyPI | Issue Tracker
Features
- Pure Python — no C++ compilation required
- Robust ISF parsing with json5 (comments, trailing commas)
- Modern OpenGL via PyOpenGL + GLFW for cross-platform contexts
- Enhanced error reporting with Python-native messages and shader context
- Type-safe metadata via Pydantic models, with auto-coercion for inputs
- Multi-version GLSL support with automatic detection
- ISF 2.0 compliant — multi-pass rendering, imports,
IMG_THIS_PIXEL,IMG_PIXEL,IMG_SIZE, etc. - Context-managed resources for clean setup and teardown
Contents
Quick Start
See the docs for a comprehensive overview.
Requirements
- Python 3.10+
- A working OpenGL driver (the renderer uses GLFW + PyOpenGL)
Setup Instructions
Install from PyPI:
pip install pyvvisf
Or install from source for development:
git clone https://github.com/jimcortez/pyvvisf.git
cd pyvvisf
pip install -e ".[dev]"
Run Instructions
Render an ISF shader to a PNG:
from pyvvisf import ISFRenderer
shader = """
/*{
"DESCRIPTION": "Every pixel is the selected color.",
"ISFVSN": "2.0",
"CATEGORIES": ["Generator"],
"INPUTS": [
{"NAME": "color", "TYPE": "color", "DEFAULT": [1.0, 0.0, 0.0, 1.0]}
]
}*/
void main() {
gl_FragColor = color;
}
"""
with ISFRenderer(shader) as renderer:
renderer.render(512, 512).to_pil_image().save("output_red.png")
renderer.set_input("color", (0.0, 1.0, 0.0, 1.0))
renderer.render(512, 512).to_pil_image().save("output_green.png")
Usage Examples
examples/isf_renderer_demo.py— render shaders to images, set inputs, save outputexamples/isf_window_demo.py— interactive window display (screenshot above)examples/time_offset_demo.py— capture frames at arbitrary time offsets
Bundled shaders in examples/shaders/:
simple.fs— fills the screen with bluesimple_color_change.fs— single color inputsimple_color_animation.fs— fades between two colors over timeshapes.fs— animated moving circle, rotating rectangle, pulsating ring
To pin a specific GLSL version or query what's available:
from pyvvisf import ISFRenderer, get_supported_glsl_versions
print(get_supported_glsl_versions())
renderer = ISFRenderer(shader_content, glsl_version="330")
The default is '330'. The library compiles a probe shader at construction time to verify compatibility.
Test Instructions
pip install -e ".[dev]"
pytest
Running headless (Docker, CI, servers)
pyvvisf needs a real OpenGL context. On a headless Linux box, wrap the
process in xvfb-run:
sudo apt-get install -y xvfb
xvfb-run -a python my_render_script.py
In GitHub Actions, the
pyvista/setup-headless-display-action
step provides a display on Linux, macOS, and Windows runners — see
.github/workflows/ci.yml for an example.
License
See LICENSE — MIT.
Support
Maintainer: @jimcortez. For bugs and feature requests, please use the issue tracker.
Acknowledgments
- VVISF-GL — initial reference implementation
- interactive-shader-format-js — second reference implementation
- PyOpenGL — OpenGL bindings
- pyGLFW — GLFW bindings
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyvvisf-0.8.0.tar.gz.
File metadata
- Download URL: pyvvisf-0.8.0.tar.gz
- Upload date:
- Size: 617.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08b4dfb09bcdbf071ae3d82e2bea49372ff4b93d032090056fc59b4c23c6249c
|
|
| MD5 |
b27ee1d6604fac1e8134f8d9968fab6f
|
|
| BLAKE2b-256 |
a7c7ddb9ca1d4525932e573b8613ba696ddd6aeec12767d76f94f8a1b2e69321
|
Provenance
The following attestation bundles were made for pyvvisf-0.8.0.tar.gz:
Publisher:
release.yml on jimcortez/pyvvisf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyvvisf-0.8.0.tar.gz -
Subject digest:
08b4dfb09bcdbf071ae3d82e2bea49372ff4b93d032090056fc59b4c23c6249c - Sigstore transparency entry: 1699122450
- Sigstore integration time:
-
Permalink:
jimcortez/pyvvisf@2f58519881d85d1a1d91114177d184cbe56e9901 -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/jimcortez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2f58519881d85d1a1d91114177d184cbe56e9901 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyvvisf-0.8.0-py3-none-any.whl.
File metadata
- Download URL: pyvvisf-0.8.0-py3-none-any.whl
- Upload date:
- Size: 28.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
459e1e34b625ccf6cb9f16a06c673fffcbf38acadd28b71ad7ed3ffca16e6f79
|
|
| MD5 |
514ecf5c3662aa117d24cd665dd57de3
|
|
| BLAKE2b-256 |
e9dc180e98090acd14a89ea0a50437a89b716640114f747ddce78b1c10883581
|
Provenance
The following attestation bundles were made for pyvvisf-0.8.0-py3-none-any.whl:
Publisher:
release.yml on jimcortez/pyvvisf
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyvvisf-0.8.0-py3-none-any.whl -
Subject digest:
459e1e34b625ccf6cb9f16a06c673fffcbf38acadd28b71ad7ed3ffca16e6f79 - Sigstore transparency entry: 1699122576
- Sigstore integration time:
-
Permalink:
jimcortez/pyvvisf@2f58519881d85d1a1d91114177d184cbe56e9901 -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/jimcortez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2f58519881d85d1a1d91114177d184cbe56e9901 -
Trigger Event:
release
-
Statement type: