Service Environment Isolation & Orchestration System
Project description
Servos - Service Environment Isolation & Orchestration System
A lightweight Python library for environment isolation, Docker orchestration, and multi-platform service deployment. Extracted from the ProServe framework to provide focused environment isolation capabilities.
๐ฏ Overview
Servos provides robust environment isolation and orchestration for running services across multiple platforms including Arduino, MicroPython, ARM64, and x86_64 architectures. It offers containerized execution environments with automatic platform detection and deployment.
๐ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Servos Architecture โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ
โ โ CLI Interface โ โ Core Isolation โ โ
โ โ โ โ โ โ
โ โ โข Platform โโโโโบโ โข Environment โ โ
โ โ Detection โ โ Management โ โ
โ โ โข Script Exec โ โ โข Process โ โ
โ โ โข Orchestration โ โ Isolation โ โ
โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ
โ โ โ โ
โ โผ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Docker Environments โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ
โ โ Arduino โ MicroPython โ ARM64 โ x86 โ โ
โ โ Container โ Container โContainerโ 64 โ โ
โ โ โ โ โContโ โ
โ โ โข Platform โ โข CircuitPy โ โข ARM โ โข โ โ
โ โ IO โ โข ESP32 โ CPU โStd โ โ
โ โ โข Firmware โ โข Embedded โ โข Pi4 โCPU โ โ
โ โ Upload โ Libs โ โข M1 โx86 โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ง Component Layers
graph TB
CLI[CLI Interface] --> Core[Core Isolation]
CLI --> Platform[Platform Detection]
Core --> Docker[Docker Manager]
Platform --> Docker
Docker --> Arduino[Arduino Container]
Docker --> MicroPython[MicroPython Container]
Docker --> ARM64[ARM64 Container]
Docker --> x86[x86_64 Container]
Arduino --> Hardware1[Arduino Hardware]
MicroPython --> Hardware2[ESP32/CircuitPython]
ARM64 --> Hardware3[Raspberry Pi/Apple M1]
x86 --> Hardware4[Standard PC/Server]
๐ Quick Start
Installation
# Basic installation
pip install servos
# With all optional dependencies
pip install servos[all]
# With Docker support
pip install servos[docker]
# For MicroPython development
pip install servos[micropython]
# For Arduino development
pip install servos[arduino]
Basic Usage
from servos import IsolationManager, PlatformDetector
# Detect current platform
detector = PlatformDetector()
platform = detector.detect_platform()
print(f"Detected platform: {platform}")
# Create isolated environment
manager = IsolationManager(platform=platform)
result = manager.execute_isolated("my_script.py")
CLI Usage
# Detect current platform
servos detect
# Run script in isolated environment
servos isolate my_script.py
# List supported platforms
servos list-platforms
# Show version information
servos version
๐ Supported Platforms
| Platform | Description | Container | Use Cases |
|---|---|---|---|
arduino |
Arduino & compatible MCUs | โ | IoT, embedded systems |
micropython |
MicroPython environments | โ | ESP32, CircuitPython |
arm64 |
ARM64 processors | โ | Raspberry Pi, Apple M1 |
x86_64 |
Standard x86_64 | โ | PCs, servers |
rpi-arm |
Raspberry Pi ARM | โ | Pi-specific projects |
๐ฆ Package Structure
servos/
โโโ servos/
โ โโโ __init__.py # Main package interface
โ โโโ cli.py # Command-line interface
โ โโโ core/
โ โ โโโ __init__.py
โ โ โโโ isolation.py # Core isolation management
โ โโโ isolation/
โ โโโ __init__.py
โ โโโ extended_environments.py # Extended isolation
โ โโโ platforms/ # Platform-specific code
โโโ docker/ # Container definitions
โ โโโ arduino/ # Arduino container
โ โโโ micropython/ # MicroPython container
โ โโโ arm64/ # ARM64 container
โ โโโ x86_64/ # x86_64 container
โโโ tests/ # Test suite
โโโ setup.py # Package configuration
โโโ requirements.txt # Dependencies
โโโ Makefile # Build automation
โโโ README.md # This file
๐จ Development
Local Development
# Clone and setup
git clone https://github.com/servos/servos.git
cd servos
# Install in development mode
make install
# Run tests
make test
# Build package
make build
# Format code
make format
Building Containers
The Docker environments are automatically built when needed, but you can also build them manually:
# Build specific platform container
docker build -f docker/arduino/Dockerfile -t servos:arduino .
docker build -f docker/micropython/Dockerfile -t servos:micropython .
docker build -f docker/arm64/Dockerfile -t servos:arm64 .
docker build -f docker/x86_64/Dockerfile -t servos:x86_64 .
๐งช Testing
# Run all tests
make test
# Run specific test
python -m pytest tests/test_isolation.py
# Run with coverage
python -m pytest --cov=servos tests/
๐ API Reference
IsolationManager
Main class for managing environment isolation:
from servos import IsolationManager, EnvironmentConfig
config = EnvironmentConfig()
manager = IsolationManager(platform="arduino", config=config)
result = manager.execute_isolated("blink_led.py")
PlatformDetector
Automatic platform detection:
from servos.isolation.platforms import PlatformDetector
detector = PlatformDetector()
platform = detector.detect_platform()
architecture = detector.get_architecture()
๐ Integration with ProServe
Servos is designed to work seamlessly with the ProServe framework:
# In your ProServe service manifest
dependencies:
- servos>=1.0.0
# Use in ProServe services
from servos import IsolationManager
from proserve import Service
class MyService(Service):
def __init__(self):
self.isolation = IsolationManager()
async def handle_request(self, request):
result = self.isolation.execute_isolated("user_script.py")
return {"status": "success", "result": result}
๐ค Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
๐ License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
๐จโ๐ป Author
Tom Sapletta
- GitHub: @tom-sapletta
- Email: tom@sapletta.com
๐ Acknowledgments
- Extracted from the ProServe framework
- Built for the EDPMT (Electronic Device Programming & Management Tool) ecosystem
- Inspired by modern containerization and microservices architectures
Servos - Making environment isolation simple and powerful! ๐
Project details
Release history Release notifications | RSS feed
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 servos-1.0.0.tar.gz.
File metadata
- Download URL: servos-1.0.0.tar.gz
- Upload date:
- Size: 39.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edcb425f7ff56aa38eb48500b2aebd844a1f1efbb3cb966fd7da6c00cd140e86
|
|
| MD5 |
7e32a93406363799d74a9c1d8341bcda
|
|
| BLAKE2b-256 |
fec03ed7f51a7cc0074de4a9ebf1f4bda711feceac4306880f3e46c102659ba9
|
File details
Details for the file servos-1.0.0-py3-none-any.whl.
File metadata
- Download URL: servos-1.0.0-py3-none-any.whl
- Upload date:
- Size: 42.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f7506c652c72309c9459bda8527d258fef4910f56b68d91ac5add0774aa921b
|
|
| MD5 |
b3befbec7372b5e6f2bcc3989e96fdc1
|
|
| BLAKE2b-256 |
ff5cc3974f2bff9ed8555c61c9e06437d6e76e6054ee63cd093e96f74827c5d5
|