RAGents Frontend
A Python package that bundles the RAGents Next.js frontend for easy integration into Python applications.
Installation
Using uv (recommended)
uv pip install -e .
Using pip
pip install -e .
Usage
As a Python Module
from ragents_frontend import get_frontend_path, FRONTEND_DIR
from ragents_frontend.server import create_app, serve
# Get the frontend directory path
frontend_path = get_frontend_path()
print(f"Frontend is located at: {frontend_path}")
# Create a FastAPI app with the frontend
app = create_app()
# Or serve directly
serve(host="0.0.0.0", port=3000)
As a CLI Tool
# Run the frontend server
python -m ragents_frontend
# With custom options
python -m ragents_frontend --host 127.0.0.1 --port 8080
# With auto-reload for development
python -m ragents_frontend --reload
# With a custom frontend directory
python -m ragents_frontend --frontend-dir /path/to/frontend
Integration with Existing FastAPI Apps
from fastapi import FastAPI
from ragents_frontend.server import create_app
# Your existing FastAPI app
main_app = FastAPI()
# Mount the frontend
frontend_app = create_app()
main_app.mount("/", frontend_app)
# Your API routes
@main_app.get("/api/data")
def get_data():
return {"message": "Hello from API"}
Development
Prerequisites
- Python 3.9+
- Node.js 18+ (for building the frontend)
- uv (recommended) or pip
Building the Package
- Build the Next.js frontend first:
cd ../ragents-frontend
npm install
npm run build
- Build the Python package:
cd ragents_frontend
uv build
Development Installation
uv pip install -e ".[dev]"
Running Tests
pytest
Package Structure
ragents_frontend/
├── src/
│ └── ragents_frontend/
│ ├── __init__.py # Package entry point
│ ├── __main__.py # CLI entry point
│ ├── server.py # FastAPI server implementation
│ ├── frontend/ # Bundled Next.js frontend
│ └── frontend_lib/ # Frontend library code
├── pyproject.toml # Package configuration
└── README.md # This file
License
MIT License
Author
Mehran Moazeni (mehran1414@gmail.com)
Metadata
Release files for ragents-frontend 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ragents_frontend-0.1.0.tar.gz | 27.6 MB | Without provenance | Details for ragents_frontend-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ragents_frontend-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for ragents_frontend-0.1.0-py3-none-any.whl |
Total release size: 55.2 MB
Release files / ragents_frontend-0.1.0.tar.gz
| Download URL | ragents_frontend-0.1.0.tar.gz |
|---|---|
| Size | 27.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5a0714b2b826b67856675f2d55e5290a0f3be05025624cc4c9d98d964786587f
|
|
BLAKE2b-256 checksum How to use checksums |
77e987d0e1c66d39940661bdbe02040572ecfc56d1a2873d90437c624d889419
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.6
|
Release files / ragents_frontend-0.1.0-py3-none-any.whl
| Download URL | ragents_frontend-0.1.0-py3-none-any.whl |
|---|---|
| Size | 27.6 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2ac6a31754761ad452ac28f884b0fbaf120533dc104ee218fbb8c2aacab706f3
|
|
BLAKE2b-256 checksum How to use checksums |
10ba77d37620666643c49d4dd3746ccc9ad7370438dee486e8c0c868945d5c0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.6
|
Security for ragents-frontend 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.