Skip to content

Commit

Permalink
feat: add cli argument to display runner version (#21)
Browse files Browse the repository at this point in the history
Closes #19

### Summary of Changes

- display version fetched from metadata for --version and -V args (using
importlib.metadata.version)

---------

Co-authored-by: megalinter-bot <129584137+megalinter-bot@users.noreply.github.com>
  • Loading branch information
WinPlay02 and megalinter-bot authored Dec 4, 2023
1 parent 7120cb5 commit 3917c5f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/safeds_runner/server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import argparse
import json
import logging
from importlib.metadata import version

import flask.app
import flask_sock
Expand Down Expand Up @@ -178,6 +179,12 @@ def main() -> None: # pragma: no cover

parser = argparse.ArgumentParser(description="Start Safe-DS Runner on a specific port.")
parser.add_argument("--port", type=int, default=5000, help="Port on which to run the python server.")
parser.add_argument(
"-V",
"--version",
action="version",
version="%(prog)s {version}".format(version=version("safe-ds-runner")),
)
args = parser.parse_args()
logging.info("Starting Safe-DS Runner on port %s", str(args.port))
# Only bind to host=127.0.0.1. Connections from other devices should not be accepted
Expand Down

0 comments on commit 3917c5f

Please sign in to comment.