A lightweight worker system for creating, compiling, running, and managing Python-based processes
Project description
Procyl v1.0.0
A lightweight, intelligent worker system for creating, compiling, running, and managing Python-based processes.
Procyl simplifies the management of isolated Python workers with automatic dependency detection, environment management, and parallel execution support.
✨ Features
- 🔧 Automatic Dependency Detection - Scans code for external packages (not stdlib)
- 🎯 Smart Environment Management - One-time environment setup via
procyl.prepare() - 🚀 Multiple Execution Modes - Python source, PyInstaller, or Nuitka compilation
- ⚡ Parallel Execution - Run workers multiple times simultaneously
- 📊 Rich Metadata - Access worker info via
.dataproperty - 🛡️ Verification - Built-in worker integrity checks
- 📦 Minimal Footprint - Lightweight, disk-efficient design
- 🔄 Version Control - Support for specific package versions and requirements files
📦 Installation
pip install procyl
For compilation support:
pip install procyl[compile]
🚀 Quick Start
1. Create Workers
Workers are Python functions executed in isolated processes:
import procyl
# Create a simple worker
worker = procyl.create(
"greet",
'''
import sys
print(f"Hello, {sys.argv[1]}!")
'''
)
2. Prepare Environment
Install all dependencies used by workers:
# Automatic - scans all workers
procyl.prepare()
# With specific versions
procyl.prepare(constraints={
"requests": "==2.32.3",
"numpy": ">=2.3,<3"
})
# From requirements file
procyl.prepare(requirements="requirements.txt")
3. Access Worker Metadata
print(worker.data.hash) # Code hash
print(worker.data.compiler) # Compiler used
print(worker.data.compiled) # Compilation status
print(worker.data.dependencies) # External dependencies
print(worker.data.python_version) # Python version
print(worker.data.platform) # Platform info
print(worker.data.path) # Artifact path
print(worker.data.size) # Artifact size
print(worker.data.running) # Is running?
4. Verify Workers
result = worker.verify()
print(result)
# {
# 'name': 'greet',
# 'valid': True,
# 'issues': [],
# 'dependencies': ['requests', 'numpy']
# }
5. Run Workers
# Single execution
output = procyl.run("greet", args=["Alice"])
# Multiple parallel executions
results = worker.run(count=8, args=["Bob"])
for output in results:
print(output)
📚 API Reference
procyl.create()
Create a new worker.
worker = procyl.create(
name: str, # Worker name
code: str, # Python code
icon: Optional[str] = None, # Icon path
args: Optional[List[str]] = None, # Default arguments
compiler: str = "auto", # python/pyinstaller/nuitka/auto
output_dir: Optional[str] = None, # Output directory
timeout_seconds: Optional[int] = None,
auto_delete_after: Optional[int] = None,
compile_args: Optional[List[str]] = None,
)
Returns: Worker object
procyl.prepare()
Prepare the Python environment with dependencies.
success = procyl.prepare(
constraints: Optional[Dict[str, str]] = None,
requirements: Optional[str] = None,
)
Parameters:
constraints: Dict of package version constraintsrequirements: Path to requirements.txt file
Returns: bool - Success status
worker.data
Access worker metadata (read-only).
Properties:
hash- SHA256 hash of code (16 chars)compiler- Compiler usedcompiled- Whether compiledcreated_at- Creation timestamplast_build- Last build timestampdependencies- Set of external package namespython_version- Python versionplatform- Platform stringpath- Path to artifactsize- Artifact size in bytespid- Process ID (if running)running- Whether currently running
worker.verify()
Verify worker integrity.
result = worker.verify()
# Returns dict with:
# - 'name': worker name
# - 'valid': boolean
# - 'issues': list of issues
# - 'compiled': (optional)
# - 'artifact_size': (optional)
# - 'dependencies': (optional)
worker.run()
Execute worker once or multiple times in parallel.
results = worker.run(
count: int = 1, # Number of parallel executions
args: Optional[List[str]] = None, # Arguments (overrides default)
)
Returns: List[str] - List of outputs
procyl.run()
Execute a worker by name.
output = procyl.run(
name: str,
args: Optional[List[str]] = None,
)
procyl.status()
Get worker status.
status = procyl.status(name: str)
procyl.delete()
Delete a worker.
result = procyl.delete(name: str)
procyl.precompile()
Compile a worker ahead of time.
result = procyl.precompile(
name: str,
output_dir: Optional[str] = None,
compiler: Optional[str] = None,
thread: bool = False,
)
📁 File Structure
.procyl/ # Created by prepare()
├── env/ # Python venv
│ ├── bin/ # Python executables
│ ├── lib/ # Installed packages
│ └── ...
├── .metadata/ # Worker metadata
└── metadata.json # Environment info
🔍 Automatic Dependency Scanning
Procyl automatically scans code for external dependencies using AST analysis:
worker = procyl.create("demo", '''
import requests
import numpy as np
import sys # stdlib - ignored
import os # stdlib - ignored
print("Hello")
''')
print(worker.data.dependencies)
# Output: {'requests', 'numpy'}
🎯 Use Cases
Multi-threaded Workers
worker = procyl.create("compute", "print(sum(range(1000)))")
results = worker.run(count=8)
print(f"Computed {len(results)} times in parallel")
Version-Pinned Dependencies
procyl.prepare(constraints={
"tensorflow": "==2.13.0",
"numpy": "<2.0"
})
Compiled Executables
worker = procyl.create("app", code)
procyl.precompile("app", compiler="pyinstaller", output_dir="./dist")
📝 Examples
See examples/demo.py for a comprehensive example:
python examples/demo.py
🧪 Testing
Run tests:
pytest tests/test_core_v1.py -v
Run verification:
python verify.py
📄 Documentation
- CHANGELOG_v1.md - What's new in v1.0.0
- MIGRATION_v1.md - Migration guide from v0.1.1
- README_v1.md - Full API documentation
📄 License
MIT
👤 Author
yolezz
Procyl v1.0.0 - Intelligent Python Worker Management
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 procyl-1.0.0.tar.gz.
File metadata
- Download URL: procyl-1.0.0.tar.gz
- Upload date:
- Size: 25.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c5da6eab2d09e0282cae7495f5d90a18ce340085e4f621c8f37a567ac182ed0
|
|
| MD5 |
79416d1b941bf25164891ba56bc6609a
|
|
| BLAKE2b-256 |
795c7f9b92aa07a218d09e52984ae72604208e4e6e6375a0fbdc4994032dc9df
|
File details
Details for the file procyl-1.0.0-py3-none-any.whl.
File metadata
- Download URL: procyl-1.0.0-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85dd42e5f22078015921827eda6c06acee6c36fc12fa4b1dbe97434515150d61
|
|
| MD5 |
9bc127e6996abf1d5e78c6bcffc820be
|
|
| BLAKE2b-256 |
910f184385cd21d1860796a20e5bacc76df6e152c6f175adcc7dd1f4ac7738b4
|