Skip to main content

A local-first notebook system for Python, inspired by Clerk for Clojure

Project description

Plaque

A local-first notebook system for Python, inspired by Clerk for Clojure. Plaque turns regular Python files into interactive notebooks with real-time updates and smart dependency tracking.

Features

  • Local-first: Uses plain Python files as the source - and your own editor - no special file formats
  • Live Updates: Browser preview updates in real-time as you edit
  • Rich Output: Supports Markdown, LaTeX equations, plots, DataFrames, and more
  • Flexible Format: Supports both # %% markers and multiline comments for cells
  • Python-native: Use standard Python syntax for both code and documentation

Principles

Many systems support reactive notebooks, like clerk, marimo, observable, pluto, etc. Plaque is meant to be a simple thing that provides 80% of the utility with a very simple package. The core idea is that your files should only run as they would if you ran them from scratch from top to bottom, but we don't actually have to rerun every cell every time. Instead, we only ever re-execute any cell you modify and any cells later in the document.

In this way, you can have most of the benefits for reactivity and live updating, but still get caching and some gaurentee that you don't have to re-evaluate expensive computations.

Usage

Plaque supports two different styles for creating notebooks:

1. Traditional Cell Markers

Using # %% markers, similar to VS Code notebooks:

# Code cell
x = 42
print(f"The answer is {x}")

# %% [markdown]
# # This is a markdown cell
#
# With support for:
# - Lists
# - **Bold text**
# - And more!

# %%
# Another code cell
import matplotlib.pyplot as plt
plt.plot([1, 2, 3], [1, 4, 9])
plt.show()

2. Multiline Comments as Cells

Using Python's multiline strings (""" or ''') for documentation:

"""
# Getting Started

This notebook demonstrates using multiline comments as markdown cells.
All standard markdown features are supported:

1. **Bold text**
2. *Italic text*
3. Code blocks
4. LaTeX equations: $E = mc^2$
"""

# Code is automatically treated as a code cell
x = 42
print(f"The answer is {x}")

"""
## Data Visualization

Now let's make a plot:
"""

import matplotlib.pyplot as plt
plt.plot([1, 2, 3], [1, 4, 9])
plt.show()

"""
The plot shows a quadratic relationship between x and y.
"""

Both styles support:

  • Markdown formatting with bold, italic, lists, etc.
  • LaTeX equations (both inline and display)
  • Code syntax highlighting
  • Rich output (plots, DataFrames, etc.)

Guidelines for Multiline Comments

When using multiline comments as cells:

  1. Top-level comments become markdown cells
  2. Function/method docstrings remain as code
  3. You can mix code and documentation freely
  4. Both """ and ''' are supported

Installation

You can install Plaque using either pip or uv:

Install from PyPI

# Using pip
pip install plaque

# Using uv (recommended)
uv pip install plaque

Local Development

# Clone the repository
git clone https://github.com/alexalemi/plaque.git
cd plaque

# Install in development mode
uv pip install -e .
# or
pip install -e .

Development Setup with Dependencies

For development work with testing and additional tools:

# Clone the repository
git clone https://github.com/alexalemi/plaque.git
cd plaque

# Create and activate a virtual environment (optional)
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install with development dependencies
uv pip install -e ".[dev]"
# or
pip install -e ".[dev]"

Running a Notebook

To render a notebook:

# Generate static HTML
plaque render my_notebook.py

# Generate static HTML with custom output path
plaque render my_notebook.py output.html

# Start a live re-render with caching.
plaque watch my_notebook.py

# Start live server with auto-reload
plaque serve my_notebook.py

# Specify a custom port (default is 5000)
plaque serve my_notebook.py --port 8000

# Open browser automatically
plaque serve my_notebook.py --open

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

plaque-0.2.0.tar.gz (126.0 kB view details)

Uploaded Source

Built Distribution

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

plaque-0.2.0-py3-none-any.whl (29.9 kB view details)

Uploaded Python 3

File details

Details for the file plaque-0.2.0.tar.gz.

File metadata

  • Download URL: plaque-0.2.0.tar.gz
  • Upload date:
  • Size: 126.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.21

File hashes

Hashes for plaque-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f07cab5410f57c1bb758aebc5978b6cc0254d0b177ea0f187cf04d6c6f82d670
MD5 ae1b2eb4a7b08e7cc322dfa65dc479ad
BLAKE2b-256 157fca23aba7eea42c94430f841818aba90a31f9a3714a49ce2f351164313501

See more details on using hashes here.

File details

Details for the file plaque-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: plaque-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 29.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.21

File hashes

Hashes for plaque-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 063ffd80f8c3b4b077c8a9db14010925e408a14a08419831135c41cd40eb8d8b
MD5 9d39eeace18b609053a15ea5ce521d71
BLAKE2b-256 a8cef46fb7ad08cabb683e9f3f87e7f4a1ffce482c3024f8bb89ee52ff5ed0b6

See more details on using hashes here.

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