Skip to main content

A custom Python static site generator for polished documentation websites.

Project description

Staticnest

A pure-Python static site generator for polished documentation sites — strong typography, left sidebar navigation, right table of contents, client-side full-text search, and live reload in dev mode.

PyPI Python License: MIT


Features

  • Zero runtime dependencies — pure Python, no Node, no build system
  • TOML-based configuration — single site.toml controls everything
  • YAML navigation — explicit sidebar order, nested groups, top-bar links
  • Front matter — YAML (---) or TOML (+++) blocks for title, summary, draft, order, and template overrides
  • Syntax highlighting — Pygments-powered with the xcode style
  • Table of contents — auto-generated per page, scroll-synced right panel
  • Client-side search — full-text index baked into each page at build time
  • Live reload dev server — watches content and config files, pushes reload via polling
  • GitHub Pages deploy — one command builds and force-pushes to gh-pages
  • Theme overrides — drop custom CSS/JS or a full HTML template into theme/

Installation

From PyPI

pip install staticnest-cli

From source (local / contributor)

git clone https://github.com/Dev-kitx/staticnest-cli.git
cd staticnest-cli
pip install -e .

The -e flag installs in editable mode — changes to src/staticnest/ are reflected immediately without reinstalling. The staticnest command is available as soon as this completes.


Quick start

# 1. Scaffold a new project
staticnest init my-docs

# 2. Preview with live reload
staticnest preview --config my-docs/site.toml

# 3. Build for production
staticnest build --config my-docs/site.toml

The scaffolded directory contains:

my-docs/
├── site.toml        # site-wide config
├── navigation.yml   # sidebar + top-bar nav
└── content/
    └── index.md     # home page

CLI reference

All commands follow the pattern:

staticnest <command> [options]

init

Scaffold a new project directory.

staticnest init [path]
Argument Default Description
path . Directory to initialise. Created if it does not exist.

build

Build the site to output_dir (configured in site.toml).

staticnest build --config <path/to/site.toml>
Flag Default Description
--config site.toml Path to the site configuration file.

preview / serve

Start a local dev server with live reload. Both names are equivalent.

staticnest preview --config <path/to/site.toml> [--host HOST] [--port PORT]
Flag Default Description
--config site.toml Path to the site configuration file.
--host 127.0.0.1 Network interface to bind.
--port 8000 Port to listen on.

publish

Copy the built output to a publish destination.

staticnest publish --config <path/to/site.toml> [--destination DIR]
Flag Default Description
--config site.toml Path to the site configuration file.
--destination output_dir from config Override the target directory for this run.

gh-deploy

Build, add GitHub Pages artifacts (.nojekyll, 404.html), and force-push to a deploy branch.

staticnest gh-deploy --config <path/to/site.toml> [--remote REMOTE] [--branch BRANCH] [--message MSG]
Flag Default Description
--config site.toml Path to the site configuration file.
--remote origin Git remote to push to.
--branch gh-pages Branch to force-push the output to.
--message Deploy staticnest site Commit message for the deploy commit.

Configuration (site.toml)

[site]
title       = "My Docs"
description = "Documentation for My Project"
base_url    = "https://your-org.github.io/your-repo/"
output_dir  = "dist"

[brand]
name = "My Project"

[theme]
name = "nest"
# Optional: enable theme overrides from a local directory
# dir = "theme"

[nav]
file = "navigation.yml"

Navigation (navigation.yml)

- title: Overview
  page: index.md

- title: Guides
  items:
    - page: docs/getting-started.md
    - page: docs/configuration.md

- navigation-bar:
    github:
      title: GitHub
      link: https://github.com/your-org/your-repo
      logo: https://github.githubassets.com/favicons/favicon.svg
    resources:
      title: Resources
      items:
        - name: Release notes
          link: https://example.com/releases

- issues:
    title: Issues
    link: https://github.com/your-org/your-repo/issues

