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"]}
    ]}
  ]
}

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 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
})

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-0.1.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

seqript-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for seqript-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b7146c43c31ce1743366ea004d3a24b19db11b90460be49f1e45f7da28dbf754
MD5 5cf1ddd6a6ea36a1dd28973af5ea9bd7
BLAKE2b-256 250d30d38328f129328e4dca4825b048ccd0671e8ac39030fa432a055e67ab83

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for seqript-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bd779d354bddfb88fd4327a39da7d8b8a4811d60d537f824acb3c729549ca40a
MD5 d8a74acb9ff618747b7708940cce19f2
BLAKE2b-256 4f688867e834bcf577ef12dddb1c19f6d9b5ab2e0a8a72a6ea42bc1d9f149db3

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