Skip to content

Commit

Permalink
feat: Add skeleton for the "installer" package
Browse files Browse the repository at this point in the history
  • Loading branch information
achimnol committed Nov 6, 2023
1 parent 79ef241 commit 46bfe44
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 0 deletions.
61 changes: 61 additions & 0 deletions src/ai/backend/install/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
python_sources(
name="src",
dependencies=[
":resources",
],
)

visibility_private_component(
allowed_dependents=[],
allowed_dependencies=[
"//src/ai/backend/cli/**",
"//src/ai/backend/common/**",
]
)

python_distribution(
name="dist",
dependencies=[
":src",
"!!stubs/trafaret:stubs",
],
provides=python_artifact(
name="backend.ai-install",
description="Backend.AI Installer",
license="MIT",
),
entry_points={
"backendai_cli_v10": {
"install": "ai.backend.install.cli:main",
},
},
generate_setup=True,
tags=["wheel"],
)

pex_binary(
name="pex",
entry_point="ai.backend.cli.__main__",
dependencies=[
":src",
":buildscript",
"!!stubs/trafaret:stubs",
],
)

scie_binary(
name="backendai-install",
dependencies=[":pex"],
)

resource(name="version", source="VERSION")
resource(name="buildscript", source="BUILD")
resources(
name="resources",
dependencies=[
":version",
],
sources=[
"**/py.typed",
],
)
7 changes: 7 additions & 0 deletions src/ai/backend/install/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Backend.AI Plugin Subsystem
===========================

Package Structure
-----------------

* `ai.backend.plugin`: Abstract types for plugins and a common base plugin set
1 change: 1 addition & 0 deletions src/ai/backend/install/VERSION
3 changes: 3 additions & 0 deletions src/ai/backend/install/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from pathlib import Path

__version__ = (Path(__file__).parent / "VERSION").read_text().strip()
26 changes: 26 additions & 0 deletions src/ai/backend/install/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import click

from ai.backend.install import __version__

from .types import InstallModes


@click.command(
context_settings={
"help_option_names": ["-h", "--help"],
},
)
@click.option(
"--mode",
type=click.Choice(InstallModes._member_names_, case_sensitive=False),
default=None,
help="Override the installation mode. [default: auto-detect]",
)
@click.version_option(version=__version__)
@click.pass_context
def main(
ctx: click.Context,
mode: InstallModes | None,
) -> None:
"""The installer"""
print(f"installer main: {mode}")
Empty file added src/ai/backend/install/py.typed
Empty file.
6 changes: 6 additions & 0 deletions src/ai/backend/install/types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import enum


class InstallModes(enum.StrEnum):
DEV = "dev"
PACKAGE = "pkg"

0 comments on commit 46bfe44

Please sign in to comment.