A FastAPI application serving ws bom/robot/llm platform ai.
Project description
🤖 ws-bom-robot-app
A FastAPI application serving ws bom/robot/llm platform ai
🌵 Minimal app structure
app/
|-- .env
|-- main.py
Fill main.py with the following code:
from ws_bom_robot_app import main
app = main.app
FIll .env with the following code:
#robot_env=local/development/production
robot_env=local
robot_user='[user]'
robot_password='[pwd]'
robot_data_folder='./.data'
robot_cms_auth='[auth]'
robot_cms_host='https://[DOMAIN]'
robot_cms_db_folder=llmVectorDb
robot_cms_files_folder=llmKbFile
🚀 Run the app
-
development
fastapi dev --port 6001 #uvicorn main:app --app-dir ./ws_bom_robot_app --reload --host 0.0.0.0 --port 6001
-
production
uvicorn main:app --host 0.0.0.0 --port 6001
-
production with multipler workers
fastapi run --port 6001 --workers 4 #uvicorn main:app --host 0.0.0.0 --port 6001 --workers 4 #gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app --bind
🔖 Windows requirements
libmagic (mandatory)
py -m pip install --upgrade python-magic-bin
tesseract-ocr (mandatory)
Install tesseract Last win-64 release
Add tesseract executable (C:\Program Files\Tesseract-OCR) to system PATH
$pathToAdd = "C:\Program Files\Tesseract-OCR"; `
$currentPath = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine); `
if ($currentPath -split ';' -notcontains $pathToAdd) { `
[System.Environment]::SetEnvironmentVariable("Path", "$currentPath;$pathToAdd", [System.EnvironmentVariableTarget]::Machine) `
}
libreoffice (optional: for robot_env set to development/production)
Install libreoffice Last win-64 release
Add libreoffice executable (C:\Program Files\LibreOffice\program) to system PATH
$pathToAdd = "C:\Program Files\LibreOffice\program"; `
$currentPath = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine); `
if ($currentPath -split ';' -notcontains $pathToAdd) { `
[System.Environment]::SetEnvironmentVariable("Path", "$currentPath;$pathToAdd", [System.EnvironmentVariableTarget]::Machine) `
}
poppler (optional: for robot_env set to development/production)
Download win poppler release Extract the zip, copy the nested folder "poppler-x.x.x." to a program folder (e.g. C:\Program Files\poppler-24.08.0) Add poppler executable (C:\Program Files\poppler-24.08.0\Library\bin) to system PATH
$pathToAdd = "C:\Program Files\poppler-24.08.0\Library\bin"; `
$currentPath = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine); `
if ($currentPath -split ';' -notcontains $pathToAdd) { `
[System.Environment]::SetEnvironmentVariable("Path", "$currentPath;$pathToAdd", [System.EnvironmentVariableTarget]::Machine) `
}
👷 Contributors
Build/distribute pkg from websolutespa bom [Github]
dir in
robotproject folder
cd ./src/robot
🔖 requirements
py -m pip install --upgrade setuptools build twine streamlit
🪛 build
if (Test-Path ./dist) {rm ./dist -r -force}; `
cp .\requirements.txt .\ws_bom_robot_app\ && `
py -m build && `
twine check dist/*
📦 test / 🧪 debugger
Install the package in editable project location
py -m pip install --upgrade -e .
py -m pip show ws-bom-robot-app
code quality tools
# .\src\robot
!py -m pip install -U scanreq prospector[with_everything]
## unused requirements
scanreq -r requirements.txt -p ./ws_bom_robot_app
## style/linting
prospector ./ws_bom_robot_app -t pylint -t pydocstyle
## code quality/complexity
prospector ./ws_bom_robot_app -t vulture -t mccabe -t mypy
## security
prospector ./ws_bom_robot_app -t dodgy -t bandit
## package
prospector ./ws_bom_robot_app -t pyroma
lauch pytest
!py -m pip install -U pytest pytest-asyncio pytest-mock pytest-cov
pytest --cov=ws_bom_robot_app --log-cli-level=info
launch debugger
streamlit run debugger.py --server.port 6002
✈️ publish
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ws_bom_robot_app-0.0.21.tar.gz.
File metadata
- Download URL: ws_bom_robot_app-0.0.21.tar.gz
- Upload date:
- Size: 38.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c204cc2b8068e24c32ccc5c33a8957d5b2197c5effc9a681058ebad76f4c4cce
|
|
| MD5 |
6a87623f76d4377ceecd9fae3422028d
|
|
| BLAKE2b-256 |
f9fb97843cf769e8ae585716b035dca4d554aa77b7d6e63099909e0bbaa1271d
|
File details
Details for the file ws_bom_robot_app-0.0.21-py3-none-any.whl.
File metadata
- Download URL: ws_bom_robot_app-0.0.21-py3-none-any.whl
- Upload date:
- Size: 48.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a33d9730eae08661b1930acace4bb0a73745bc3693bc9a18941e389a4320e42
|
|
| MD5 |
f535f0fd09469686da834777921a7d31
|
|
| BLAKE2b-256 |
6711d219319000c62b69c71a3b0a4ae481fa4d2890a9cbe093d2aa7b774cd787
|