You are viewing archived documentation for pyrith v0.3.0. The latest version is v0.4.0.
pyrith
v0.3.0 ArchivedProduction-complete web framework — Virtual DOM, SSG, dark glassmorphism design system, 30+ UI components, Markdown renderer, SEO metadata, page transitions, and 4 starter templates. Build any modern graphics-intensive website with pure Python.
Overview
v0.3.0 is the UI-complete release of pyrith. It adds a complete frontend stack on top of v0.2.0's server-side framework — Virtual DOM with embedded JS runtime, Static Site Generation, 30+ production UI components, a dark glassmorphism design token system, Markdown+GFM renderer, SEO metadata helpers, canvas effects, 5 animation effects, page transitions, and 4 ready-made starter templates.
All v0.2.0 public API is preserved. No breaking changes.
We recommend upgrading to v0.4.0 (latest) which adds ASGI, OAuth2, MFA, background tasks, Stripe payments, AI/LLM streaming, admin panel, Prometheus telemetry, and 26 new modules — with full backwards compatibility.
Installation
pip install pyrith==0.3.0
# Requires Python 3.9+. No external runtime dependencies.Quick Start
from pyrith import Pyrith
from pyrith.ui import page_builder as pb
from pyrith.style.design_tokens import TOKENS
app = Pyrith(__name__)
@app.get('/')
def home(request):
page = (
pb.DarkPage('My Site')
.meta(description='Built with pyrith v0.3.0')
.add(
pb.HeroSection(
title='Build the web in Python.',
subtitle='No HTML. No Jinja. No JavaScript build step.',
cta_text='Get Started',
cta_href='/docs',
)
)
.render()
)
return page
if __name__ == '__main__':
app.run(host='127.0.0.1', port=8080, debug=True)Virtual DOM
pyrith.vdom provides a Virtual DOM engine with an embedded JavaScript runtime (~200 lines). Components render server-side, signals update client-side via diffing over WebSocket.
from pyrith.vdom import Component, Signal, h, patch
class Counter(Component):
count = Signal(0)
def render(self):
return h('div', {},
h('p', {}, f'Count: {self.count.value}'),
h('button', {'onclick': self.increment}, '+'),
)
def increment(self, event):
self.count.value += 1
patch(self, self.render())Static Site Generation
from pyrith.ssg import SSG
ssg = SSG(app)
# Crawl all routes, render, minify HTML/CSS/JS, write to dist/
ssg.build()
# Custom route inclusion
ssg.build(routes=['/blog/post-1', '/blog/post-2'])# CLI equivalent
pyrith build # generates dist/
pyrith serve dist/ # serve the static outputPage Builder
Chainable builder API for composing full pages. DarkPage and Page handle boilerplate — meta tags, fonts, viewport, theme, scripts.
from pyrith.ui.page_builder import DarkPage, Page
page = (
DarkPage('Landing')
.meta(description='…', og_image='/og.png')
.fonts(['Inter', 'JetBrains Mono'])
.add(HeroSection(title='…'))
.add(FeatureGrid(features=[…]))
.add(CTASection(cta='Sign up'))
.render()
)UI Components
30+ production components in pyrith.ui.components.advanced.
Design Tokens
Dark glassmorphism palette with semantic color tokens in pyrith.style.design_tokens.
from pyrith.style.design_tokens import TOKENS
# Available tokens: void, neon, mint, ghost, ember, frost, rose, gold
# void — #06060a (deepest background)
# neon — #7c5cff (primary accent, violet-indigo)
# mint — #34f5c5 (success / highlight, cyan-green)
# ghost — #94a3b8 (secondary text)
# ember — #f97316 (warning)
# frost — #38bdf8 (info, sky)
# rose — #fb7185 (error)
# gold — #fbbf24 (special)
bg = TOKENS['void']
accent = TOKENS['neon']Visual Effects
pyrith.style.effects — mesh gradients, aurora, spotlight, particles, tilt, gradient borders, typewriter, scramble text.
from pyrith.style.effects import (
mesh_gradient, aurora_background, spotlight_effect,
particle_field, tilt_card, gradient_border,
typewriter_effect, scramble_text,
)
page.add(aurora_background(colors=['#7c5cff', '#00e5ff', '#34f5c5']))
page.add(particle_field(count=80, speed=0.5, connect_distance=120))
# Element-level
hero.add(typewriter_effect(texts=['Hello.', 'World.'], loop=True))
card.apply(gradient_border(colors=['#7c5cff', '#34f5c5'], width='1px'))Markdown Renderer
from pyrith.ui.markdown import MarkdownRenderer, SyntaxHighlighter
md = MarkdownRenderer(
extensions=['gfm', 'tables', 'task_lists', 'footnotes'],
syntax_theme='void-dark', # or 'github-dark', 'monokai', 'catppuccin'
)
html = md.render('''
# Title
A code block:
```python
x = vp.randn(3, 4)
```
| Col A | Col B |
|-------|-------|
| 1 | 2 |
''')
page.add(html)SEO Metadata
from pyrith.ui.seo import MetaTags, sitemap, robots_txt
tags = MetaTags(
title='pyrith — Python web framework',
description='…',
og_image='/og.png',
og_type='website',
twitter_card='summary_large_image',
json_ld={'@type': 'WebSite', 'name': 'pyrith'},
)
page.head_add(str(tags))
# Helpers
xml = sitemap(routes=['/'], base_url='https://example.com')
txt = robots_txt(allow=['*'], disallow=['/admin'])Canvas Effects
from pyrith.ui.canvas import particle_field, matrix_rain, gradient_orbs
page.add(gradient_orbs(colors=['#7c5cff88', '#00e5ff44'], blur=120))
page.add(particle_field(count=60, connect=True))Page Transitions
from pyrith.ui.page_transitions import animated_route, TransitionType
@app.get('/about')
@animated_route(transition=TransitionType.FADE_SLIDE, duration=400)
def about(request):
return DarkPage('About').add(…).render()
# Available: FADE, SLIDE_UP, FADE_SLIDE, SCALE_FADE, MORPHTailwind Utilities
pyrith.style.tailwind — extended utility classes on top of v0.2.0's full Tailwind engine.
Starter Templates
pyrith new myapp --template landing # or docs / dashboard / blog
cd myapp
pyrith devCLI
pyrith new myapp [--template landing|docs|dashboard|blog]
pyrith dev # development server with hot reload
pyrith build # SSG: render all routes → dist/
pyrith serve [dist/] # serve a static folder