From 7224ed076143bd5910ea78cc65fe4301af0c49d4 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Sun, 5 Mar 2023 13:22:02 +0000 Subject: [PATCH] fix: package and package data setup and added typer --- langflow/__init__.py | 0 langflow/cli.py | 11 +++++++---- pyproject.toml | 11 +++++------ 3 files changed, 12 insertions(+), 10 deletions(-) create mode 100644 langflow/__init__.py diff --git a/langflow/__init__.py b/langflow/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/langflow/cli.py b/langflow/cli.py index 4cdc9445e..5837bd111 100644 --- a/langflow/cli.py +++ b/langflow/cli.py @@ -1,4 +1,4 @@ -from fastapi import FastAPI +import typer from fastapi.staticfiles import StaticFiles from pathlib import Path @@ -8,7 +8,6 @@ from langflow.backend.app import create_app path = Path(__file__).parent static_files_dir = path / "frontend/build" app = create_app() - app.mount( "/", StaticFiles(directory=static_files_dir, html=True), @@ -16,10 +15,14 @@ app.mount( ) -def main(): +def serve(port: int = 5003): import uvicorn - uvicorn.run(app, host="localhost", port=80) + uvicorn.run(app, host="localhost", port=port) + + +def main(): + typer.run(serve) if __name__ == "__main__": diff --git a/pyproject.toml b/pyproject.toml index 71df37246..4cd58d19f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,12 +4,10 @@ version = "0.0.1" description = "A Python package with a built-in web application" authors = ["Ibis Prevedello "] packages = [ - { include = "langflow/cli.py" }, - # { include = "langflow/backend/*.py" } + { include = "langflow"}, ] -include = [{path= "langflow/frontend/build/*", format=["sdist", "wheel"]}, - {path= "langflow/frontend/build/static/js/*", format=["sdist", "wheel"]}, - {path= "langflow/frontend/build/static/css/*", format=["sdist", "wheel"]}] +include = ["langflow/frontend/build/*", "langflow/frontend/build/**/*"] +exclude = ["langflow/frontend/node_modules/*", "langflow/frontend/src/*"] [tool.poetry.scripts] langflow = "langflow.cli:main" @@ -26,4 +24,5 @@ uvicorn = "^0.20.0" # beautifulsoup4 = "^4.11.2" # google-search-results = "^2.4.1" # google-api-python-client = "^2.79.0" -# langchain = {git = "https://github.com/ibiscp/langchain.git", rev = "ibis"} \ No newline at end of file +langchain = {git = "https://github.com/ibiscp/langchain.git", rev = "ibis"} +typer = "^0.7.0" \ No newline at end of file