Metadata-Version: 2.5
Name: pypress-toolkit
Version: 1.0.1
Summary: Serve a folder of Markdown files as a documentation site, no build step.
Project-URL: Homepage, https://github.com/jenreh/pypress
Project-URL: Repository, https://github.com/jenreh/pypress
Author: Jens Rehpöhler
License: MIT
License-File: LICENSE.md
Keywords: cli,docs,documentation,markdown,server
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.14
Requires-Dist: jinja2>=3.1.6
Requires-Dist: pydantic>=2.14.3
Requires-Dist: pyyaml>=6.0.4
Requires-Dist: rich>=15.0.0
Requires-Dist: sse-starlette>=3.7.1
Requires-Dist: starlette>=1.10.0
Requires-Dist: typer>=0.29.1
Requires-Dist: uvicorn>=0.54.0
Requires-Dist: watchfiles>=1.3.0
Description-Content-Type: text/markdown

<div align="center">

# pypress

  **Serve a folder of Markdown files as a documentation site. No build step.**

  ![Version](https://img.shields.io/badge/version-1.0.1-blue)
  [![License: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE.md)
  [![Python](https://img.shields.io/badge/python-3.14%2B-orange)](https://www.python.org)

  [Install](#install) • [Usage](#usage) • [Configuration](#configuration) • [Development](#development)

</div>

---

pypress scans a folder of Markdown files, writes a small page index, starts a
local web server and opens the site in your browser. The `.md` files are never
converted to HTML on disk: the browser renders them with a bundled
`markdown-it`.

- A clean default theme: nav bar, sidebar, "On this page" outline, previous/next links and footer.
- Live reload: save a file and the open page updates.
- Search over titles and headings with <kbd>⌘K</kbd> / <kbd>Ctrl K</kbd>.
- Light and dark mode.
- Markdown extras: frontmatter, `::: tip | info | warning | danger | details`
  containers, GitHub alerts (`> [!NOTE]`), code line numbers and `{1,3-4}` line
  highlights, Mermaid diagrams (```` ```mermaid ````), and the layouts `home`,
  `doc` and `page`. Hidden folders, `node_modules` and `public` are skipped.
- One optional config file: `pypress.json`, shaped like a VitePress config,
  sets the nav bar, sidebar, logo, social links, footer and extra CSS.
- Works offline. All scripts, styles and fonts are vendored in the package.

![pypress](docs/pypress.png)

## Install

```sh
uv tool install pypress
```

## Usage

```sh
pypress docs
```

| Option | Default | Meaning |
| --- | --- | --- |
| `DOCS_DIR` | `.` | Folder with Markdown files. |
| `--host` | `127.0.0.1` | Interface to bind. |
| `--port` | `8000` | Port; the next free one is used if it is busy. |
| `--open` / `--no-open` | open | Open the browser. |
| `--watch` / `--no-watch` | watch | Live reload on file changes. |
| `--index-only` | off | Write the page index and exit. |
| `--log-level` | `info` | `debug`, `info`, `warning` or `error`. |
| `--version` | | Print the version. |

`index.md` is the home page. Each first level folder becomes a section in the
top bar; deeper folders become groups in the sidebar.

## Configuration

pypress uses two files in the docs folder:

- `pypress.json` is your site config. You write it; pypress never changes it.
  It is optional and has the shape of a VitePress config:

  ```json
  {
    "title": "My Docs",
    "titleTemplate": ":title - My Docs",
    "styles": ["custom.css"],
    "themeConfig": {
      "logo": "/logo.svg",
      "nav": [
        {"text": "Guide", "link": "/guide/", "activeMatch": "^/guide/"},
        {"text": "More", "items": [{"text": "Changelog", "link": "/changelog"}]}
      ],
      "sidebar": {
        "/guide/": [{"text": "Basics", "items": [{"text": "Install", "link": "/guide/install"}]}]
      },
      "socialLinks": [{"icon": "github", "link": "https://github.com/you/repo"}],
      "footer": {"message": "Released under the MIT License."}
    }
  }
  ```

  Without `themeConfig.nav` or `themeConfig.sidebar`, pypress builds them from
  your folders. Saving the file reloads open pages.
- `.pypress/index.json` is the page index: titles, order and headings of all
  pages. pypress writes it and parses only files whose size or modification
  time changed. It is a cache; add `.pypress/` to your `.gitignore`.

An old `pypress.json` that still holds the page list is converted once at start.

See [docs/usage/config.md](docs/usage/config.md) for details.

## Development

Install [`uv`](https://docs.astral.sh/uv/getting-started/installation/) and
[`task`](https://taskfile.dev/installation/), then:

```sh
task init         # Python, dependencies, pre-commit hooks
task serve-docs   # serve this project's docs with pypress
task test         # pytest with coverage
task lint         # ruff + ty
task vendor       # re-download the pinned browser assets
task vendor-theme -- ../site/node_modules  # rebuild the vendored theme CSS
```

The project docs in [docs/](docs/index.md) describe the
[CLI](docs/usage/cli.md), the [frontmatter keys](docs/usage/frontmatter.md),
the [index file](docs/usage/index-file.md) and the
[architecture](docs/design/architecture.md). Vendored assets and their licences
are listed in [pypress/static/vendor/VENDOR.md](pypress/static/vendor/VENDOR.md).

## Security

pypress binds to `127.0.0.1` by default and only serves files inside the docs
folder. Markdown may contain raw HTML, so only serve folders you trust. See
[SECURITY.md](SECURITY.md).

## Branching

See [BRANCHING.md](BRANCHING.md) for the repository branch naming policy.
