Skip to content

Commit

Permalink
Merge pull request #21 from sandialabs/fill-out-docs
Browse files Browse the repository at this point in the history
Create documentation and examples
  • Loading branch information
jmgate authored Jun 25, 2024
2 parents a238877 + 5336421 commit aeb757c
Show file tree
Hide file tree
Showing 26 changed files with 2,070 additions and 347 deletions.
2 changes: 2 additions & 0 deletions .bandit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bandit]
skips = B603
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ Before you begin hacking on `staged-script`, you'll need to do a few things:
```
3. **Run the Examples:** Ensure you can run all the examples with
```bash
cd /path/to/reverse_argparse/example
cd /path/to/staged-script/example
./run-all.bash
```
4. **Build the Documentation:** Ensure you can build the documentation with
```bash
cd /path/to/reverse_argparse/doc
cd /path/to/staged-script/doc
./make-html.bash
```

Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,12 @@ python3 -m pip install staged-script

Once installed, you can simply
```python
import sys
from typing import List

from staged_script import StagedScript


class MyScript(StagedScript):

@StagedScript.stage("hello", "Greeting the user")
Expand All @@ -59,14 +63,15 @@ class MyScript(StagedScript):
def say_goodbye(self) -> None:
self.run("echo 'Goodbye World'", shell=True)

def main(self, argv: list[str]) -> None:
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:])
Expand Down Expand Up @@ -102,6 +107,10 @@ See [LICENSE.md](LICENSE.md).
## Credits

Special thanks to [the GMS project][gms] for investing in the development of
this package.
this package. Aspects of this functionality were inspired by the
[SPiFI][spifi] Jenkins Pipeline plugin and the [ShellLogger][shelllogger]
Python package.

[gms]: https://github.com/SNL-GMS/GMS-PI25
[spifi]: https://github.com/sandialabs/SPiFI
[shelllogger]: https://github.com/sandialabs/shell-logger
1 change: 1 addition & 0 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ sphinx
sphinx-autodoc-typehints
sphinx-copybutton
sphinx-rtd-theme
sphinxcontrib-mermaid
sphinxcontrib-programoutput
1 change: 1 addition & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"sphinx_autodoc_typehints",
"sphinx_copybutton",
"sphinx_rtd_theme",
"sphinxcontrib.mermaid",
"sphinxcontrib.programoutput",
]
intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}
Expand Down
Loading

0 comments on commit aeb757c

Please sign in to comment.