FinAnalyzer backend (OpenBB App)
Project description
# traditional way to start the API directly
openbb-api --app main.py --exclude '"/api/v1/*"' --reload
openbb-api --app main.py --reload
openbb-api --app src/openbb_app/main.py --reload
using uvx
When openbb-api is executed, the health check endpoint will be available at http://0.0.0.0:6900/health.
uv run openbb-api --app src/openbb_app/main.py
Start the virtual environment and run the following command to start the API:
uvicorn openbb_app.main:app
Using Docker
Prerequisites
- Docker installed
- Docker Compose installed
Quick Start
# Build the Docker image
docker build -t openbb-app .
# Start the service (detached mode)
docker compose up -d
# View logs
docker compose logs -f
# Stop the service
docker compose down
Accessing the Application
Once the container is running, access the API at:
- API: http://localhost:8001/api/docs
- Health Check: http://localhost:8001/api/openapi.json
Environment Configuration
Create a .env file in the project root with your API keys:
TUSHARE_API_KEY=your_tushare_api_key
AGENT_HOST_URL=your_agent_host_url
APP_API_KEY=your_app_api_key
OPENROUTER_API_KEY=your_openrouter_api_key
Development with Live Reload
The Docker setup supports live code reloading. Changes to source files on your host machine will be reflected immediately without rebuilding the image, as long as the volume mount is active.
Container Security
The container runs as a non-root user (appuser) for enhanced security. The application listens on port 8001 inside the container, which is mapped to the same port on the host.
Using TestPyPI
1. Configure uv for TestPyPI
You can either pass the URL every time or add it to your pyproject.toml so uv knows where to find it. I recommend adding it to your config:
Add this to your pyproject.toml:
Ini, TOML
[[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
publish-url = "https://test.pypi.org/legacy/"
explicit = true
2. Build and Publish
Now, build your project and tell uv to send it to the testpypi index you just defined.
Bash
# Clear old builds first
rm -rf dist/
# Build the distribution
uv build
# Publish to TestPyPI
# You'll be prompted for a token (username: __token__)
uv publish --index testpypi
3. The "Moment of Truth": Testing with uvx
This is the most important step. You want to see if a user can run your app using uvx by pulling it from TestPyPI.
Since TestPyPI often doesn't have all the dependencies (like openbb or fastapi), you have to tell uv to look at both TestPyPI (for your app) and the real PyPI (for the dependencies).
Run this command from a different folder:
Bash
uvx --index https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ openbb-app
What to check:
-
Does the server start? If it boots to
http://0.0.0.0:8000, your entry point is correct. -
Are images/README missing? Check the project page on
test.pypi.orgto see if your descriptions rendered correctly.
4. Cleaning Up for the "Real" Launch
Once you are happy with how it looks on TestPyPI:
-
Change the Version: Increment the version in
pyproject.toml(e.g.,0.1.0->0.1.1). -
Publish for real: ```bash
uv build
uv publish # This defaults to the real PyPI
Project details
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 openbb_app-1.5.7.tar.gz.
File metadata
- Download URL: openbb_app-1.5.7.tar.gz
- Upload date:
- Size: 268.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6ae7b0edc064016a3023e8909799f3a469c680a5b64c218a2728c39d0da9eed
|
|
| MD5 |
b29416472fc396b1ad019a57a145730a
|
|
| BLAKE2b-256 |
e1bffad4f35641d1cb1837330bb06334bb85cd0000a07c6ba8c2681a7374125a
|
File details
Details for the file openbb_app-1.5.7-py3-none-any.whl.
File metadata
- Download URL: openbb_app-1.5.7-py3-none-any.whl
- Upload date:
- Size: 281.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fad4234ab5fc59caa69b68aa6b6e7f02fafa2114ac84b71aac87bdddc218f9b8
|
|
| MD5 |
fbacc8a1973477c4651e0fe99e5ae33f
|
|
| BLAKE2b-256 |
a226a10a319c74fdedfe98fb5adb6d070f5b08288503a770f27ef54dba50b8b7
|