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 😀 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.
Metadata
Release files for staged-script 2.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| staged_script-2.0.5.tar.gz | 16.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| staged_script-2.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.9 kB
Release files / staged_script-2.0.5.tar.gz
| Download URL | staged_script-2.0.5.tar.gz |
|---|---|
| Size | 16.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1ae2bd4496dfe946e37c0b3ded1388fe25a0305f6ef6dc987902d7e85a3991a
|
|
BLAKE2b-256 checksum How to use checksums |
e9abd0dfec316d0afcf8f963bda0ddc8b236c8ebe108b5c3b4e9a3900a1661ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 21, 2025.
Transparency logRelease files / staged_script-2.0.5-py3-none-any.whl
| Download URL | staged_script-2.0.5-py3-none-any.whl |
|---|---|
| Size | 14.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
30afb7b0c7299486cbbb6dffb34d9750f7c99adc0b8f4329bf97473a1ae12b8a
|
|
BLAKE2b-256 checksum How to use checksums |
3373b26b74698d2190f9565b12c037807a87a591c8765fb44c2a44acf0db262f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 21, 2025.
Transparency log