Run lightweight local workflows
Project description
Dyngle
Run lightweight local workflows
Dyngle is a simple workflow runner that executes sequences of commands defined in configuration files. It's like a lightweight combination of Make and a task runner, designed for automating common development and operational tasks.
Basic usage
Create a configuration file (e.g., .dyngle.yml) with your workflows:
dyngle:
operations:
build:
- python -m pip install -e .
- python -m pytest
deploy:
- docker build -t myapp .
- docker push myapp
clean:
- rm -rf __pycache__
- rm -rf .pytest_cache
Run an operation:
dyngle run build
Configuration
Dyngle reads configuration from YAML files. You can specify the config file location using:
--configcommand line optionDYNGLE_CONFIGenvironment variable.dyngle.ymlin current directory~/.dyngle.ymlin home directory
The configuration has 2 parts: operations: and expressions.
Data
Dyngle maintains a block of data throughout operations, which is parsed from YAML in stdin.
Operations
Operations contain steps as a YAML array. The lifecycle of an operation is:
- Load input data if it exists from YAML on stdin (if no tty)
- Perform template rendering on a step, using data and expressions (see below)
- Execute the step in a subprocess
- Continue with the next step
Note that operations in the config are not full shell lines. They are passed directly to the system.
Templates
Prior to running commands, the line containing that command is processed as a template. Entries from the data set can be substituted into the command line using Jinja-like expressions in double-curly brackets ({{ and }}).
For example, if stdin contains the following data:
name: Francis
And the command looks like:
- echo "Hello {{name}}!"
Then the command will output "Hello Francis!".
Expressions
Configs can also contain expressions, written in Python, that can also be referenced in operation steps.
dyngle:
expressions:
say-hello: >-
'Hello ' + name + '!'
operations:
say-hello: echo {{say-hello}}
Expressions can use a controlled subset of the Python standard library, including:
- Built-in data types such as
str() - Essential built-in functions such as
len() - The core modules from the
datetimepackage (but some methods such asstrftime()will fail) - A specialized function called
formatted()to perform string formatting operations on adatetimeobject - A restricted version of
Path()that only operates within the current working directory - Various other useful utilities, mostly read-only, such as the
mathmodule - A special function called
resolvewhich resolves data expressions using the same logic as in templates
Data keys containing hyphens are converted to valid Python names by replacing hyphens with underscores.
Expressions can reference data directly as local names in Python (using the underscore replacements)...
dyngle:
expressions:
say-hello: >-
'Hello ' + full_name + '!'
... or using the resolve() function, which also allows expressions to essentially call other expressions, using the same underlying data set.
dyngle:
expressions:
hello: >-
'Hello ' + resolve('formal-name') + '!'
formal-name: >-
'Ms. ' + full_name
Note it's also possible to call other expressions by name as functions, if they only return hard-coded values (i.e. constants).
dyngle:
expressions:
author-name: Francis Potter
author-hello: >-
'Hello ' + author_name()
Security
Commands are executed using Python's subprocess.run() with arguments split in a shell-like fashion. The shell is not used, which reduces the likelihood of shell injection attacks. However, note that Dyngle is not robust to malicious configuration. Use with caution.
Quick installation (MacOS)
brew install python@3.11
python3.11 -m pip install pipx
pipx install dyngle
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 dyngle-0.4.3.tar.gz.
File metadata
- Download URL: dyngle-0.4.3.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2816dc9a1e44212589f528ef80d9c6520a08d8dd10081773e9113bec90eab9df
|
|
| MD5 |
701bf4f3ecfe757a1efa51263bafefef
|
|
| BLAKE2b-256 |
e64b5a24709a5e1aa43111915f3d48fa9d2fbd613b6b65ba86fd77e50b074981
|
File details
Details for the file dyngle-0.4.3-py3-none-any.whl.
File metadata
- Download URL: dyngle-0.4.3-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d338ee52505b7a47bcdfd57584b438cf75aad3b5d26f21ba6b2f10d4c0ceb221
|
|
| MD5 |
8de5c96fc3f1f07a3809e9c18bd3abeb
|
|
| BLAKE2b-256 |
598249923bb75d257e09c046183e493b3e11a65dae19b2ac44d8cf663a226235
|