Circus is a robust Python program designed to run, monitor, and manage multiple processes and sockets. It provides a flexible way to supervise long-running services, akin to tools like Supervisor, but with a focus on programmatic control and extensibility. The current version is 0.19.0. Releases are somewhat irregular, often tied to Python version support or dependency updates.
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
from circus.arbiter import Arbiter
from circus.watcher import Watcher
from circus.client import CircusClient
This quickstart demonstrates how to programmatically define a watcher for a simple Python script and manage it using the Circus Arbiter. Run this script, and it will start a child process that prints messages every 2 seconds until the Arbiter is stopped via Ctrl+C.
from circus.watcher import Watcher
from circus.arbiter import Arbiter
import time
import sys
# Define a simple command to run
# Using sys.executable ensures the current Python environment's interpreter is used.
command = f"{sys.executable} -c \"import time; print('Hello from Circus!'); time.sleep(2); print('Process exiting.')\""
# Create a watcher for our process
# 'stop_signal' 15 (SIGTERM) is a common graceful shutdown signal
watcher = Watcher(name="my_test_process", cmd=command, numprocesses=1, stop_signal=15)
# Create an arbiter and register the watcher
arbiter = Arbiter([watcher])
print("Starting Circus Arbiter...")
try:
# Start the arbiter, which will launch and manage the watcher's processes
arbiter.start()
print("Arbiter started. Processes are running. Press Ctrl+C to stop.")
# Keep the main thread alive to allow the arbiter to run in the background
while True:
time.sleep(1)
except KeyboardInterrupt:
print("\nCtrl+C detected. Stopping Arbiter...")
# Cleanly stop the arbiter and its managed processes
arbiter.stop()
print("Arbiter stopped. Exiting.")
except Exception as e:
print(f"An error occurred: {e}")
arbiter.stop()
sys.exit(1)
circus --version
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.
Agent activity
0 hits · last 30 days
No traffic data recorded yet.