Gen
Gen is a Python-first toolkit for building static websites.
It is split into two parts:
gen.html: GenHTML, a small object model for creating, editing, parsing, and rendering HTML.gen.ssg: GenSSG, a static site build layer that discovers.ghtmlpage files, runs plugin hooks, builds GenHTML pages, and writes routes todist/.
Status
This is an early implementation. The core GenHTML tree model, parser, GenSSG dispatcher, CLI, and tests are in place.
Install From Source
Create a virtual environment:
python3 -m venv .venv
source .venv/bin/activate
Install dependencies:
python3 -m pip install -r requirements.txt
Install this package locally:
python3 -m pip install -e .
Run tests:
PYTHONPATH=src python3 -m unittest discover -s tests
CLI
Create a new GenSSG project:
gen init --dir my-site
Add a page:
gen add my-site/src/index.ghtml
Build the site:
gen build --dir my-site
Output is written to:
my-site/dist/
GenHTML Example
from gen.html import Div, H1, P, Page, Text
page = Page()
with page:
with Div(class_="content"):
H1("Hello")
P("Built with GenHTML")
print(page.render())
GenSSG .ghtml Contract
A .ghtml file provides page context and build logic:
from gen.html import Element, Page, Text
def CONTEXT(api):
return {
"route": "/",
"title": "Home",
}
def Build(api, context):
page = Page()
with page:
with Element("body"):
with Element("h1"):
Text(context["title"])
return page
CONTEXT(api) may return one dictionary or a list of dictionaries. Each dictionary is passed to Build(api, context).
Build A Distribution
From the repository root:
python3 -m build
This creates source and wheel distributions in:
dist/
Metadata
Release files for gen-ssg 0.4.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gen_ssg-0.4.6-py3-none-any.whl | Python 3 | none | any | Details for gen_ssg-0.4.6-py3-none-any.whl |
Release files / gen_ssg-0.4.6-py3-none-any.whl
| Download URL | gen_ssg-0.4.6-py3-none-any.whl |
|---|---|
| Size | 32.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
95386cb29197c7889283a5fc30053c714f11f5fe3ddb1a9ad178d50aa335ce2f
|
|
BLAKE2b-256 checksum How to use checksums |
9029bbeafef2f87291a478265405c87f26678b51b722bd58566f421b0efa763b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Security for gen-ssg 0.4.6
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.