MetupyServer Reference

Official reference documentation for the MetupyServer class constructor and project settings configured in pyproject.toml.

1. MetupyServer Constructor & Methods

Method / PropertyTypeDefaultDescription
MetupyServer(project_dir)str'.'Initializes the server engine using the specified project root path.
server.appFlask-Exposes the underlying Flask WSGI application instance.
server.run(port)int5000Launches the development server with active file watchers on pages/ and pyproject.toml.

2. pyproject.toml Configuration Schema

The engine automatically parses configuration values from pyproject.toml upon server initialization:

TOML KeyTypeDefaultDescription
[project].namestr'Metupy'Project name and primary site navigation title.
[tool.metupy].themestr'default'UI theme template name (resolved from templates/{theme}).
[tool.metupy].use_searchboolTrueEnables or disables client-side full-text search indexing.
[tool.metupy].use_darkmodeboolTrueEnables or disables the dark mode toggle feature.
[tool.metupy].logostr''Path or URL pointing to the site logo image.
[tool.metupy].faviconstr''Path or URL pointing to the site favicon.
[tool.metupy.icons].cdn_urlstr''CDN URL for external font icon libraries (e.g., Font Awesome).

3. Example pyproject.toml

pyproject.toml
[project]
name = "Metupy Docs"

[tool.metupy]
theme = "default"
use_search = true
use_darkmode = true
logo = "/assets/metupy.png"
favicon = "/assets/favicon.ico"

[tool.metupy.icons]
cdn_url = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"

4. Minimal Entrypoint (app.py)

app.py
from metupy.engine import MetupyServer

# Initialize engine relative to current project directory
server = MetupyServer(project_dir=".")

# Expose Flask WSGI instance for Gunicorn / production deployment
app = server.app

if __name__ == "__main__":
    # Start local development server on port 5000
    server.run(port=5000)
Routing & Asset Handling
The engine automatically maps Python files in pages/ to URL routes and serves static assets from the assets/ directory via /assets/<filename>.