nocville
Put your Python programs in your team's Nocville office. Each program becomes an NPC that walks in, shows its status and leaves when it stops.
Updates are end-to-end encrypted before they leave your computer. Python publishes through a small local bridge that does the encryption, so you set up the bridge once and then use this package.
Quick start
-
Connect this computer to your office. You need Node.js 18.19 or later.
npx @nocville/npc@latest setup
This opens your browser to approve the connection.
-
Start the bridge and leave it running:
npx @nocville/npc@latest bridge
It listens only on
127.0.0.1. Run it as a background service if your program runs all the time. -
Install the package and publish:
pip install nocville
from nocville import NocvilleClient client = NocvilleClient.from_bridge(service_id="backup-bot") try: client.push_status("healthy", message="Last backup 2h ago", name="Backup Bot", kind="backup-bot") finally: client.shutdown() # the NPC leaves the office
Your NPC appears in the office straight away. Click it there to choose which room it works in.
Status
push_status(status, ...) takes:
| Field | Meaning |
|---|---|
status |
"healthy", "warning", "critical" or "unknown" (or Status.HEALTHY) |
mood |
"happy", "concerned", "stressed" or "idle" (derived when omitted) |
message |
One short line for its speech bubble |
name |
The name above the NPC |
kind |
Its type, so your team can send every NPC of that type to one room |
metrics |
A flat dictionary of numbers or strings shown on its card |
offline |
True removes the NPC immediately |
Shortcuts: client.healthy("All good"), client.warning("Disk 85%"),
client.critical("Backup failed!").
Send one update per check (every 15–60 seconds is typical), not one per event. To keep
the NPC in the office between changes, call client.start_heartbeat(30).
Async
pip install "nocville[async]"
import asyncio
from nocville import AsyncNocvilleClient
async def main():
client = AsyncNocvilleClient.from_bridge(service_id="backup-bot")
try:
await client.push_status("healthy", message="All systems operational")
finally:
await client.shutdown()
asyncio.run(main())
Screens, devices and behavior
NPCs can have a screen or device beside them and hints for how they move:
from nocville import BehaviorHints, CompanionSpec
behavior: BehaviorHints = {"activity": "busy", "busy": "seek-desk"}
companion: CompanionSpec = {
"screenType": "desk-sign",
"placement": "on-desk",
"size": {"w": 3, "h": 1},
"label": "checkout-api",
}
client.push_status("healthy", name="Build Agent", message="Running tests",
behavior=behavior, companion=companion)
behavior["activity"]is optional; it is derived from status and mood.busyandcriticalsend the NPC to its desk, its own device ("busy": "seek-companion") or equipment.idlefollows theidlehint.waitingfreezes the NPC where it stands with a raised hand. Use it only for "blocked on a person", not for a degraded service; sendbusyfor warnings so it stays at its device.- Dictionaries use the API's camelCase keys.
The Build your own NPC guide covers screen types and drawing your own pixel-art devices.
Office characters
Built-in characters with their own routines and dialogue: receptionist, security,
janitor, barista, office-cat, office-dog, plant-caretaker, it-technician,
out-of-touch-executive and slightly-inappropriate-hr. Use the same value for kind
and behavior["role"], and keep sending heartbeats while it should stay:
client.push_status("healthy", kind="office-cat",
behavior={"role": "office-cat", "activity": "idle"})
To run them without writing code, use npx @nocville/npc@latest office-cat (see the
NPC Library).
Shutting down
shutdown() stops heartbeats and tells the office the NPC has left (use
await client.shutdown() for the async client). Call it in a finally block.
auto_offline=True also tries at interpreter exit, but that can't run after a crash or
SIGKILL.
Options
from_bridge(path=None, service_id=..., **options). path defaults to the bridge's
client file in ~/.config/nocville.
| Option | Default | Description |
|---|---|---|
timeout |
5.0 | Request timeout in seconds |
retries |
3 | Retry attempts on failure |
retry_delay |
1.0 | Base delay between retries in seconds |
debug |
False | Enable debug logging |
Security
- The bridge's client file holds a local token, not your Nocville key. Your key and
signing keys stay in
~/.config/nocville; keep that folder private. - Status is unencrypted only on the loopback connection to the bridge, which encrypts it before anything leaves the computer. Run the bridge on the same machine as your programs.
- Passing a Nocville key directly to
NocvilleClientis refused, so status can't be sent unencrypted by mistake.
Requires Python 3.9 or later. MIT licensed.
Metadata
Release files for nocville 0.5.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nocville-0.5.8.tar.gz | 13.6 kB | Without provenance | Details for nocville-0.5.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nocville-0.5.8-py3-none-any.whl | Python 3 | none | any | Details for nocville-0.5.8-py3-none-any.whl |
Total release size: 25.8 kB
Release files / nocville-0.5.8.tar.gz
| Download URL | nocville-0.5.8.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d936112bdac6e5a8ddbb180b48477d7786a87a5eeb148c8bd43b77e946f32456
|
|
BLAKE2b-256 checksum How to use checksums |
fbf5efe042dc6886078ba7b8328d86801a9ecfb6762b08e17174b552db61a8fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.3
|
Release files / nocville-0.5.8-py3-none-any.whl
| Download URL | nocville-0.5.8-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fee91e8567504df565dd2456891fbcf09cffb12db1c1fa571b2e0794bcc6d664
|
|
BLAKE2b-256 checksum How to use checksums |
87cc9e7d1e5df28ff1a0f8759387004729f2dce1abede63ed34dea55b55b4672
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.3
|
Security for nocville 0.5.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.