fix: package and package data setup and added typer

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-03-05 13:22:02 +00:00
commit 7224ed0761
3 changed files with 12 additions and 10 deletions

0
langflow/__init__.py Normal file
View file

View file

@ -1,4 +1,4 @@
from fastapi import FastAPI import typer
from fastapi.staticfiles import StaticFiles from fastapi.staticfiles import StaticFiles
from pathlib import Path from pathlib import Path
@ -8,7 +8,6 @@ from langflow.backend.app import create_app
path = Path(__file__).parent path = Path(__file__).parent
static_files_dir = path / "frontend/build" static_files_dir = path / "frontend/build"
app = create_app() app = create_app()
app.mount( app.mount(
"/", "/",
StaticFiles(directory=static_files_dir, html=True), StaticFiles(directory=static_files_dir, html=True),
@ -16,10 +15,14 @@ app.mount(
) )
def main(): def serve(port: int = 5003):
import uvicorn import uvicorn
uvicorn.run(app, host="localhost", port=80) uvicorn.run(app, host="localhost", port=port)
def main():
typer.run(serve)
if __name__ == "__main__": if __name__ == "__main__":

View file

@ -4,12 +4,10 @@ version = "0.0.1"
description = "A Python package with a built-in web application" description = "A Python package with a built-in web application"
authors = ["Ibis Prevedello <ibiscp@gmail.com>"] authors = ["Ibis Prevedello <ibiscp@gmail.com>"]
packages = [ packages = [
{ include = "langflow/cli.py" }, { include = "langflow"},
# { include = "langflow/backend/*.py" }
] ]
include = [{path= "langflow/frontend/build/*", format=["sdist", "wheel"]}, include = ["langflow/frontend/build/*", "langflow/frontend/build/**/*"]
{path= "langflow/frontend/build/static/js/*", format=["sdist", "wheel"]}, exclude = ["langflow/frontend/node_modules/*", "langflow/frontend/src/*"]
{path= "langflow/frontend/build/static/css/*", format=["sdist", "wheel"]}]
[tool.poetry.scripts] [tool.poetry.scripts]
langflow = "langflow.cli:main" langflow = "langflow.cli:main"
@ -26,4 +24,5 @@ uvicorn = "^0.20.0"
# beautifulsoup4 = "^4.11.2" # beautifulsoup4 = "^4.11.2"
# google-search-results = "^2.4.1" # google-search-results = "^2.4.1"
# google-api-python-client = "^2.79.0" # google-api-python-client = "^2.79.0"
# langchain = {git = "https://github.com/ibiscp/langchain.git", rev = "ibis"} langchain = {git = "https://github.com/ibiscp/langchain.git", rev = "ibis"}
typer = "^0.7.0"