MetupyServer Reference
Official reference documentation for the MetupyServer class constructor and project settings configured in pyproject.toml.
1. MetupyServer Constructor & Methods
| Method / Property | Type | Default | Description |
|---|---|---|---|
MetupyServer(project_dir) | str | '.' | Initializes the server engine using the specified project root path. |
server.app | Flask | - | Exposes the underlying Flask WSGI application instance. |
server.run(port) | int | 5000 | Launches 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 Key | Type | Default | Description |
|---|---|---|---|
[project].name | str | 'Metupy' | Project name and primary site navigation title. |
[tool.metupy].theme | str | 'default' | UI theme template name (resolved from templates/{theme}). |
[tool.metupy].use_search | bool | True | Enables or disables client-side full-text search indexing. |
[tool.metupy].use_darkmode | bool | True | Enables or disables the dark mode toggle feature. |
[tool.metupy].logo | str | '' | Path or URL pointing to the site logo image. |
[tool.metupy].favicon | str | '' | Path or URL pointing to the site favicon. |
[tool.metupy.icons].cdn_url | str | '' | 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>.