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.1.tar.gz (102.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.1-py3-none-any.whl (26.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyclay-1.1.1.tar.gz
  • Upload date:
  • Size: 102.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.1.tar.gz
Algorithm Hash digest
SHA256 24d474964a08d41896c02bf19fe68e6725f8de630d354e0bc6c9c03430a6ce00
MD5 4e8b4640866cb333261df27d160f673d
BLAKE2b-256 398071c52bf7b295f80a738c007e15f2829894caa9cb9cde03ec6f07212e9dc6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyclay-1.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: pyclay-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 26.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 06fc98df98708e7c5f049e3267659e8918df95d9e43397aed2d295f5aca99d92
MD5 0ee5b750610f3345bb14c31f1e25543c
BLAKE2b-256 08677fdb37efbdf3d74aea7b6e64001f888443fc196c4062eb2b00911d77a115

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyclay-1.1.1-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