Skip to content

Commit 65bf036

Browse files
committed
Add --version option and prepare for 2.0.4
1 parent 09bc2e9 commit 65bf036

File tree

2 files changed

+43
-26
lines changed

2 files changed

+43
-26
lines changed

docs/changelog.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
(nothing yet)
10+
(Nothing yet.)
11+
12+
13+
## [2.0.4] - 2025-01-28 {: #v2.0.4 }
14+
15+
This release fixes very minor issues. It is mainly for testing release automation.
16+
17+
### Fixed
18+
19+
- Use `importlib.metadata` instead of `_version.py` to get the version number.
20+
- Add `--version` option to `stepup` command.
21+
- Improve screen output consistency.
22+
1123

1224
## [2.0.3] - 2025-01-27 {: #v2.0.3 }
1325

@@ -328,6 +340,7 @@ Initial release
328340

329341

330342
[Unreleased]: https://github.com/reproducible-reporting/stepup-core
343+
[2.0.4]: https://github.com/reproducible-reporting/stepup-core/releases/tag/v2.0.4
331344
[2.0.3]: https://github.com/reproducible-reporting/stepup-core/releases/tag/v2.0.3
332345
[2.0.2]: https://github.com/reproducible-reporting/stepup-core/releases/tag/v2.0.2
333346
[2.0.1]: https://github.com/reproducible-reporting/stepup-core/releases/tag/v2.0.1

stepup/core/tui.py

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import termios
3030
import threading
3131
from decimal import Decimal
32+
from importlib.metadata import version as get_version
3233

3334
import attrs
3435
from path import Path
@@ -237,15 +238,24 @@ async def keyboard(
237238

238239
def parse_args():
239240
"""Parse command-line arguments."""
241+
version = get_version("stepup")
240242
parser = argparse.ArgumentParser(prog="stepup", description="The StepUp build tool")
241243
parser.add_argument(
242244
"plan_py", type=Path, default=Path("plan.py"), help="Top-level build script", nargs="?"
243245
)
244246
parser.add_argument(
245-
"--root",
246-
type=Path,
247-
default=Path(os.getenv("STEPUP_ROOT", os.getcwd())),
248-
help="Directory containing top-level plan.py [default=%(default)s]",
247+
"--explain-rerun",
248+
"-e",
249+
default=False,
250+
action="store_true",
251+
help="Explain for every step with recording info why it cannot be skipped.",
252+
)
253+
parser.add_argument(
254+
"--log-level",
255+
"-l",
256+
default="WARNING",
257+
choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
258+
help="Set the logging level. [default=%(default)s]",
249259
)
250260
parser.add_argument(
251261
"--num-workers",
@@ -256,20 +266,27 @@ def parse_args():
256266
"When given as a real number with digits after the comma, "
257267
"it is multiplied with the number of available cores. [default=%(default)s]",
258268
)
269+
parser.add_argument(
270+
"--perf",
271+
default=None,
272+
nargs="?",
273+
const=500,
274+
help="Run the director under perf record, by default at a frequency of 500 Hz.",
275+
)
276+
parser.add_argument(
277+
"--root",
278+
type=Path,
279+
default=Path(os.getenv("STEPUP_ROOT", os.getcwd())),
280+
help="Directory containing top-level plan.py [default=%(default)s]",
281+
)
259282
parser.add_argument(
260283
"--show-perf",
261284
"-s",
262285
default=0,
263286
action="count",
264287
help="Show the performance info on each line. Repeat for more detailed info.",
265288
)
266-
parser.add_argument(
267-
"--explain-rerun",
268-
"-e",
269-
default=False,
270-
action="store_true",
271-
help="Explain for every step with recording info why it cannot be skipped.",
272-
)
289+
parser.add_argument("--version", "-V", action="version", version="%(prog)s " + version)
273290
parser.add_argument(
274291
"--watch",
275292
"-w",
@@ -287,20 +304,7 @@ def parse_args():
287304
help="Start the runner after observing the first file change in watch mode. "
288305
"This implies --watch. (Only supported on Linux.)",
289306
)
290-
parser.add_argument(
291-
"--perf",
292-
default=None,
293-
nargs="?",
294-
const=500,
295-
help="Run the director under perf record, by default at a frequency of 500 Hz.",
296-
)
297-
parser.add_argument(
298-
"--log-level",
299-
"-l",
300-
default="WARNING",
301-
choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
302-
help="Set the logging level. [default=%(default)s]",
303-
)
307+
304308
args = parser.parse_args()
305309
if args.watch_first:
306310
args.watch = True

0 commit comments

Comments
 (0)