-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
265 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 0 additions & 61 deletions
61
packages/service-integration/src/service_integration/cli.py
This file was deleted.
Oops, something went wrong.
72 changes: 72 additions & 0 deletions
72
packages/service-integration/src/service_integration/cli/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Allows entrypoint via python -m as well | ||
|
||
from typing import Annotated | ||
|
||
import rich | ||
import typer | ||
|
||
from .._meta import __version__ | ||
from ..settings import AppSettings | ||
from . import _compose_spec, _metadata, _run_creator, _test | ||
from ._config import config_app | ||
|
||
app = typer.Typer() | ||
|
||
|
||
def _version_callback(value: bool): # noqa: FBT002 | ||
if value: | ||
rich.print(__version__) | ||
raise typer.Exit | ||
|
||
|
||
@app.callback() | ||
def main( | ||
ctx: typer.Context, | ||
registry_name: Annotated[ | ||
str, | ||
typer.Option( | ||
"--REGISTRY_NAME", | ||
help="image registry name. Full url or prefix used as prefix in an image name", | ||
), | ||
] = None, | ||
compose_version: Annotated[ | ||
str, | ||
typer.Option( | ||
"--COMPOSE_VERSION", | ||
help="version used for docker compose specification", | ||
), | ||
] = None, | ||
version: Annotated[ # noqa: FBT002 | ||
bool, | ||
typer.Option( | ||
"--version", | ||
callback=_version_callback, | ||
is_eager=True, | ||
), | ||
] = False, | ||
): | ||
"""o2s2parc service Integration Library (OOIL in short)""" | ||
assert isinstance(version, bool | None) # nosec | ||
|
||
overrides = {} | ||
if registry_name: | ||
overrides["REGISTRY_NAME"] = registry_name | ||
|
||
if compose_version: | ||
overrides["COMPOSE_VERSION"] = compose_version | ||
|
||
# save states | ||
ctx.settings = AppSettings.parse_obj(overrides) | ||
|
||
|
||
# | ||
# REGISTER commands and/or sub-apps | ||
# | ||
|
||
app.command("compose")(_compose_spec.create_compose) | ||
app.add_typer(config_app, name="config", help="Manage osparc config files") | ||
app.command("test")(_test.run_tests) | ||
# legacy | ||
app.command("bump-version")(_metadata.bump_version) | ||
app.command("get-version")(_metadata.get_version) | ||
app.command("run-creator")(_run_creator.run_creator) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.