Skip to main content

Enterprise-ready Python framework that enforces Clean Architecture for building maintainable and scalable applications.

Project description

Vega Framework

An enterprise-ready Python framework that enforces Clean Architecture for building maintainable and scalable applications.

Features

  • Automatic Dependency Injection - Zero boilerplate, type-safe DI
  • Clean Architecture Patterns - Interactor, Mediator, Repository, Service
  • Async/Await Support - Full async support for CLI and web
  • Scope Management - Singleton, Scoped, Transient lifetimes
  • Type-Safe - Full type hints support
  • Framework-Agnostic - Works with any domain (web, AI, IoT, fintech, etc.)
  • CLI Scaffolding - Generate projects and components instantly
  • FastAPI Integration - Built-in web scaffold with routing and middleware
  • SQLAlchemy Support - Database management with async support and migrations
  • Lightweight - No unnecessary dependencies

Installation

pip install vega-framework

Quick Start

# Create new project
vega init my-app

# Generate components
vega generate entity User
vega generate repository UserRepository
vega generate interactor CreateUser

# Create FastAPI project
vega init my-api --template fastapi

CLI Commands

Initialize Project

vega init <project_name> [--template basic|fastapi|ai-rag] [--path .]

Creates a new Vega project with Clean Architecture structure:

  • domain/ - Entities, repositories, services, interactors
  • application/ - Mediators and workflows
  • infrastructure/ - Repository and service implementations
  • config.py - DI container setup
  • settings.py - Application configuration

Generate Components

vega generate entity <Name>
vega generate repository <Name> [--impl memory|sql]
vega generate service <Name>
vega generate interactor <Name>
vega generate mediator <Name>
vega generate router <Name>          # Requires FastAPI
vega generate middleware <Name>      # Requires FastAPI
vega generate model <Name>           # Requires SQLAlchemy
vega generate command <Name>         # CLI command (async by default)
vega generate command <Name> --impl sync  # Synchronous CLI command

Add Features

# Add FastAPI web scaffold
vega add web

# Add SQLAlchemy database support
vega add sqlalchemy
# or
vega add db

Database Migrations (SQLAlchemy)

# Initialize database
vega migrate init

# Create a new migration
vega migrate create -m "migration message"

# Apply migrations
vega migrate upgrade [--revision head]

# Rollback migrations
vega migrate downgrade [--revision -1]

# Show current revision
vega migrate current

# Show migration history
vega migrate history

Validate Project

vega doctor [--path .]

Validates project structure, DI configuration, and architecture compliance.

Async CLI Commands

Vega provides seamless async/await support in CLI commands, allowing you to execute interactors directly.

Generate a CLI Command

# Generate an async command (default)
vega generate command CreateUser

# Generate a synchronous command
vega generate command ListUsers --impl sync

The generator will prompt you for:

  • Command description
  • Options and arguments
  • Whether it will use interactors

Manual Command Example

import click
from vega.cli.utils import async_command

@click.command()
@click.option('--name', required=True)
@async_command
async def create_user(name: str):
    """Create a user using an interactor"""
    import config  # Initialize DI container
    from domain.interactors.create_user import CreateUser

    user = await CreateUser(name=name)
    click.echo(f"Created: {user.name}")

This enables the same async business logic to work in both CLI and web (FastAPI) contexts.

Use Cases

Perfect for:

  • AI/RAG applications
  • E-commerce platforms
  • Fintech systems
  • Mobile backends
  • Microservices
  • CLI tools
  • Any Python application requiring clean architecture

License

MIT

Contributing

Contributions welcome! This framework is extracted from production code and battle-tested.

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

vega_framework-0.1.16.tar.gz (46.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vega_framework-0.1.16-py3-none-any.whl (71.0 kB view details)

Uploaded Python 3

File details

Details for the file vega_framework-0.1.16.tar.gz.

File metadata

  • Download URL: vega_framework-0.1.16.tar.gz
  • Upload date:
  • Size: 46.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.11.13 Linux/6.11.0-1018-azure

File hashes

Hashes for vega_framework-0.1.16.tar.gz
Algorithm Hash digest
SHA256 0b7067c1216a5aa29ccb02f218609b38eccc0fe6be011c5f8ca8f61f656bf19a
MD5 84c97a7a6ec02fc0716ab3438132c9df
BLAKE2b-256 e2c90fad916818926be5287423781eb2dd1e39a35199a94050193f3068b6cadd

See more details on using hashes here.

File details

Details for the file vega_framework-0.1.16-py3-none-any.whl.

File metadata

  • Download URL: vega_framework-0.1.16-py3-none-any.whl
  • Upload date:
  • Size: 71.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.11.13 Linux/6.11.0-1018-azure

File hashes

Hashes for vega_framework-0.1.16-py3-none-any.whl
Algorithm Hash digest
SHA256 d1a6562e34a4cd8687bc3cdbd1c426a6c3e632ef55ad06d4f4ef826d1241e164
MD5 215fd270ba5f8006313afdc20517804a
BLAKE2b-256 f32efd8d0cbbae32978bcdb78dea2a3e9bd1ae32a1e28b82ecdcc5ce0d8cb69c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page