A typesafe system for defining and composing steps.
Project description
safetydance
safetydance
is a Python framework for defining type-safe and flexibly composable
application steps with a shared execution context for sharing variables between the
steps. The design of safetydance is partially inspired by <https://cucumber.io>
_.
Description
safetydance
defines a set of decorators that rewrite functions as steps and scripts.
A step should be a function with a name that reads easily, like a short phrase or sentence. Steps may take arguments and they may access variables defined for the "context scope". Steps may call other steps, too.
A script is a function composing the execution of a series of steps. A script is a step that defines an execution context. Scripts may also call other scripts. The primary difference between a script and a step is the implicit definition of the execution context. TODO When a script calls another script the current execution context may be passed as a kwarg to the nested script; by default all scripts execute in their own execution context; that is, if a step is used by both an originating and a nested script the context variables it accesses are determined by the calling script's execution context.
Context Scope Variables
A context scope variable is sort of like a global variable. The run of a script defines
a context where context_data
variables are stored for access by steps.
Think of a conversation between two friends. Much of the conversation will reference
assumed shared knowledge, or context. For safetydance
, the context scope provides a
way for steps to share assumed context to make it possible to provide a more
conversational style of programming
Future Work
- Mypy extension to validate scripts. For example, prove that a script shouldn't fail
due to missing
context_data
for any step in the script. - Dry run execution of steps
- DAG derivation for scripts
- Parallel evaluation for independent up to a join for DAG legs of a script.
- Diagram output for script DAGs.
Setup for Development
poetry install
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
File details
Details for the file safetydance-0.3.2.tar.gz
.
File metadata
- Download URL: safetydance-0.3.2.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.15 CPython/3.8.15 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5092e4e415a4be73e53b17db55acf669f454a4f6018d391db67a51d8c15b2db |
|
MD5 | bf230922ed497eac1020c1acca4d0f4c |
|
BLAKE2b-256 | 558b09814ea98da8111e2bc000b51bd0d9620ec9b0fc1f048ef680da8d854828 |
File details
Details for the file safetydance-0.3.2-py3-none-any.whl
.
File metadata
- Download URL: safetydance-0.3.2-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.15 CPython/3.8.15 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea99c57b61637ddba2910f74d0994b2d91d656c3d1f69692e1748f39873b5e38 |
|
MD5 | 2eb4f7c761f161c431a4f3dd261b49d8 |
|
BLAKE2b-256 | a4716a79a6305f7104242b7d5ae71b85b2e8ab1e748e99c13dcf07bfb961c6fd |