Skip to content

Commit a9c8005

Browse files
committed
chore!: Drop support for Python 3.8
* Use type-hinting provided out of the box in 3.9. * Use new dictionary update syntax. * Update the docs and CI accordingly.
1 parent 2b7c72b commit a9c8005

18 files changed

+53
-65
lines changed

.github/workflows/continuous-integration.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
runs-on: ubuntu-latest
2020
strategy:
2121
matrix:
22-
version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
22+
version: ["3.9", "3.10", "3.11", "3.12"]
2323
fail-fast: false
2424
steps:
2525

README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
[![pre-commit.ci Status](https://results.pre-commit.ci/badge/github/sandialabs/staged-script/master.svg)](https://results.pre-commit.ci/latest/github/sandialabs/staged-script/master)
1818
[![PyPI - Version](https://img.shields.io/pypi/v/staged-script?label=PyPI)](https://pypi.org/project/staged-script/)
1919
![PyPI - Downloads](https://img.shields.io/pypi/dm/staged-script?label=PyPI%20downloads)
20-
![Python Version](https://img.shields.io/badge/Python-3.8|3.9|3.10|3.11|3.12-blue.svg)
20+
![Python Version](https://img.shields.io/badge/Python-3.9|3.10|3.11|3.12-blue.svg)
2121
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
2222

2323
# staged-script
@@ -44,7 +44,6 @@ python3 -m pip install staged-script
4444
Once installed, you can simply
4545
```python
4646
import sys
47-
from typing import List
4847

4948
from staged_script import StagedScript
5049

@@ -59,7 +58,7 @@ class MyScript(StagedScript):
5958
def say_goodbye(self) -> None:
6059
self.run("echo 'Goodbye World'", shell=True)
6160

62-
def main(self, argv: List[str]) -> None:
61+
def main(self, argv: list[str]) -> None:
6362
self.parse_args(argv)
6463
try:
6564
self.say_hello()

doc/source/examples.rst

+8-8
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ simple stages to say "hello" and "goodbye".
2020
:language: python
2121
:linenos:
2222
:lines: 10-
23-
:emphasize-lines: 9-10,13-14,19-20
23+
:emphasize-lines: 8-9,12-13,18-19
2424
:caption: ``example/ex_0_the_basics.py``
2525

2626
The two methods ``say_hello()`` and ``say_goodbye()`` are stand-ins for
@@ -73,7 +73,7 @@ by adding the following to the ``MyScript`` class:
7373
.. literalinclude:: ../../example/ex_1_removing_the_retry_arguments.py
7474
:language: python
7575
:linenos:
76-
:lines: 28-40
76+
:lines: 27-39
7777
:caption: ``example/ex_1_removing_the_retry_arguments.py``
7878

7979
.. note::
@@ -109,7 +109,7 @@ that case, you can add the highlighted line:
109109
.. literalinclude:: ../../example/ex_2_running_certain_stages_by_default.py
110110
:language: python
111111
:linenos:
112-
:lines: 28-30,42-43
112+
:lines: 27-29,41-42
113113
:emphasize-lines: 4
114114
:caption: ``example/ex_2_running_certain_stages_by_default.py``
115115

@@ -138,7 +138,7 @@ Now let's see about adding some arguments to the parser beyond what
138138
.. literalinclude:: ../../example/ex_3_adding_arguments.py
139139
:language: python
140140
:linenos:
141-
:lines: 33-35,46-58
141+
:lines: 32-34,45-57
142142
:emphasize-lines: 4-15
143143
:caption: ``example/ex_3_adding_arguments.py``
144144

@@ -149,7 +149,7 @@ arguments to handle these new options. You can do so by extending the
149149
.. literalinclude:: ../../example/ex_3_adding_arguments.py
150150
:language: python
151151
:linenos:
152-
:lines: 60-71
152+
:lines: 59-70
153153
:caption: ``example/ex_3_adding_arguments.py``
154154

155155
.. note::
@@ -166,7 +166,7 @@ the two stages to take them into account.
166166
.. literalinclude:: ../../example/ex_3_adding_arguments.py
167167
:language: python
168168
:linenos:
169-
:lines: 21-31
169+
:lines: 20-30
170170
:emphasize-lines: 4,10
171171
:caption: ``example/ex_3_adding_arguments.py``
172172

@@ -193,7 +193,7 @@ overridden in your subclasses.
193193
.. literalinclude:: ../../example/ex_4_customizing_stage_behavior.py
194194
:language: python
195195
:linenos:
196-
:lines: 73-94
196+
:lines: 72-93
197197
:caption: ``example/ex_4_customizing_stage_behavior.py``
198198

199199
.. note::
@@ -243,7 +243,7 @@ is the name of the stage as provided to the :ref:`StagedScript.stage()
243243
.. literalinclude:: ../../example/ex_5_customizing_individual_stages.py
244244
:language: python
245245
:linenos:
246-
:lines: 96-113
246+
:lines: 95-112
247247
:caption: ``example/ex_5_customizing_individual_stages.py``
248248

249249
Now when we run both stages we see:

doc/source/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
.. |PyPI Version| image:: https://img.shields.io/pypi/v/staged-script?label=PyPI
5555
:target: https://pypi.org/project/staged-script/
5656
.. |PyPI Downloads| image:: https://img.shields.io/pypi/dm/staged-script?label=PyPI%20downloads
57-
.. |Python Version| image:: https://img.shields.io/badge/Python-3.8|3.9|3.10|3.11|3.12-blue.svg
57+
.. |Python Version| image:: https://img.shields.io/badge/Python-3.9|3.10|3.11|3.12-blue.svg
5858
.. |Ruff| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
5959
:target: https://github.com/astral-sh/ruff
6060

example/ex_0_the_basics.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
# SPDX-License-Identifier: BSD-3-Clause
99

1010
import sys
11-
from typing import List
1211

1312
from staged_script import StagedScript
1413

@@ -22,7 +21,7 @@ def say_hello(self) -> None:
2221
def say_goodbye(self) -> None:
2322
self.run("echo 'Goodbye World'", shell=True)
2423

25-
def main(self, argv: List[str]) -> None:
24+
def main(self, argv: list[str]) -> None:
2625
self.parse_args(argv)
2726
try:
2827
self.say_hello()

example/ex_1_removing_the_retry_arguments.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import functools
1212
import sys
1313
from argparse import ArgumentParser
14-
from typing import List
1514

1615
from staged_script import StagedScript
1716

@@ -39,7 +38,7 @@ def parser(self) -> ArgumentParser:
3938
self.goodbye_retry_timeout_arg.help = argparse.SUPPRESS # type: ignore[attr-defined]
4039
return my_parser
4140

42-
def main(self, argv: List[str]) -> None:
41+
def main(self, argv: list[str]) -> None:
4342
self.parse_args(argv)
4443
try:
4544
self.say_hello()

example/ex_2_running_certain_stages_by_default.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import functools
1212
import sys
1313
from argparse import ArgumentParser
14-
from typing import List
1514

1615
from staged_script import StagedScript
1716

@@ -42,7 +41,7 @@ def parser(self) -> ArgumentParser:
4241
my_parser.set_defaults(stage=list(self.stages))
4342
return my_parser
4443

45-
def main(self, argv: List[str]) -> None:
44+
def main(self, argv: list[str]) -> None:
4645
self.parse_args(argv)
4746
try:
4847
self.say_hello()

example/ex_3_adding_arguments.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import sys
1313
from argparse import ArgumentParser
1414
from pathlib import Path
15-
from typing import List
1615

1716
from staged_script import StagedScript
1817

@@ -57,7 +56,7 @@ def parser(self) -> ArgumentParser:
5756
)
5857
return my_parser
5958

60-
def parse_args(self, argv: List[str]) -> None:
59+
def parse_args(self, argv: list[str]) -> None:
6160
# The base class saves the parsed arguments as `self.args`.
6261
super().parse_args(argv)
6362

@@ -70,7 +69,7 @@ def parse_args(self, argv: List[str]) -> None:
7069
# not.
7170
self.args.some_file = self.args.some_file.resolve()
7271

73-
def main(self, argv: List[str]) -> None:
72+
def main(self, argv: list[str]) -> None:
7473
self.parse_args(argv)
7574
try:
7675
self.say_hello()

example/ex_4_customizing_stage_behavior.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import sys
1313
from argparse import ArgumentParser
1414
from pathlib import Path
15-
from typing import List
1615

1716
from staged_script import StagedScript
1817

@@ -57,7 +56,7 @@ def parser(self) -> ArgumentParser:
5756
)
5857
return my_parser
5958

60-
def parse_args(self, argv: List[str]) -> None:
59+
def parse_args(self, argv: list[str]) -> None:
6160
# The base class saves the parsed arguments as `self.args`.
6261
super().parse_args(argv)
6362

@@ -93,7 +92,7 @@ def _run_post_stage_actions(self) -> None:
9392
"Checking to make sure all is well after running the stage..."
9493
)
9594

96-
def main(self, argv: List[str]) -> None:
95+
def main(self, argv: list[str]) -> None:
9796
self.parse_args(argv)
9897
try:
9998
self.say_hello()

example/ex_5_customizing_individual_stages.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import sys
1313
from argparse import ArgumentParser
1414
from pathlib import Path
15-
from typing import List
1615

1716
from staged_script import StagedScript
1817

@@ -57,7 +56,7 @@ def parser(self) -> ArgumentParser:
5756
)
5857
return my_parser
5958

60-
def parse_args(self, argv: List[str]) -> None:
59+
def parse_args(self, argv: list[str]) -> None:
6160
# The base class saves the parsed arguments as `self.args`.
6261
super().parse_args(argv)
6362

@@ -112,7 +111,7 @@ def _end_stage_goodbye(self) -> None:
112111
# or `super()` calls to the default method for the corresponding
113112
# phase, if you like.
114113

115-
def main(self, argv: List[str]) -> None:
114+
def main(self, argv: list[str]) -> None:
116115
self.parse_args(argv)
117116
try:
118117
self.say_hello()

example/ex_6_creating_retryable_stages.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
import sys
1313
from argparse import ArgumentParser
1414
from pathlib import Path
15-
from typing import List, Optional, Set
15+
from typing import Optional
1616

1717
from staged_script import RetryStage, StagedScript
1818

1919

2020
class MyScript(StagedScript):
2121
def __init__(
2222
self,
23-
stages: Set[str],
23+
stages: set[str],
2424
*,
2525
console_force_terminal: Optional[bool] = None,
2626
console_log_path: bool = True,
@@ -86,7 +86,7 @@ def parser(self) -> ArgumentParser:
8686
)
8787
return my_parser
8888

89-
def parse_args(self, argv: List[str]) -> None:
89+
def parse_args(self, argv: list[str]) -> None:
9090
# The base class saves the parsed arguments as `self.args`.
9191
super().parse_args(argv)
9292

@@ -141,7 +141,7 @@ def _end_stage_goodbye(self) -> None:
141141
# or `super()` calls to the default method for the corresponding
142142
# phase, if you like.
143143

144-
def main(self, argv: List[str]) -> None:
144+
def main(self, argv: list[str]) -> None:
145145
self.parse_args(argv)
146146
try:
147147
self.say_hello()

example/ex_7_customizing_the_summary.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
import sys
1515
from argparse import ArgumentParser
1616
from pathlib import Path
17-
from typing import Dict, List, Optional, Set
17+
from typing import Optional
1818

1919
from staged_script import RetryStage, StagedScript
2020

2121

2222
class MyScript(StagedScript):
2323
def __init__(
2424
self,
25-
stages: Set[str],
25+
stages: set[str],
2626
*,
2727
console_force_terminal: Optional[bool] = None,
2828
console_log_path: bool = True,
@@ -88,7 +88,7 @@ def parser(self) -> ArgumentParser:
8888
)
8989
return my_parser
9090

91-
def parse_args(self, argv: List[str]) -> None:
91+
def parse_args(self, argv: list[str]) -> None:
9292
# The base class saves the parsed arguments as `self.args`.
9393
super().parse_args(argv)
9494

@@ -145,7 +145,7 @@ def _end_stage_goodbye(self) -> None:
145145

146146
def print_script_execution_summary(
147147
self,
148-
extra_sections: Optional[Dict[str, str]] = None,
148+
extra_sections: Optional[dict[str, str]] = None,
149149
) -> None:
150150
extras = {
151151
"Machine details": (
@@ -154,10 +154,10 @@ def print_script_execution_summary(
154154
),
155155
}
156156
if extra_sections is not None:
157-
extras.update(extra_sections)
157+
extras |= extra_sections
158158
super().print_script_execution_summary(extra_sections=extras)
159159

160-
def main(self, argv: List[str]) -> None:
160+
def main(self, argv: list[str]) -> None:
161161
self.parse_args(argv)
162162
try:
163163
self.say_hello()

example/test_examples.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99

1010
import subprocess
1111
from pathlib import Path
12-
from typing import List
1312

1413

15-
def assert_output_in_order(stdout: str, output: List[str]) -> None:
14+
def assert_output_in_order(stdout: str, output: list[str]) -> None:
1615
"""
1716
Ensure the output appears in the correct order.
1817

pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ classifiers = [
3939
"Operating System :: OS Independent",
4040
"Programming Language :: Python :: 3",
4141
"Programming Language :: Python :: 3 :: Only",
42-
"Programming Language :: Python :: 3.8",
4342
"Programming Language :: Python :: 3.9",
4443
"Programming Language :: Python :: 3.10",
4544
"Programming Language :: Python :: 3.11",

0 commit comments

Comments
 (0)