LLM-powered dynamic code generation via metaclasses. Define classes with docstrings, call any method—code generates automatically, caches persistently, and executes instantly.
Project description
scry-run
Write class definitions, get working code. A Python library where any method call automatically generates its implementation via LLM.
Define your application as a class with a docstring, then call any method you want—scry-run generates the code on-demand, caches it, and executes it. No boilerplate, no implementation required.
Features
- Zero-boilerplate coding: Define intent via class docstrings, methods generate automatically
- Intelligent caching: Generated code persists across runs—pay once, use forever
- Production-ready: Bake apps into standalone packages with frozen, pre-generated code
- CLI-first: Manage apps, inspect cache, and export generated code via intuitive commands
Installation
pip install scry-run
# or with uv
uv pip install scry-run
Run without installing (uvx)
# From PyPI
uvx scry-run --help
uvx scry-run init --name=myapp --description="My app"
# From GitHub (latest)
uvx --from git+https://github.com/scry-run/scry-run scry-run --help
Quick Start
1. Set up your backend
Requires Claude Code CLI to be installed.
# Verify claude CLI is available
claude --version
2. Initialize a project
# Non-interactive
scry-run init --name=todoist --description='minimal web todo app'
# Interactive
scry-run init
3. Run your app
scry-run run todoist
Or use it directly in Python:
from scry_run import ScryClass
class Todoist(ScryClass):
"""A minimal web todo app with task management."""
pass
app = Todoist()
# These methods will be generated automatically!
app.add_task("Buy groceries")
app.list_tasks()
app.complete_task(0)
Demos
Creating a simple Hello World app
Building a maze game with PyGame
How It Works
- When you access an undefined attribute on an
ScryClasssubclass, the metaclass intercepts it - The library collects the full codebase context and builds a prompt
- The configured backend generates code with structured JSON output (code, type, docstring, dependencies)
- The code is validated with Python's
ast.parse()to ensure it's syntactically correct - Valid code is cached and executed
- On subsequent accesses, the cached code is used directly
Backend
Uses Claude Code CLI with --print flag for non-interactive output.
# If claude CLI is installed, it's used automatically
scry-run run myapp
# Optionally specify a model
export SCRY_RUN_MODEL=opus
Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
SCRY_RUN_BACKEND |
Backend to use: claude, frozen, or auto |
auto |
SCRY_RUN_MODEL |
Model override (e.g., opus) |
(backend default) |
SCRY_RUN_MAX_GENERATIONS |
Max code generations per process | 100 |
Class-level options
class MyApp(ScryClass):
"""My application."""
# Disable LLM generation (raises AttributeError for missing attrs)
_llm_enabled = False
# Use minimal context instead of full codebase (faster)
_llm_use_full_context = False
# Suppress generation messages
_llm_quiet = True
# Override model for this class
_llm_model = "opus"
CLI Commands
App Management
# Initialize a new app
scry-run init --name=NAME --description=DESC
# List all apps
scry-run list
# Get path to an app's main file
scry-run which myapp
# Run an app
scry-run run myapp [args...]
# Remove an app
scry-run rm myapp
scry-run rm myapp --force # Skip confirmation
# Reset an app (clear code & cache, keep name/description)
scry-run reset myapp
scry-run reset myapp --force # Skip confirmation
Cache Management
# List cached entries for an app
scry-run cache list myapp
# Show a specific entry
scry-run cache show myapp MyClass.my_method
# Export cache
scry-run cache export myapp --output=generated.py --format=python
scry-run cache export myapp --output=cache.json --format=json
# Remove a specific entry
scry-run cache rm myapp MyClass.my_method
# Prune cache entries
scry-run cache prune myapp --class=MyClass --attr=my_method
scry-run cache prune myapp --class=MyClass # All methods of a class
scry-run cache prune myapp --all # Everything
# Reset cache (clear all entries)
scry-run cache reset myapp --force
API
ScryClass
Base class to inherit from for LLM-powered code generation.
from scry_run import ScryClass
class MyApp(ScryClass):
"""Description of your app - the LLM uses this!"""
def existing_method(self):
"""Existing methods are used as context."""
return "hello"
# Class methods
MyApp.llm_export_cache("output.py") # Export generated code
MyApp.llm_prune_cache("method_name") # Remove cached entry
MyApp.llm_disable() # Disable generation
MyApp.llm_enable() # Re-enable generation
ScryCache
Manage the code cache programmatically.
from scry_run import ScryCache
cache = ScryCache()
# Get cached code
entry = cache.get("MyClass", "my_method")
print(entry.code)
# List all entries
for entry in cache.list_entries():
print(f"{entry.class_name}.{entry.attr_name}: {entry.docstring}")
# Export
cache.export_to_file("all_generated_code.py")
# Prune
cache.prune(class_name="MyClass", attr_name="my_method")
Development
# Clone the repo
git clone https://github.com/scry-run/scry-run
cd scry-run
# Install with dev dependencies
uv sync --dev
# Run tests
uv run pytest tests/ -v
License
MIT
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 scry_run-0.1.0.tar.gz.
File metadata
- Download URL: scry_run-0.1.0.tar.gz
- Upload date:
- Size: 140.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9445c5223b9b21ff12f760dbba64b9d3035cd9ecc389327b4152a24878fee1a
|
|
| MD5 |
24cf17ce6b653ecd6d0a256e61314e91
|
|
| BLAKE2b-256 |
f76381a999eefd758ecef23fb5801b08b004526adeb66b8713e268084a34d1af
|
File details
Details for the file scry_run-0.1.0-py3-none-any.whl.
File metadata
- Download URL: scry_run-0.1.0-py3-none-any.whl
- Upload date:
- Size: 64.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
42c61ccd9f35adb06474c139c934f52bfce072fc31c0f2fe9502b2e71f38ac18
|
|
| MD5 |
5161879e5f351d01e4ac6533eeeee6cd
|
|
| BLAKE2b-256 |
a09889b07c288186464835abc1f5972ee07660cc1e9f025feda0bb40fe8ed866
|