Seqript (Sequence + Script)
A lightweight framework for executing structured scripts with nested operations.
Features
- Define scripts as nested JSON structures
- Register custom engines for different operations
- Environment variable expansion support
- Sequential and parallel execution modes
- Extensible through engine contributions
Documentation
Installation
pip install seqript (TODO: Add actual installation method)
Example
{
"seq": [
{"comment": "Starting operations"},
{"sleep": 1},
{"par": [
{"cmd": ["echo", "Task 1"]},
{"cmd": ["echo", "Task 2"]}
]}
]
}
Project Structure
Core Components
Seqript: Main class that parses and executes scripts- Engines: Modular operations (
cmd,seq,par, etc.) - Variable Expansion:
${var}substitution system
File Organization
seqript/
├── init.py
├── seqript.py # Main class
├── util/
│ └── expand_variable.py
└── engine/
├── init.py
├── cmd.py # Command execution
├── nop.py # No operation
├── par.py # Parallel execution
├── seq.py # Sequential execution
└── contrib/ # Additional engines
├── sleep.py
└── comment.py
Extension Points
- Add engines to
engine/contrib/ - Override default engines during initialization
- Extend variable expansion patterns## Extension Points
Usage Guide
Script Structure
Scripts are JSON objects where each key represents an engine:
{
"engine_name": engine_specific_configuration
}
Environment Variables
Use ${VAR} syntax in strings for variable expansion:
{
"cmd": ["echo", "${MESSAGE}"],
"env": {"MESSAGE": "Hello"}
}
Custom Engines
Register additional engines during initialization:
from seqript import Seqript
def custom_engine(seqript, **kwargs):
print(f"Custom engine called with {kwargs}")
seqript = Seqript(engines={
"custom": custom_engine,
**Seqript._DEFAULT_ENGINES
})
Quick Start
Basic Usage
- Create a script file (
example.json):
{
"seq": [
{"comment": "My first script"},
{"sleep": 2},
{"cmd": ["echo", "Hello World"]}
]
}
- Execute it:
from seqript import Seqript
seqript = Seqript(name="example")
with open("example.json") as f:
seqript(**json.load(f))
Available Engines
seq: Sequential executionpar: Parallel executioncmd: Command executionnop: No operationsleep: Delay executioncomment: Print message
Release files for Seqript 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| seqript-1.0.0.tar.gz | 6.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| seqript-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.6 kB
Release files / seqript-1.0.0.tar.gz
| Download URL | seqript-1.0.0.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fcce83aee93c0a7469848cd9c00cbf020fdcde9670ed405bdf40b3bc500b4433
|
|
BLAKE2b-256 checksum How to use checksums |
bfc5b8307bc18ebbdba59a20e93d574f097f53f1934f984e66c0b589f05052e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.12
|
Release files / seqript-1.0.0-py3-none-any.whl
| Download URL | seqript-1.0.0-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
65657998bb667a3af663b8c313871f751cec8a8159aed3d672e4b50d8def7117
|
|
BLAKE2b-256 checksum How to use checksums |
6e2ae5955fd06bc7b407cef734f34e068615005aec171735e39e280fcdd6f84f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.12
|