Skip to content

davialabs/davia

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Davia Banner

The easiest way to build apps from your Python code

PyPI versions license

Davia empowers Python developers to transform their applications, especially AI agents and data-driven internal tools, into interactive web applications with minimal effort. Say goodbye to frontend complexities and hello to rapid development and deployment. With Davia, you define your logic in Python, and Davia generates the user interface, handles real-time updates, and manages the backend.

  • ✨ Create complete apps in minutes, not weeks.
  • ✨ Focus on your Python logic; Davia handles the UI.
  • ✨ Real-time streaming and output updates, out-of-the-box.
  • ✨ Visually design your app without writing frontend code.
  • ✨ Works with any Python application, including LangGraph agents.

🔧 FastAPI Integration

Think Lovable but wired straight into your Python backend, with a dev mode made for Python folks like us. Davia is built on top of FastAPI and works perfectly with it. All FastAPI best practices you're familiar with remain applicable when using Davia. You can seamlessly add Davia-specific functionality to your existing FastAPI applications or extend your Davia apps with custom FastAPI endpoints.

🚀 Quickstart

Get started in minutes by following our Quickstart Guide.

📚 Documentation

For detailed information, visit our Documentation.

Installation

pip install davia

For LangGraph specific features (requires Python 3.11 or higher), install the optional dependencies:

pip install davia langgraph "langgraph-api==0.0.38"

Usage

Davia helps you run your Python applications with an automatically generated UI.

Running a Davia App

Let's say you have a Python file my_app.py with a Davia application instance named app:

# my_app.py
from davia import Davia

app = Davia()

# Define your tasks and AI agents here
# For example:
@app.task
def my_python_function(name: str) -> str:
  return f"Hello, {name}!"

You can run this application using the Davia CLI:

davia run my_app.py

This command will start a local server, and Davia will typically open a browser window pointing to the application's UI, often hosted on a development dashboard like https://davia.ai/dashboard.

Best Practices for Function Declarations

When working with Davia, it's recommended to explicitly declare input and output types for your functions as well as providing a clear docstring. This practice not only improves code clarity but also ensures smooth integration with the TypeScript frontend that Davia generates. Here's an example:

from pydantic import BaseModel

class UserInput(BaseModel):
    name: str
    age: int
    preferences: List[str]

@app.task
def calculate_user_score(input_data: UserInput) -> int:
    """
    Calculate a user's score based on their profile information.

    The score is computed using the following formula:
    - Base score: 10 points per character in the name
    - Age bonus: 2 points per year of age
    - Preferences bonus: 5 points per preference

    Args:
        input_data (UserInput): User profile containing name, age, and preferences

    Returns:
        int: The calculated user score
    """
    # Example calculation based on user data
    base_score = len(input_data.name) * 10
    age_bonus = input_data.age * 2
    preferences_bonus = len(input_data.preferences) * 5
    return base_score + age_bonus + preferences_bonus

For more detailed examples, please refer to our Documentation and the examples provided there.

🎨 Beautiful UI Components

Davia provides a modern and beautiful user interface out of the box. Our UI is built using shadcn/ui, a collection of reusable components that follow best practices and are built on top of Radix UI. The components are styled using Tailwind CSS, giving you access to a comprehensive color palette.

Davia UI Example

The UI components are:

  • Fully accessible
  • Customizable with Tailwind's colours
  • Responsive and mobile-friendly
  • Dark mode ready
  • Built with performance in mind

🤝 Connect with Us

🛠️ Next Steps


Davia: From Python to App in seconds.

About

The easiest way to build apps from your Python code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages