Skip to main content

Seqript is a recursive structured command engine.

Project description

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

  1. Add engines to engine/contrib/
  2. Override default engines during initialization
  3. 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

  1. Create a script file (example.json):
{
  "seq": [
    {"comment": "My first script"},
    {"sleep": 2},
    {"cmd": ["echo", "Hello World"]}
  ]
}
  1. Execute it:
from seqript import Seqript

seqript = Seqript(name="example")
with open("example.json") as f:
    seqript(**json.load(f))

Available Engines

  • seq: Sequential execution
  • par: Parallel execution
  • cmd: Command execution
  • nop: No operation
  • sleep: Delay execution
  • comment: Print message

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

seqript-1.0.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

seqript-1.0.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file seqript-1.0.0.tar.gz.

File metadata

  • Download URL: seqript-1.0.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for seqript-1.0.0.tar.gz
Algorithm Hash digest
SHA256 fcce83aee93c0a7469848cd9c00cbf020fdcde9670ed405bdf40b3bc500b4433
MD5 225259eba43d718000e44bb32647b474
BLAKE2b-256 bfc5b8307bc18ebbdba59a20e93d574f097f53f1934f984e66c0b589f05052e1

See more details on using hashes here.

File details

Details for the file seqript-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: seqript-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for seqript-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65657998bb667a3af663b8c313871f751cec8a8159aed3d672e4b50d8def7117
MD5 320317655de5822b01b79047e43bf049
BLAKE2b-256 6e2ae5955fd06bc7b407cef734f34e068615005aec171735e39e280fcdd6f84f

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