Skip to main content

Build beautiful, responsive web pages entirely in Python. No HTML, CSS, or JS required.

Project description

pyclay

Build beautiful, responsive web pages entirely in Python.

No HTML. No CSS. No JavaScript. Just Python.

PyPI Python License


pyclay is a Python-native static site builder. Write Python functions, get a production-ready HTML page - with themes, responsive layouts, and zero frontend knowledge required.

Features

  • 4 Built-in Themes - Ivory, Nebula, Arctic, and Obsidian. Switch live via dropdown.
  • Fully Responsive - Columns stack on mobile, navbar collapses to hamburger.
  • Hot Reload - Edit Python, save, browser refreshes instantly.
  • Static Export - pyclay build app.py → one HTML file. Deploy anywhere.
  • Rich Components - Cards, tables, metrics, accordions, tabs, alerts, code blocks with syntax highlighting, and more.
  • Zero Config - No package.json, no webpack, no node_modules. Just pip install and go.

Quick Start

pip install pyclay

Create app.py:

import pyclay as pc

pc.page_config(title="My Site", theme="obsidian")
pc.navbar("My Site", links=[
    {"text": "Home", "href": "#home"},
    {"text": "About", "href": "#about"},
])

pc.page("Home")
pc.heading("Hello World!")
pc.text("Built with pyclay - no HTML required.")

pc.card(title="Why pyclay?",
        body="Because life is too short to write HTML.")

pc.page("About")
pc.text("This is the about page.")

Run the dev server:

pyclay run app.py

Build for production:

pyclay build app.py
# → dist/index.html (deploy to GitHub Pages, Netlify, etc.)

Components

Component Usage
Typography pc.heading(), pc.text(), pc.blockquote()
Layout pc.columns(), pc.column(), pc.container()
Data pc.table(), pc.metric(), pc.progress_bar()
UI pc.card(), pc.button(), pc.link_button(), pc.badge(), pc.alert()
Interactive pc.accordion(), pc.tabs(), pc.tab_panel()
Media pc.image(), pc.video(), pc.code_block(), pc.link()
Navigation pc.navbar(), pc.footer(), pc.page()
Utility pc.spacer(), pc.divider(), pc.html_raw()

Static Assets & Favicon

Place all your static files (images, videos, etc.) inside an assets/ folder in your project root. You can reference them in your python code using relative paths like assets/....

  • Favicon: If you put favicon.ico in your assets/ folder, pyclay will automatically detect and link it as your page favicon.
  • Dev Server: The dev server (pyclay run) automatically serves static files requested from your assets/ folder.
  • Static Export: The build command (pyclay build) copies the entire assets/ folder into your output directory (dist/assets/), keeping all media links fully working when deployed.

Themes

pc.page_config(
    theme="obsidian",      # ivory | nebula | arctic | obsidian
    theme_switcher=True    # set to False to lock the site to one theme and hide the toggle
)

By default, users can switch themes live via the built-in dropdown in the navbar (or floating). If you set theme_switcher=False, the site will remain locked to the chosen theme and no toggle dropdown elements will be rendered.

Layout System

with pc.columns([1, 2], gap="2rem"):
    with pc.column():
        pc.text("Narrow column")
    with pc.column():
        pc.text("Wide column")

Columns automatically stack vertically on mobile (<768px).

CLI Reference

Command Description
pyclay run <file.py> Start dev server with hot reload
pyclay run <file.py> --port 3000 Use a custom port
pyclay build <file.py> Export static HTML to dist/
pyclay build <file.py> --out public Custom output directory

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

Apache 2.0 - see LICENSE.

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

pyclay-1.1.0.tar.gz (101.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyclay-1.1.0-py3-none-any.whl (25.6 kB view details)

Uploaded Python 3

File details

Details for the file pyclay-1.1.0.tar.gz.

File metadata

  • Download URL: pyclay-1.1.0.tar.gz
  • Upload date:
  • Size: 101.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyclay-1.1.0.tar.gz
Algorithm Hash digest
SHA256 472ec20c71a0e50378ac910ab5c6e268d8fa741b8b057c70a33c47596c720a59
MD5 f3c94522793467d12996045b5e089efd
BLAKE2b-256 5e6856091ea5639481002fa22becfeab61e613b3271f3aec119e1cae27e518a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyclay-1.1.0.tar.gz:

Publisher: publish.yml on ayush-sharma11/pyclay

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyclay-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyclay-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 25.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyclay-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bbd45083a0ba3da4ea9c301048dabdce1003158202964b44e3f77cc7c69ed1bc
MD5 997efd1c3467bf2e23be163bf9dba2ec
BLAKE2b-256 d66015142e306cf3910aff536a5cff97dc08a93fc4b0b740171e8aace2d6a512

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyclay-1.1.0-py3-none-any.whl:

Publisher: publish.yml on ayush-sharma11/pyclay

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page