base classes for microservice servers and matrix display pages
Project description
plain_pages
Minimalist base classes for microservice servers and matrix display pages.
plain_pages is a lightweight Python package that provides two foundational classes—ServerPage and DisplayPage—designed to orchestrate real-time data collection and visual display in homelab environments. It’s built for clarity, composability, and just enough abstraction to stay out of your way.
✨ Why plain_pages?
This project grew out of a desire to keep things simple—but not simplistic. In a homelab where services talk over Redis, update displays via RGB matrices, and pull secrets from Vault or Kubernetes, plain_pages offers a clean interface for:
- Scheduling periodic updates
- Fetching and publishing data
- Rendering to LED panels or web displays
- Managing secrets and state with minimal ceremony
🧱 Core Components
ServerPage
A base class for microservices that:
- Reads secrets from Vault, Kubernetes, or environment
- Connects to Redis and a backing database (Postgres, SQLite, MongoDB)
- Periodically fetches data from external APIs
- Writes state to the backing database, and
- Publishes updates via Redis pub/sub
- Supports liveness probes and production/development modes
DisplayPage
A base class for display clients that:
- Reads data from the database
- Tracks freshness and avoids redundant redraws
- Provides helper methods for text alignment, color formatting, and time parsing
- Supports both RGB LED matrix output and static image generation (for testing without RGB LED hardware)
🌕 Example: Moon Phase Tracker
The examples/moon_clock/ directory (coming soon) includes:
MoonServer: Fetches sun/moon data from MET Norway’s API and publishes itMoonDisplay: Renders current time, moon phase, and next moonrise/set on an RGB matrixclientdisplay.py: Drives the LED panel and handles display cycling, pause/play, and override logic via Redis
📦 Installation
pip install dekeyrej-plain-pages
🛠️ Usage
from pages.serverpage import ServerPage
from pages.displaypage import DisplayPage
class MyServer(ServerPage):
def update(self):
# Fetch data, write to DB, publish to Redis
pass
class MyDisplay(DisplayPage):
def display(self):
# Render data to matrix or image
pass
🔐 Secrets & Config
ServerPage supports multiple secret sources from dekeyrej-secretmanager:
- KubeVault - encrypted Kubernetes Secrets with Vault Transit decrypt
- Kubernetes Secrets
- Vault static keys - coming soon!
- Environment variables
- Local JSON files
🧪 Status
This project is under active development. Expect updates, refinements, and the occasional moonbeam.
📄 License
MIT License. See LICENSE for details.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dekeyrej_plain_pages-0.9.5.tar.gz.
File metadata
- Download URL: dekeyrej_plain_pages-0.9.5.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a3eda40b49c2a4f7ef4ea7aaab1f18c264a7561fe187cee18da9f62528a3a4b
|
|
| MD5 |
3e6d1b8e759d9f835dc280c6200164c4
|
|
| BLAKE2b-256 |
866c142bf3de98eb331b94cc3d4592b51442d75c58e9f996a850fad405cfb5b7
|
Provenance
The following attestation bundles were made for dekeyrej_plain_pages-0.9.5.tar.gz:
Publisher:
publish-to-test-pypi.yml on dekeyrej/plain_pages
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dekeyrej_plain_pages-0.9.5.tar.gz -
Subject digest:
1a3eda40b49c2a4f7ef4ea7aaab1f18c264a7561fe187cee18da9f62528a3a4b - Sigstore transparency entry: 255577871
- Sigstore integration time:
-
Permalink:
dekeyrej/plain_pages@6e7c136b74a6b6e464d29a6f5e5d2bc02852e30e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/dekeyrej
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-test-pypi.yml@6e7c136b74a6b6e464d29a6f5e5d2bc02852e30e -
Trigger Event:
push
-
Statement type:
File details
Details for the file dekeyrej_plain_pages-0.9.5-py3-none-any.whl.
File metadata
- Download URL: dekeyrej_plain_pages-0.9.5-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca8e871e1d092220f59b7c98822c6264e9e2914a22cbe531806712313c47c232
|
|
| MD5 |
60270c4a23e7275322d62bc61a51201d
|
|
| BLAKE2b-256 |
01ade6a5a2ae90cd47dd58531975f36c0b1f77b9ca866cca332e086f0f3df8d9
|
Provenance
The following attestation bundles were made for dekeyrej_plain_pages-0.9.5-py3-none-any.whl:
Publisher:
publish-to-test-pypi.yml on dekeyrej/plain_pages
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dekeyrej_plain_pages-0.9.5-py3-none-any.whl -
Subject digest:
ca8e871e1d092220f59b7c98822c6264e9e2914a22cbe531806712313c47c232 - Sigstore transparency entry: 255577874
- Sigstore integration time:
-
Permalink:
dekeyrej/plain_pages@6e7c136b74a6b6e464d29a6f5e5d2bc02852e30e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/dekeyrej
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-test-pypi.yml@6e7c136b74a6b6e464d29a6f5e5d2bc02852e30e -
Trigger Event:
push
-
Statement type: