A Python package enabling the development of robust automation scripts that are subdivided into stages.
Project description
staged-script
Python is an ideal language for certain types of infrastructure automation.
Automating what a user does manually often involves walking through a series of
stages. A user may wish to run all the stages in series, or perhaps only a
subset, and depending on how things go, certain stages may need to be retried.
Once the script finishes running, it'd be ideal if it could tell the user
exactly what was run, for the sake of easing replicability. staged-script
aims to ease the development such automation scripts. It's easy to get started
with, but also provides significant power-user functionality for those who need
it.
Installation
To get up and running with staged-script, simply:
python3 -m pip install staged-script
Usage
Once installed, you can simply
import sys
from staged_script import StagedScript
class MyScript(StagedScript):
@StagedScript.stage("hello", "Greeting the user")
def say_hello(self) -> None:
self.run("echo 'Hello World'", shell=True)
@StagedScript.stage("goodbye", "Bidding farewell")
def say_goodbye(self) -> None:
self.run("echo 'Goodbye World'", shell=True)
def main(self, argv: list[str]) -> None:
self.parse_args(argv)
try:
self.say_hello()
self.say_goodbye()
finally:
self.print_script_execution_summary()
if __name__ == "__main__":
my_script = MyScript({"hello", "goodbye"})
my_script.main(sys.argv[1:])
For more detailed usage and API information, please see our documentation.
Where to Get Help
If you're having trouble with staged-script, or just want to ask a question,
head on over to our issue board. If a quick search doesn't yield
what you're looking for, feel free to file an issue.
Contributing
If you're interested in contributing to the development of staged-script,
we'd love to have your help :grinning: Check out our
contributing guidelines for how to get started.
Past contributors include:
License & Copyright
See LICENSE.md and COPYRIGHT.md.
Credits
Special thanks to the GMS project for investing in the development of this package. Aspects of this functionality were inspired by the SPiFI Jenkins Pipeline plugin and the ShellLogger Python package.
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 staged_script-2.0.0.tar.gz.
File metadata
- Download URL: staged_script-2.0.0.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
495295b93cce301eae567153031b27c70df3821ca4ab47828926f9d5e26cea7d
|
|
| MD5 |
e0fcef1d865c8bbf9d386e563c690b67
|
|
| BLAKE2b-256 |
c2f9461470e09e0fcc3a803ab822350a5a44a16d627986391f7da4aa108d4c3e
|
Provenance
The following attestation bundles were made for staged_script-2.0.0.tar.gz:
Publisher:
semantic-release.yml on sandialabs/staged-script
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
staged_script-2.0.0.tar.gz -
Subject digest:
495295b93cce301eae567153031b27c70df3821ca4ab47828926f9d5e26cea7d - Sigstore transparency entry: 153127319
- Sigstore integration time:
-
Permalink:
sandialabs/staged-script@053d0cd39b0e07d69e6e4dfdb0b3f45f06b87fb9 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/sandialabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
semantic-release.yml@053d0cd39b0e07d69e6e4dfdb0b3f45f06b87fb9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file staged_script-2.0.0-py3-none-any.whl.
File metadata
- Download URL: staged_script-2.0.0-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c87ce79bfbf4f89c7183b2df201e261d09e58f10ec442a827503732e994584fe
|
|
| MD5 |
ba0b24b9012286865fcd7ffd2314c72f
|
|
| BLAKE2b-256 |
168e20b62ef0d3efa76f90cd1f4dfe757885e2a7eb64bb96f3bf3e98469f1807
|
Provenance
The following attestation bundles were made for staged_script-2.0.0-py3-none-any.whl:
Publisher:
semantic-release.yml on sandialabs/staged-script
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
staged_script-2.0.0-py3-none-any.whl -
Subject digest:
c87ce79bfbf4f89c7183b2df201e261d09e58f10ec442a827503732e994584fe - Sigstore transparency entry: 153127320
- Sigstore integration time:
-
Permalink:
sandialabs/staged-script@053d0cd39b0e07d69e6e4dfdb0b3f45f06b87fb9 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/sandialabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
semantic-release.yml@053d0cd39b0e07d69e6e4dfdb0b3f45f06b87fb9 -
Trigger Event:
push
-
Statement type: