Skip to content

Commit ca6947e

Browse files
authored
Merge pull request #9 from sandialabs/minor-tweaks
Minor tweaks
2 parents 385bc3f + 4dbf516 commit ca6947e

File tree

8 files changed

+184
-134
lines changed

8 files changed

+184
-134
lines changed

setup.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,13 @@
44
To install, simply ``python3 -m pip install .`` in the repository root.
55
"""
66

7-
from setuptools import setup
7+
# © 2024 National Technology & Engineering Solutions of Sandia, LLC
8+
# (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the
9+
# U.S. Government retains certain rights in this software.
810

9-
setup(
10-
name="staged-script",
11-
version="1.0.0",
12-
description=(
13-
"A base class to inherit from when building scripts that are "
14-
"subdivided into a series of stages."
15-
),
16-
packages=["staged_script"],
17-
scripts=[],
18-
python_requires=">=3.10",
19-
tests_require=["pytest==7.1.1"],
20-
install_requires=["rich==12.5.1"],
21-
)
11+
# SPDX-License-Identifier: BSD-3-Clause
12+
13+
import setuptools
14+
15+
if __name__ == "__main__":
16+
setuptools.setup()

staged_script/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
and functions.
66
"""
77

8+
# © 2024 National Technology & Engineering Solutions of Sandia, LLC
9+
# (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the
10+
# U.S. Government retains certain rights in this software.
11+
12+
# SPDX-License-Identifier: BSD-3-Clause
13+
814
from .staged_script import (
915
StagedScript,
1016
HelpFormatter,
@@ -20,3 +26,4 @@
2026
"StageDuration",
2127
"lazy_property",
2228
]
29+
__version__ = "1.0.0"

staged_script/staged_script.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
your own staged scripts, along with some helpers.
66
"""
77

8+
# © 2024 National Technology & Engineering Solutions of Sandia, LLC
9+
# (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the
10+
# U.S. Government retains certain rights in this software.
11+
12+
# SPDX-License-Identifier: BSD-3-Clause
13+
814
import functools
915
import re
1016
import shlex
@@ -699,7 +705,7 @@ def _end_stage_test(self) -> None:
699705
stage_duration = datetime.now(tz=timezone.utc) - self.stage_start_time
700706
self.durations.append(
701707
StageDuration(self.current_stage, stage_duration)
702-
) # yapf: disable
708+
)
703709
self.console.log(
704710
f"`{self.current_stage}` stage duration: {stage_duration!s}"
705711
)
@@ -862,9 +868,11 @@ def pretty_print_command(self, command: str, indent: int = 4) -> str:
862868
args = shlex.split(command)
863869
lines = [args.pop(0)]
864870
while args:
865-
if (not self._current_arg_is_long_flag(args)
866-
or self._next_arg_is_flag(args)
867-
or len(args) == 1): # yapf: disable
871+
if (
872+
not self._current_arg_is_long_flag(args)
873+
or self._next_arg_is_flag(args)
874+
or len(args) == 1
875+
):
868876
lines.append(args.pop(0))
869877
else:
870878
lines.append(
@@ -887,9 +895,9 @@ def print_dry_run_message(self, message: str, *, indent: int = 0) -> None:
887895
self.console.log(
888896
Padding(
889897
Panel(f"DRY-RUN MODE: {message}", style="yellow"),
890-
(0, 0, 0, indent)
898+
(0, 0, 0, indent),
891899
)
892-
) # yapf: disable
900+
)
893901

894902
def print_heading(self, message: str, *, color: str = "cyan") -> None:
895903
"""
@@ -904,9 +912,8 @@ def print_heading(self, message: str, *, color: str = "cyan") -> None:
904912
self.console.log(Panel(f"[bold]{message}", style=color))
905913

906914
def print_script_execution_summary(
907-
self,
908-
extra_sections: dict[str, str] | None = None
909-
) -> None: # yapf: disable
915+
self, extra_sections: dict[str, str] | None = None
916+
) -> None:
910917
"""
911918
Print a summary of everything that was done by the script.
912919

test/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""
2+
Create the ``test`` package.
3+
4+
This ``__init__.py`` file creates the ``test`` package, such that tests
5+
can relative-import from modules in the sibling ``staged_script``
6+
directory.
7+
"""
8+
9+
# © 2024 National Technology & Engineering Solutions of Sandia, LLC
10+
# (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the
11+
# U.S. Government retains certain rights in this software.
12+
13+
# SPDX-License-Identifier: BSD-3-Clause

0 commit comments

Comments
 (0)