Registry / devops / circus

circus

JSON →
library0.19.0pypiunverified

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.

devopsworkflow
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
Debug
Known footguns
breakingCircus versions 0.17.0+ dropped support for Python 2.7, 3.3, and 3.4. Version 0.16.0+ dropped support for Python 2.6 and 3.3. Ensure your Python environment meets the `>=3.7` requirement for recent versions.
breakingDependency requirements for Tornado and PyZMQ changed significantly. Circus 0.15.0 explicitly forbid Tornado >= 5 and PyZMQ >= 17, while 0.16.0+ requires PyZMQ >= 17 and 0.17.0+ requires Tornado >= 5. This can lead to dependency conflicts or runtime errors if versions are mismatched.
gotchaStarting with version 0.17.0, Circus uses `RawConfigParser` instead of `ConfigParser` for its `.ini` configuration files. If your configuration heavily relies on `ConfigParser`'s interpolation features (e.g., `${section:option}`), these might no longer work as expected and could lead to parsing errors.
gotchaFrom version 0.15.0, the `circusctl` command-line utility returns a non-zero exit code when a command fails. This is a behavioral change from previous versions which might have always returned zero. Scripts relying on `circusctl`'s exit code for success/failure detection will need to be updated.
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.

Resources