Coverage for external_dependencies/cli.py: 61%
18 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-10-02 11:23 +0200
« prev ^ index » next coverage.py v7.6.1, created at 2024-10-02 11:23 +0200
1from typing import Annotated, Optional
3import typer
5from .utils import _filter_external_dependencies, _install_apt, _install_s3, _list_external_dependencies
7app = typer.Typer(rich_markup_mode='rich')
9DEFAULT_BUCKET = 'skcr-public-static-build'
10DEFAUT_INSTALL_DIR = '/usr/local/bin/'
13@app.command(name='apt')
14def install_using_apt(
15 prefix: Annotated[Optional[str], typer.Option(help='Filter out some external dependencies')] = 'pkg:generic/',
16) -> None:
17 """Install the required external dependencies using apt."""
18 deps = _list_external_dependencies()
19 filtered = _filter_external_dependencies(deps, prefix)
20 _install_apt(filtered)
23@app.command(name='s3')
24def install_using_s3(
25 prefix: Annotated[Optional[str], typer.Option(help='Filter out some external dependencies')] = 'pkg:generic/',
26 bucket: Annotated[str, typer.Option(help='The s3 bucket to download the dependencies from')] = DEFAULT_BUCKET,
27 install_dir: Annotated[str, typer.Option(help='The directory to install the dependencies to')] = DEFAUT_INSTALL_DIR,
28) -> None:
29 """Install the required external dependencies using static builds from an s3 bucket."""
30 deps = _list_external_dependencies()
31 filtered = _filter_external_dependencies(deps, prefix)
32 _install_s3(filtered, bucket, install_dir)
35if __name__ == '__main__':
36 app()