Each nav item supports: title, page, url, items, order.

  • navigation-bar.github renders as a dedicated icon link in the top-right header.
  • Other navigation-bar entries render to the left of the search bar.
  • issues.link populates the "Give us feedback" link in the right-side TOC panel.

Front matter

YAML (---) or TOML (+++) at the top of any .md file:

---
title: Architecture
nav_title: System Design
order: 4
summary: Explains the pipeline and page rendering model.
template: page.html
draft: false
---
Field Description
title Page <title> and <h1> (overrides first # heading).
nav_title Shorter label used only in the sidebar.
order Integer sort key within a navigation group.
summary Used in <meta description> and search results.
template Select an alternate template from theme/templates/.
draft Set true to exclude from the build output.

Theme overrides

The built-in nest theme requires no local files. To customise:

[theme]
name = "nest"
dir  = "theme"

When dir is set the generator will:

  • copy theme/assets/* into dist/assets/
  • auto-load theme/assets/custom.css after the built-in stylesheet
  • auto-load theme/assets/custom.js after the built-in script
  • use theme/templates/page.html as the outer HTML shell
  • use template: <name>.html front matter to select other templates

Repository layout

staticnest-cli/
├── src/staticnest/      # package source
│   ├── cli.py           # argparse entry point
│   ├── site.py          # build / publish / deploy orchestration
│   ├── markdown.py      # Markdown → HTML renderer (Pygments-backed)
│   ├── theme.py         # CSS, JS, and HTML template
│   ├── devserver.py     # live-reload HTTP server
│   └── scaffold.py      # init command scaffolding
├── examples/docs-site/  # built-in example site
│   ├── content/
│   ├── navigation.yml
│   └── site.toml
├── tests/               # pytest test suite
├── pyproject.toml
└── README.md

Local development

Run the example site

staticnest preview --config examples/docs-site/site.toml

Open http://127.0.0.1:8000 in your browser. The server rebuilds and reloads automatically when you save a file.

Run tests

pip install pytest
pytest

Releasing

Releases are fully automated via Release Please and Trusted Publishing. Merging a Release Please PR bumps the version and triggers the PyPI publish workflow automatically — no manual wheel building needed.

To verify a release artifact locally before publishing, maintainers can build with:

pip install build
pyproject-build

Note: build.py in the project root is a legacy shim that shadows python -m build. Use pyproject-build until it is removed.


License

MIT — 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

staticnest_cli-0.2.1.tar.gz (48.3 kB view details)

Uploaded Source

Built Distribution

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

staticnest_cli-0.2.1-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

Details for the file staticnest_cli-0.2.1.tar.gz.

File metadata

  • Download URL: staticnest_cli-0.2.1.tar.gz
  • Upload date:
  • Size: 48.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for staticnest_cli-0.2.1.tar.gz
Algorithm Hash digest
SHA256 6a006d9fdb12f1cdd2c68cc49dba55a8978759f9ecf56a31d7d877d05af98abc
MD5 4f4711a971ae4bdc61b598de137ce579
BLAKE2b-256 d7e997f7e55099e1afb93907a5ad2401a3ecb2975e3f9e333fa20167a4107072

See more details on using hashes here.

Provenance

The following attestation bundles were made for staticnest_cli-0.2.1.tar.gz:

Publisher: publish.yml on Dev-kitx/staticnest-cli

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

File details

Details for the file staticnest_cli-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: staticnest_cli-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 25.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for staticnest_cli-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9a710bae0011619c971fe357f9fae5eddcfe7b46fcefbf0306714ce1462610b3
MD5 4001b122baf0df23ca4d62151f81b6db
BLAKE2b-256 aa62d1f5b73d4d294e5dbb0827d42527b3d03c9bf5d10e3d440b0b09c6ec2101

See more details on using hashes here.

Provenance

The following attestation bundles were made for staticnest_cli-0.2.1-py3-none-any.whl:

Publisher: publish.yml on Dev-kitx/staticnest-cli

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