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.1.7.tar.gz (47.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.1.7-py3-none-any.whl (25.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: staticnest_cli-0.1.7.tar.gz
  • Upload date:
  • Size: 47.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.1.7.tar.gz
Algorithm Hash digest
SHA256 548b0e5a8c529d67ef1e0d083ade930fd09c3b0028181b7583ebb000518389b7
MD5 ae3a6145ea5fee43d56259e14e9da566
BLAKE2b-256 0775783bbd2febeb2c383e3d1487339f86923efa822f6e4ceb78b5c7c053857d

See more details on using hashes here.

Provenance

The following attestation bundles were made for staticnest_cli-0.1.7.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.1.7-py3-none-any.whl.

File metadata

  • Download URL: staticnest_cli-0.1.7-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.7

File hashes

Hashes for staticnest_cli-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 4efbbcf63a8d66d2e46e9a0417f15e14085af4871783620776c2ac955fd944b9
MD5 9d0f1d6e047a34cea39baede8fba556f
BLAKE2b-256 dce6d7fecba54bd2525b77fbfdf1e001dd05b7a698ec9de206e8d7c415cb8568

See more details on using hashes here.

Provenance

The following attestation bundles were made for staticnest_cli-0.1.7-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