Skip to main content

Service Environment Isolation & Orchestration System

Project description

Servos - Service Environment Isolation & Orchestration System

License Python PyPI Docker

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

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

๐Ÿ‘จโ€๐Ÿ’ป Author

Tom Sapletta

๐Ÿ™ 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

servos-1.0.0.tar.gz (39.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

servos-1.0.0-py3-none-any.whl (42.3 kB view details)

Uploaded Python 3

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

Hashes for servos-1.0.0.tar.gz
Algorithm Hash digest
SHA256 edcb425f7ff56aa38eb48500b2aebd844a1f1efbb3cb966fd7da6c00cd140e86
MD5 7e32a93406363799d74a9c1d8341bcda
BLAKE2b-256 fec03ed7f51a7cc0074de4a9ebf1f4bda711feceac4306880f3e46c102659ba9

See more details on using hashes here.

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

Hashes for servos-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f7506c652c72309c9459bda8527d258fef4910f56b68d91ac5add0774aa921b
MD5 b3befbec7372b5e6f2bcc3989e96fdc1
BLAKE2b-256 ff5cc3974f2bff9ed8555c61c9e06437d6e76e6054ee63cd093e96f74827c5d5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page