Skip to main content

PySiteGen

DOCS badge PyPi badge

PySiteGen is a tiny static site generator for people who would rather compose HTML with Python without any runtime server, client framework, or hidden build graph. PySiteGen gives you primitives. The default visual taste is just a theme layer with terminal-dark aesthetics. It is practical. You write Python functions that return HTML nodes. PySiteGen renders them to static HTML and copies the assets you explicitly ask for.

Why This Exists?

  • You see, my partner understands Python and web was a bit intimidating for them.
  • So, I abstracted just enough web, for this to not become a crutch.
  • And, build static sites with Python primitives.
  • Because, every Python framework felt ...heavier and too abstracted.
  • That's it. No "because I was tired of X, so I over-engineered this piece of crap Y".
  • The irony.

What Can You Build?

  • Static landing pages
  • Personal portfolio and resume sites
  • Documentation sites
  • Collection or showcase pages
  • SPA-style sites with hash routes

The framework gives you primitives. Your project owns the structure.

Project Layout

# generated by pysitegen init
my-site/
  index.py
  assets/index.css
  content/docs/.gitkeep
  static/
    favicon.png
    robots.txt
  .gitignore
  README.md

# produces plain output files
# easily hostable
my-site/
  public/
    index.html
    assets/index.css
    favicon.png
    robots.txt

Works for docs sites, small product or project pages, personal sites, link hubs, simple SPA-style hash routes, and static pages that benefit from Python data and composition.

Build And Preview

# Install PySiteGen from PyPI
python -m pip install pysitegen
pysitegen --version

# Create a new site
pysitegen init my-site
cd my-site
pysitegen serve

# static server without watching or browser reload
pysitegen serve --no-reload

A Page

from pysitegen import a, default_dark, h1, p, page, section

def build():
    return page(
        section(
            p("PySiteGen", class_="eyebrow"),
            h1("Hello from Python."),
            p("This is a static page generated from Python primitives.", class_="muted"),
            a("Read more", href="#more", class_="button primary"),
            class_="container stack",
        ),
        title="Hello",
        description="A PySiteGen page.",
        theme=default_dark(),
    )

Build it and serve it.

This Repo

This repository contains the package source, tests, and the PySiteGen website:

src/pysitegen/  package source and bundled framework assets
tests/          fixture-based behavior tests
website/        PySiteGen website source

Develop locally:

python -m pip install -e .[dev]
python -m pytest
# Build and serve the website

Do not edit website/public/ as source.

Metadata

Release files for pysitegen 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysitegen 1.2.1
File Size Uploaded
pysitegen-1.2.1.tar.gz 30.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pysitegen 1.2.1
File Interpreter ABI Platform
pysitegen-1.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 57.5 kB

Release files / pysitegen-1.2.1.tar.gz

Download URL pysitegen-1.2.1.tar.gz
Size 30.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2c8225d6cb552ce875c6c81bdad7691874ca1f69ccc6c6c7e2f81e9e91f1b4d0
BLAKE2b-256 checksum
How to use checksums
a55b7573d8b51a3270268fcf4baffbfab383c1560d8058f9fb65396ca3bf9edd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 19, 2026.

Transparency log

Release files / pysitegen-1.2.1-py3-none-any.whl

Download URL pysitegen-1.2.1-py3-none-any.whl
Size 27.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0710fea374ee9ff7b77177f15d8acfcca36c41b481d89b2f7213edf44b8020d
BLAKE2b-256 checksum
How to use checksums
57efb052d0dc3ae9b7fc39720c2674c265e118aa234e2532c2a22b1be5319099
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.2.1 This release

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page