Skip to content

Commit

Permalink
cli support and pip install via typer
Browse files Browse the repository at this point in the history
  • Loading branch information
victordibia committed Oct 6, 2023
1 parent f67bb4c commit 4aa0d62
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 0 deletions.
40 changes: 40 additions & 0 deletions autogenui/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import typer
import uvicorn
import os
from typing_extensions import Annotated

app = typer.Typer()


@app.command()
def main(host: str = "127.0.0.1",
port: int = 8081,
workers: int = 1,
reload: Annotated[bool, typer.Option("--reload")] = True,
docs: bool = False):
"""
Launch the Autogen UI CLI .Pass in parameters host, port, workers, and reload to override the default values.
"""

os.environ["AUTOGENUI_API_DOCS"] = str(docs)

uvicorn.run(
"autogenui.web.app:app",
host=host,
port=port,
workers=workers,
reload=reload,
)


@app.command()
def models():
print("A list of supported providers:")


def run():
app()


if __name__ == "__main__":
app()
58 changes: 58 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[project]
name = "autogenui"
authors = [
{ name="Victor Dibia", email="[email protected]" },
]
description = "autogen ui: a ui interface for the autogen library "
readme = "README.md"
license = { file="LICENSE" }
requires-python = ">=3.9"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]


dependencies = [
"pydantic",
"fastapi",
"uvicorn",
]
optional-dependencies = {web = ["fastapi", "uvicorn"]}

dynamic = ["version"]

[tool.setuptools]
include-package-data = true


[tool.setuptools.dynamic]
version = {attr = "autogenui.version.VERSION"}
readme = {file = ["README.md"]}

[tool.setuptools.packages.find]
include = ["autogenui*"]
exclude = ["*.tests*"]
namespaces = false

[tool.setuptools.package-data]
"autogenui" = ["*.*"]

[tool.pytest.ini_options]
filterwarnings = [
"ignore:Deprecated call to `pkg_resources\\.declare_namespace\\('.*'\\):DeprecationWarning",
"ignore::DeprecationWarning:google.rpc",
]


[project.urls]
"Homepage" = "https://github.com/victordibia/autogenui"
"Bug Tracker" = "https://github.com/victordibia/autogenui/issues"

[project.scripts]
autogenui = "autogenui.cli:run"

0 comments on commit 4aa0d62

Please sign in to comment.