vega-framework 0.1.30__py3-none-any.whl → 0.1.31__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vega_framework-0.1.31.dist-info/METADATA +349 -0
- {vega_framework-0.1.30.dist-info → vega_framework-0.1.31.dist-info}/RECORD +5 -5
- vega_framework-0.1.30.dist-info/METADATA +0 -485
- {vega_framework-0.1.30.dist-info → vega_framework-0.1.31.dist-info}/WHEEL +0 -0
- {vega_framework-0.1.30.dist-info → vega_framework-0.1.31.dist-info}/entry_points.txt +0 -0
- {vega_framework-0.1.30.dist-info → vega_framework-0.1.31.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,349 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: vega-framework
|
3
|
+
Version: 0.1.31
|
4
|
+
Summary: Enterprise-ready Python framework that enforces Clean Architecture for building maintainable and scalable applications.
|
5
|
+
License: MIT
|
6
|
+
License-File: LICENSE
|
7
|
+
Keywords: clean-architecture,dependency-injection,framework,python,async,vega
|
8
|
+
Author: Roberto Ferro
|
9
|
+
Requires-Python: >=3.10,<4.0
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
11
|
+
Classifier: Intended Audience :: Developers
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
21
|
+
Requires-Dist: click (>=8.0,<9.0)
|
22
|
+
Requires-Dist: fastapi (>=0.109,<0.110)
|
23
|
+
Requires-Dist: jinja2 (>=3.1,<4.0)
|
24
|
+
Requires-Dist: pydantic (>=2.0,<3.0)
|
25
|
+
Requires-Dist: pydantic-settings (>=2.0,<3.0)
|
26
|
+
Requires-Dist: toml (>=0.10,<0.11)
|
27
|
+
Requires-Dist: uvicorn (>=0.27,<0.28)
|
28
|
+
Project-URL: Documentation, https://vega-framework.readthedocs.io
|
29
|
+
Project-URL: Homepage, https://github.com/RobyFerro/vega-framework
|
30
|
+
Project-URL: Repository, https://github.com/RobyFerro/vega-framework
|
31
|
+
Description-Content-Type: text/markdown
|
32
|
+
|
33
|
+
# Vega Framework
|
34
|
+
|
35
|
+
An enterprise-ready Python framework that enforces Clean Architecture for building maintainable and scalable applications.
|
36
|
+
|
37
|
+
## Why Vega?
|
38
|
+
|
39
|
+
Traditional Python frameworks show you **how to build** but don't enforce **how to architect**. Vega provides:
|
40
|
+
|
41
|
+
- ✅ **Clean Architecture** - Enforced separation of concerns
|
42
|
+
- ✅ **Dependency Injection** - Zero boilerplate, type-safe DI
|
43
|
+
- ✅ **Business Logic First** - Pure, testable, framework-independent
|
44
|
+
- ✅ **CLI Scaffolding** - Generate entire projects and components
|
45
|
+
- ✅ **Async Support** - Full async/await for CLI and web
|
46
|
+
- ✅ **FastAPI & SQLAlchemy** - Built-in integrations when needed
|
47
|
+
|
48
|
+
**[Read the Philosophy →](docs/explanation/philosophy.md)** to understand why architecture matters.
|
49
|
+
|
50
|
+
## Quick Start
|
51
|
+
|
52
|
+
### Installation
|
53
|
+
|
54
|
+
```bash
|
55
|
+
pip install vega-framework
|
56
|
+
```
|
57
|
+
|
58
|
+
### Create Your First Project
|
59
|
+
|
60
|
+
```bash
|
61
|
+
# Create project
|
62
|
+
vega init my-app
|
63
|
+
cd my-app
|
64
|
+
|
65
|
+
# Install dependencies
|
66
|
+
poetry install
|
67
|
+
|
68
|
+
# Generate components
|
69
|
+
vega generate entity User
|
70
|
+
vega generate repository UserRepository --impl memory
|
71
|
+
vega generate interactor CreateUser
|
72
|
+
|
73
|
+
# Run your app
|
74
|
+
poetry run python main.py
|
75
|
+
```
|
76
|
+
|
77
|
+
### Your First Use Case
|
78
|
+
|
79
|
+
```python
|
80
|
+
# domain/interactors/create_user.py
|
81
|
+
from vega.patterns import Interactor
|
82
|
+
from vega.di import bind
|
83
|
+
|
84
|
+
class CreateUser(Interactor[User]):
|
85
|
+
def __init__(self, name: str, email: str):
|
86
|
+
self.name = name
|
87
|
+
self.email = email
|
88
|
+
|
89
|
+
@bind
|
90
|
+
async def call(self, repository: UserRepository) -> User:
|
91
|
+
# Pure business logic - no framework code!
|
92
|
+
user = User(name=self.name, email=self.email)
|
93
|
+
return await repository.save(user)
|
94
|
+
|
95
|
+
# Usage - clean and simple
|
96
|
+
user = await CreateUser(name="John", email="john@example.com")
|
97
|
+
```
|
98
|
+
|
99
|
+
**[See Full Quick Start →](docs/tutorials/quickstart.md)**
|
100
|
+
|
101
|
+
## Key Concepts
|
102
|
+
|
103
|
+
### Clean Architecture Layers
|
104
|
+
|
105
|
+
```
|
106
|
+
┌─────────────────────────────────────┐
|
107
|
+
│ Presentation (CLI, Web) │ User interfaces
|
108
|
+
├─────────────────────────────────────┤
|
109
|
+
│ Application (Workflows) │ Multi-step operations
|
110
|
+
├─────────────────────────────────────┤
|
111
|
+
│ Domain (Business Logic) │ Core business rules
|
112
|
+
├─────────────────────────────────────┤
|
113
|
+
│ Infrastructure (Technical) │ Databases, APIs
|
114
|
+
└─────────────────────────────────────┘
|
115
|
+
```
|
116
|
+
|
117
|
+
**[Learn Clean Architecture →](docs/explanation/architecture/clean-architecture.md)**
|
118
|
+
|
119
|
+
### Core Patterns
|
120
|
+
|
121
|
+
- **[Interactor](docs/explanation/patterns/interactor.md)** - Single-purpose use case
|
122
|
+
- **[Mediator](docs/explanation/patterns/mediator.md)** - Complex workflow orchestration
|
123
|
+
- **[Repository](docs/explanation/patterns/repository.md)** - Data persistence abstraction
|
124
|
+
- **[Service](docs/explanation/patterns/service.md)** - External service abstraction
|
125
|
+
|
126
|
+
### Dependency Injection
|
127
|
+
|
128
|
+
```python
|
129
|
+
# Define what you need (domain)
|
130
|
+
class UserRepository(Repository[User]):
|
131
|
+
async def save(self, user: User) -> User:
|
132
|
+
pass
|
133
|
+
|
134
|
+
# Implement how it works (infrastructure)
|
135
|
+
@injectable(scope=Scope.SINGLETON)
|
136
|
+
class PostgresUserRepository(UserRepository):
|
137
|
+
async def save(self, user: User) -> User:
|
138
|
+
# PostgreSQL implementation
|
139
|
+
pass
|
140
|
+
|
141
|
+
# Wire it together (config)
|
142
|
+
container = Container({
|
143
|
+
UserRepository: PostgresUserRepository
|
144
|
+
})
|
145
|
+
```
|
146
|
+
|
147
|
+
**[Learn Dependency Injection →](docs/explanation/core/dependency-injection.md)**
|
148
|
+
|
149
|
+
## CLI Commands
|
150
|
+
|
151
|
+
### Project Management
|
152
|
+
|
153
|
+
```bash
|
154
|
+
vega init my-app # Create new project
|
155
|
+
vega init my-api --template fastapi # Create with FastAPI
|
156
|
+
vega doctor # Validate architecture
|
157
|
+
vega update # Update framework
|
158
|
+
```
|
159
|
+
|
160
|
+
### Code Generation
|
161
|
+
|
162
|
+
```bash
|
163
|
+
# Domain layer
|
164
|
+
vega generate entity Product
|
165
|
+
vega generate repository ProductRepository --impl sql
|
166
|
+
vega generate interactor CreateProduct
|
167
|
+
|
168
|
+
# Application layer
|
169
|
+
vega generate mediator CheckoutWorkflow
|
170
|
+
|
171
|
+
# Presentation layer
|
172
|
+
vega generate router Product # FastAPI (requires: vega add web)
|
173
|
+
vega generate command create-product # CLI
|
174
|
+
|
175
|
+
# Infrastructure
|
176
|
+
vega generate model Product # SQLAlchemy (requires: vega add db)
|
177
|
+
```
|
178
|
+
|
179
|
+
### Add Features
|
180
|
+
|
181
|
+
```bash
|
182
|
+
vega add web # Add FastAPI web support
|
183
|
+
vega add sqlalchemy # Add database support
|
184
|
+
```
|
185
|
+
|
186
|
+
### Database Migrations
|
187
|
+
|
188
|
+
```bash
|
189
|
+
vega migrate init # Initialize database
|
190
|
+
vega migrate create -m "add users" # Create migration
|
191
|
+
vega migrate upgrade # Apply migrations
|
192
|
+
vega migrate downgrade # Rollback
|
193
|
+
```
|
194
|
+
|
195
|
+
**[See All CLI Commands →](docs/reference/cli/overview.md)**
|
196
|
+
|
197
|
+
## Event System
|
198
|
+
|
199
|
+
Built-in event-driven architecture support:
|
200
|
+
|
201
|
+
```python
|
202
|
+
from vega.events import Event, subscribe
|
203
|
+
|
204
|
+
# Define event
|
205
|
+
@dataclass(frozen=True)
|
206
|
+
class UserCreated(Event):
|
207
|
+
user_id: str
|
208
|
+
email: str
|
209
|
+
|
210
|
+
# Subscribe to event
|
211
|
+
@subscribe(UserCreated)
|
212
|
+
async def send_welcome_email(event: UserCreated):
|
213
|
+
await email_service.send(event.email, "Welcome!")
|
214
|
+
|
215
|
+
# Publish event
|
216
|
+
await UserCreated(user_id="123", email="test@test.com").publish()
|
217
|
+
```
|
218
|
+
|
219
|
+
**[Learn Event System →](docs/explanation/events/overview.md)**
|
220
|
+
|
221
|
+
## Documentation
|
222
|
+
|
223
|
+
### Getting Started
|
224
|
+
- [Installation](docs/how-to/install.md)
|
225
|
+
- [Quick Start](docs/tutorials/quickstart.md)
|
226
|
+
- [Project Structure](docs/explanation/project-structure.md)
|
227
|
+
|
228
|
+
### Core Concepts
|
229
|
+
- [Philosophy](docs/explanation/philosophy.md) - Why Vega exists
|
230
|
+
- [Clean Architecture](docs/explanation/architecture/clean-architecture.md) - Architecture principles
|
231
|
+
- [Dependency Injection](docs/explanation/core/dependency-injection.md) - DI system
|
232
|
+
- [Patterns](docs/explanation/patterns/interactor.md) - Interactor, Mediator, Repository, Service
|
233
|
+
|
234
|
+
### Guides
|
235
|
+
- [Building Domain Layer](docs/how-to/build-domain-layer.md) - Business logic first
|
236
|
+
- [CLI Reference](docs/reference/cli/overview.md) - All CLI commands
|
237
|
+
- [Events System](docs/explanation/events/overview.md) - Event-driven architecture
|
238
|
+
|
239
|
+
### Reference
|
240
|
+
- [Changelog](docs/reference/CHANGELOG.md)
|
241
|
+
- [Roadmap](docs/reference/ROADMAP.md)
|
242
|
+
|
243
|
+
**[Browse All Documentation →](docs/README.md)**
|
244
|
+
|
245
|
+
## Perfect For
|
246
|
+
|
247
|
+
- E-commerce platforms
|
248
|
+
- Financial systems
|
249
|
+
- Enterprise SaaS applications
|
250
|
+
- AI/RAG applications
|
251
|
+
- Complex workflow systems
|
252
|
+
- Multi-tenant applications
|
253
|
+
- Any project requiring clean architecture
|
254
|
+
|
255
|
+
## Example Project
|
256
|
+
|
257
|
+
```
|
258
|
+
my-app/
|
259
|
+
├── domain/ # Business logic
|
260
|
+
│ ├── entities/ # Business objects
|
261
|
+
│ ├── repositories/ # Data interfaces
|
262
|
+
│ ├── services/ # External service interfaces
|
263
|
+
│ └── interactors/ # Use cases
|
264
|
+
├── application/ # Workflows
|
265
|
+
│ └── mediators/ # Complex orchestrations
|
266
|
+
├── infrastructure/ # Implementations
|
267
|
+
│ ├── repositories/ # Database code
|
268
|
+
│ └── services/ # API integrations
|
269
|
+
├── presentation/ # User interfaces
|
270
|
+
│ ├── cli/ # CLI commands
|
271
|
+
│ └── web/ # FastAPI routes
|
272
|
+
├── config.py # Dependency injection
|
273
|
+
├── settings.py # Configuration
|
274
|
+
└── main.py # Entry point
|
275
|
+
```
|
276
|
+
|
277
|
+
## Why Clean Architecture?
|
278
|
+
|
279
|
+
**Without Vega:**
|
280
|
+
```python
|
281
|
+
# ❌ Business logic mixed with framework code
|
282
|
+
@app.post("/orders")
|
283
|
+
async def create_order(request: Request):
|
284
|
+
data = await request.json()
|
285
|
+
order = OrderModel(**data) # SQLAlchemy
|
286
|
+
session.add(order)
|
287
|
+
stripe.Charge.create(...) # Stripe
|
288
|
+
return {"id": order.id}
|
289
|
+
```
|
290
|
+
|
291
|
+
**Problems:**
|
292
|
+
- Can't test without FastAPI, database, and Stripe
|
293
|
+
- Can't reuse for CLI or other interfaces
|
294
|
+
- Business rules are unclear
|
295
|
+
- Tightly coupled to specific technologies
|
296
|
+
|
297
|
+
**With Vega:**
|
298
|
+
```python
|
299
|
+
# ✅ Pure business logic (Domain)
|
300
|
+
class PlaceOrder(Interactor[Order]):
|
301
|
+
@bind
|
302
|
+
async def call(
|
303
|
+
self,
|
304
|
+
order_repo: OrderRepository,
|
305
|
+
payment_service: PaymentService
|
306
|
+
) -> Order:
|
307
|
+
# Pure business logic - testable, reusable
|
308
|
+
order = Order(...)
|
309
|
+
await payment_service.charge(...)
|
310
|
+
return await order_repo.save(order)
|
311
|
+
|
312
|
+
# ✅ FastAPI route (Presentation) - just wiring
|
313
|
+
@router.post("/orders")
|
314
|
+
async def create_order_api(request: CreateOrderRequest):
|
315
|
+
return await PlaceOrder(...)
|
316
|
+
|
317
|
+
# ✅ CLI command (Presentation) - same logic
|
318
|
+
@click.command()
|
319
|
+
async def create_order_cli(...):
|
320
|
+
return await PlaceOrder(...)
|
321
|
+
```
|
322
|
+
|
323
|
+
**Benefits:**
|
324
|
+
- ✅ Test business logic without any infrastructure
|
325
|
+
- ✅ Same logic works for Web, CLI, GraphQL, etc.
|
326
|
+
- ✅ Swap databases without changing business code
|
327
|
+
- ✅ Clear business rules and operations
|
328
|
+
|
329
|
+
## Community & Support
|
330
|
+
|
331
|
+
- **GitHub Issues**: [Report bugs and request features](https://github.com/RobyFerro/vega-framework/issues)
|
332
|
+
- **Documentation**: [Complete guides and API reference](docs/README.md)
|
333
|
+
- **Examples**: Check `examples/` directory for working code
|
334
|
+
|
335
|
+
## Contributing
|
336
|
+
|
337
|
+
Contributions are welcome! This framework is extracted from production code and battle-tested in real-world applications.
|
338
|
+
|
339
|
+
## License
|
340
|
+
|
341
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
342
|
+
|
343
|
+
---
|
344
|
+
|
345
|
+
**Built with ❤️ for developers who care about architecture.**
|
346
|
+
|
347
|
+
[Get Started →](docs/tutorials/quickstart.md) | [Read Philosophy →](docs/explanation/philosophy.md) | [View Documentation →](docs/README.md)
|
348
|
+
|
349
|
+
|
@@ -83,8 +83,8 @@ vega/patterns/repository.py,sha256=uYUyLs-O8OqW1Wb9ZqIo8UUcCjZ5UFuHors_F2iDg9A,1
|
|
83
83
|
vega/patterns/service.py,sha256=buFRgJoeQtZQK22Upb4vh84c1elWKFXWBaB0X4RaruE,1374
|
84
84
|
vega/settings/__init__.py,sha256=Eb8PMUyXAlCAQIcL2W8QhTTUHUbVlkAfXdpTUlADo1I,786
|
85
85
|
vega/settings/base.py,sha256=bL45hyoa3t-hQOvur860eSo7O833sQMsXJJPwbTVbwE,1321
|
86
|
-
vega_framework-0.1.
|
87
|
-
vega_framework-0.1.
|
88
|
-
vega_framework-0.1.
|
89
|
-
vega_framework-0.1.
|
90
|
-
vega_framework-0.1.
|
86
|
+
vega_framework-0.1.31.dist-info/METADATA,sha256=dMlyl1DCYbJCpOEG7a8zZzKMs8kZst-xp5vea7EfAbI,11105
|
87
|
+
vega_framework-0.1.31.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
88
|
+
vega_framework-0.1.31.dist-info/entry_points.txt,sha256=p3gyTmPYjNRLbuiKS-hG3ytWd-ssBweFy6VZ-F9FTNk,42
|
89
|
+
vega_framework-0.1.31.dist-info/licenses/LICENSE,sha256=wlHh1MBTcs2kSQr99P30mZ61s7uh7Cp9Rk0YiJxots0,1084
|
90
|
+
vega_framework-0.1.31.dist-info/RECORD,,
|
@@ -1,485 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: vega-framework
|
3
|
-
Version: 0.1.30
|
4
|
-
Summary: Enterprise-ready Python framework that enforces Clean Architecture for building maintainable and scalable applications.
|
5
|
-
License: MIT
|
6
|
-
License-File: LICENSE
|
7
|
-
Keywords: clean-architecture,dependency-injection,framework,python,async,vega
|
8
|
-
Author: Roberto Ferro
|
9
|
-
Requires-Python: >=3.10,<4.0
|
10
|
-
Classifier: Development Status :: 3 - Alpha
|
11
|
-
Classifier: Intended Audience :: Developers
|
12
|
-
Classifier: License :: OSI Approved :: MIT License
|
13
|
-
Classifier: Programming Language :: Python :: 3
|
14
|
-
Classifier: Programming Language :: Python :: 3.10
|
15
|
-
Classifier: Programming Language :: Python :: 3.11
|
16
|
-
Classifier: Programming Language :: Python :: 3.12
|
17
|
-
Classifier: Programming Language :: Python :: 3.13
|
18
|
-
Classifier: Programming Language :: Python :: 3.14
|
19
|
-
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
20
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
21
|
-
Requires-Dist: click (>=8.0,<9.0)
|
22
|
-
Requires-Dist: fastapi (>=0.109,<0.110)
|
23
|
-
Requires-Dist: jinja2 (>=3.1,<4.0)
|
24
|
-
Requires-Dist: pydantic (>=2.0,<3.0)
|
25
|
-
Requires-Dist: pydantic-settings (>=2.0,<3.0)
|
26
|
-
Requires-Dist: toml (>=0.10,<0.11)
|
27
|
-
Requires-Dist: uvicorn (>=0.27,<0.28)
|
28
|
-
Project-URL: Documentation, https://vega-framework.readthedocs.io
|
29
|
-
Project-URL: Homepage, https://github.com/RobyFerro/vega-framework
|
30
|
-
Project-URL: Repository, https://github.com/RobyFerro/vega-framework
|
31
|
-
Description-Content-Type: text/markdown
|
32
|
-
|
33
|
-
# Vega Framework
|
34
|
-
|
35
|
-
An enterprise-ready Python framework that enforces Clean Architecture for building maintainable and scalable applications.
|
36
|
-
|
37
|
-
## Features
|
38
|
-
|
39
|
-
- ✅ **Automatic Dependency Injection** - Zero boilerplate, type-safe DI
|
40
|
-
- ✅ **Clean Architecture Patterns** - Interactor, Mediator, Repository, Service
|
41
|
-
- ✅ **Async/Await Support** - Full async support for CLI and web
|
42
|
-
- ✅ **Scope Management** - Singleton, Scoped, Transient lifetimes
|
43
|
-
- ✅ **Type-Safe** - Full type hints support
|
44
|
-
- ✅ **Framework-Agnostic** - Works with any domain (web, AI, IoT, fintech, etc.)
|
45
|
-
- ✅ **CLI Scaffolding** - Generate projects and components instantly
|
46
|
-
- ✅ **FastAPI Integration** - Built-in web scaffold with routing and middleware
|
47
|
-
- ✅ **SQLAlchemy Support** - Database management with async support and migrations
|
48
|
-
- ✅ **Lightweight** - No unnecessary dependencies
|
49
|
-
|
50
|
-
## Installation
|
51
|
-
|
52
|
-
```bash
|
53
|
-
pip install vega-framework
|
54
|
-
```
|
55
|
-
|
56
|
-
## Quick Start
|
57
|
-
|
58
|
-
```bash
|
59
|
-
# Create new project
|
60
|
-
vega init my-app
|
61
|
-
|
62
|
-
# Generate components
|
63
|
-
vega generate entity User
|
64
|
-
vega generate repository UserRepository
|
65
|
-
vega generate interactor CreateUser
|
66
|
-
|
67
|
-
# Create FastAPI project
|
68
|
-
vega init my-api --template fastapi
|
69
|
-
```
|
70
|
-
|
71
|
-
## CLI Commands
|
72
|
-
|
73
|
-
Vega Framework provides a comprehensive CLI for scaffolding and managing Clean Architecture projects.
|
74
|
-
|
75
|
-
### Project Management
|
76
|
-
|
77
|
-
#### `vega init` - Initialize New Project
|
78
|
-
|
79
|
-
Create a new Vega project with Clean Architecture structure.
|
80
|
-
|
81
|
-
```bash
|
82
|
-
vega init <project_name> [OPTIONS]
|
83
|
-
```
|
84
|
-
|
85
|
-
**Options:**
|
86
|
-
- `--template <type>` - Project template (default: `basic`)
|
87
|
-
- `basic` - Standard Clean Architecture project with CLI support
|
88
|
-
- `fastapi` - Project with FastAPI web scaffold included
|
89
|
-
- `ai-rag` - AI/RAG application template (coming soon)
|
90
|
-
- `--path <directory>` - Parent directory for project (default: current directory)
|
91
|
-
|
92
|
-
**Examples:**
|
93
|
-
```bash
|
94
|
-
vega init my-app
|
95
|
-
vega init my-api --template fastapi
|
96
|
-
vega init my-ai --template ai-rag --path ./projects
|
97
|
-
```
|
98
|
-
|
99
|
-
**Creates:**
|
100
|
-
- `domain/` - Entities, repositories, services, interactors
|
101
|
-
- `application/` - Mediators and workflows
|
102
|
-
- `infrastructure/` - Repository and service implementations
|
103
|
-
- `presentation/` - CLI and web interfaces
|
104
|
-
- `config.py` - DI container configuration
|
105
|
-
- `settings.py` - Application settings
|
106
|
-
- `pyproject.toml` - Dependencies and project metadata
|
107
|
-
|
108
|
-
---
|
109
|
-
|
110
|
-
#### `vega doctor` - Validate Project
|
111
|
-
|
112
|
-
Validate your Vega project structure and architecture compliance.
|
113
|
-
|
114
|
-
```bash
|
115
|
-
vega doctor [--path .]
|
116
|
-
```
|
117
|
-
|
118
|
-
**Options:**
|
119
|
-
- `--path <directory>` - Project path to validate (default: current directory)
|
120
|
-
|
121
|
-
**Checks:**
|
122
|
-
- Correct folder structure
|
123
|
-
- DI container configuration
|
124
|
-
- Import dependencies
|
125
|
-
- Architecture violations
|
126
|
-
|
127
|
-
**Example:**
|
128
|
-
```bash
|
129
|
-
vega doctor
|
130
|
-
vega doctor --path ./my-app
|
131
|
-
```
|
132
|
-
|
133
|
-
---
|
134
|
-
|
135
|
-
#### `vega update` - Update Framework
|
136
|
-
|
137
|
-
Update Vega Framework to the latest version.
|
138
|
-
|
139
|
-
```bash
|
140
|
-
vega update [OPTIONS]
|
141
|
-
```
|
142
|
-
|
143
|
-
**Options:**
|
144
|
-
- `--check` - Check for updates without installing
|
145
|
-
- `--force` - Force reinstall even if up to date
|
146
|
-
|
147
|
-
**Examples:**
|
148
|
-
```bash
|
149
|
-
vega update # Update to latest version
|
150
|
-
vega update --check # Check for updates only
|
151
|
-
vega update --force # Force reinstall
|
152
|
-
```
|
153
|
-
|
154
|
-
---
|
155
|
-
|
156
|
-
### Code Generation
|
157
|
-
|
158
|
-
#### `vega generate` - Generate Components
|
159
|
-
|
160
|
-
Generate Clean Architecture components in your project.
|
161
|
-
|
162
|
-
```bash
|
163
|
-
vega generate <component_type> <name> [OPTIONS]
|
164
|
-
```
|
165
|
-
|
166
|
-
**Component Types:**
|
167
|
-
|
168
|
-
##### Domain Layer
|
169
|
-
|
170
|
-
**`entity`** - Domain Entity (dataclass)
|
171
|
-
```bash
|
172
|
-
vega generate entity Product
|
173
|
-
```
|
174
|
-
Creates a domain entity in `domain/entities/`
|
175
|
-
|
176
|
-
**`repository`** - Repository Interface
|
177
|
-
```bash
|
178
|
-
vega generate repository ProductRepository
|
179
|
-
vega generate repository Product --impl memory # With in-memory implementation
|
180
|
-
vega generate repository Product --impl sql # With SQL implementation
|
181
|
-
```
|
182
|
-
Creates repository interface in `domain/repositories/` and optionally an implementation in `infrastructure/repositories/`
|
183
|
-
|
184
|
-
**Alias:** `repo` can be used instead of `repository`
|
185
|
-
|
186
|
-
**`service`** - Service Interface
|
187
|
-
```bash
|
188
|
-
vega generate service EmailService
|
189
|
-
vega generate service Email --impl smtp # With SMTP implementation
|
190
|
-
```
|
191
|
-
Creates service interface in `domain/services/` and optionally an implementation in `infrastructure/services/`
|
192
|
-
|
193
|
-
**`interactor`** - Use Case / Interactor
|
194
|
-
```bash
|
195
|
-
vega generate interactor CreateProduct
|
196
|
-
vega generate interactor GetUserById
|
197
|
-
```
|
198
|
-
Creates interactor (use case) in `domain/interactors/`
|
199
|
-
|
200
|
-
##### Application Layer
|
201
|
-
|
202
|
-
**`mediator`** - Workflow / Mediator
|
203
|
-
```bash
|
204
|
-
vega generate mediator CheckoutFlow
|
205
|
-
vega generate mediator OrderProcessing
|
206
|
-
```
|
207
|
-
Creates mediator (workflow orchestrator) in `application/mediators/`
|
208
|
-
|
209
|
-
##### Infrastructure Layer
|
210
|
-
|
211
|
-
**`model`** - SQLAlchemy Model *(requires SQLAlchemy)*
|
212
|
-
```bash
|
213
|
-
vega generate model User
|
214
|
-
vega generate model ProductCategory
|
215
|
-
```
|
216
|
-
Creates SQLAlchemy model in `infrastructure/models/` and registers it in Alembic
|
217
|
-
|
218
|
-
##### Presentation Layer
|
219
|
-
|
220
|
-
**`router`** - FastAPI Router *(requires FastAPI)*
|
221
|
-
```bash
|
222
|
-
vega generate router Product
|
223
|
-
vega generate router User
|
224
|
-
```
|
225
|
-
Creates FastAPI router in `presentation/web/routes/` and auto-registers it
|
226
|
-
|
227
|
-
**`middleware`** - FastAPI Middleware *(requires FastAPI)*
|
228
|
-
```bash
|
229
|
-
vega generate middleware Logging
|
230
|
-
vega generate middleware Authentication
|
231
|
-
```
|
232
|
-
Creates FastAPI middleware in `presentation/web/middleware/` and auto-registers it
|
233
|
-
|
234
|
-
**`command`** - CLI Command
|
235
|
-
```bash
|
236
|
-
vega generate command CreateUser # Async command (default)
|
237
|
-
vega generate command ListUsers --impl sync # Synchronous command
|
238
|
-
```
|
239
|
-
Creates CLI command in `presentation/cli/commands/`
|
240
|
-
|
241
|
-
The generator will prompt for:
|
242
|
-
- Command description
|
243
|
-
- Options and arguments
|
244
|
-
- Whether it will use interactors
|
245
|
-
|
246
|
-
**Options:**
|
247
|
-
- `--path <directory>` - Project root path (default: current directory)
|
248
|
-
- `--impl <type>` - Generate infrastructure implementation
|
249
|
-
- For `repository`: `memory`, `sql`, or custom name
|
250
|
-
- For `service`: custom implementation name
|
251
|
-
- For `command`: `sync` or `async` (default: async)
|
252
|
-
|
253
|
-
**Examples:**
|
254
|
-
```bash
|
255
|
-
# Domain layer
|
256
|
-
vega generate entity Product
|
257
|
-
vega generate repository ProductRepository --impl memory
|
258
|
-
vega generate service EmailService --impl smtp
|
259
|
-
vega generate interactor CreateProduct
|
260
|
-
|
261
|
-
# Application layer
|
262
|
-
vega generate mediator CheckoutFlow
|
263
|
-
|
264
|
-
# Presentation layer (web)
|
265
|
-
vega generate router Product
|
266
|
-
vega generate middleware Logging
|
267
|
-
|
268
|
-
# Presentation layer (CLI)
|
269
|
-
vega generate command CreateUser
|
270
|
-
vega generate command ListUsers --impl sync
|
271
|
-
|
272
|
-
# Infrastructure layer
|
273
|
-
vega generate model User
|
274
|
-
```
|
275
|
-
|
276
|
-
---
|
277
|
-
|
278
|
-
### Feature Management
|
279
|
-
|
280
|
-
#### `vega add` - Add Features to Project
|
281
|
-
|
282
|
-
Add additional features to an existing Vega project.
|
283
|
-
|
284
|
-
```bash
|
285
|
-
vega add <feature> [OPTIONS]
|
286
|
-
```
|
287
|
-
|
288
|
-
**Features:**
|
289
|
-
|
290
|
-
**`web`** - Add FastAPI Web Scaffold
|
291
|
-
```bash
|
292
|
-
vega add web
|
293
|
-
```
|
294
|
-
Adds FastAPI web scaffold to your project:
|
295
|
-
- `presentation/web/` - Web application structure
|
296
|
-
- `presentation/web/routes/` - API routes
|
297
|
-
- `presentation/web/middleware/` - Middleware components
|
298
|
-
- `presentation/web/app.py` - FastAPI app factory
|
299
|
-
|
300
|
-
**`sqlalchemy` / `db`** - Add SQLAlchemy Database Support
|
301
|
-
```bash
|
302
|
-
vega add sqlalchemy
|
303
|
-
vega add db # Alias
|
304
|
-
```
|
305
|
-
Adds SQLAlchemy database support:
|
306
|
-
- `infrastructure/database_manager.py` - Database connection manager
|
307
|
-
- `infrastructure/models/` - SQLAlchemy models directory
|
308
|
-
- `alembic/` - Database migration system
|
309
|
-
- `alembic.ini` - Alembic configuration
|
310
|
-
|
311
|
-
**Options:**
|
312
|
-
- `--path <directory>` - Path to Vega project (default: current directory)
|
313
|
-
|
314
|
-
**Examples:**
|
315
|
-
```bash
|
316
|
-
vega add web
|
317
|
-
vega add sqlalchemy
|
318
|
-
vega add db --path ./my-project
|
319
|
-
```
|
320
|
-
|
321
|
-
---
|
322
|
-
|
323
|
-
### Database Management
|
324
|
-
|
325
|
-
#### `vega migrate` - Database Migration Commands
|
326
|
-
|
327
|
-
Manage database schema migrations with Alembic *(requires SQLAlchemy)*.
|
328
|
-
|
329
|
-
**`init`** - Initialize Database
|
330
|
-
```bash
|
331
|
-
vega migrate init
|
332
|
-
```
|
333
|
-
Creates all database tables based on current models. Use this for initial setup.
|
334
|
-
|
335
|
-
**`create`** - Create New Migration
|
336
|
-
```bash
|
337
|
-
vega migrate create -m "migration message"
|
338
|
-
```
|
339
|
-
Generates a new migration file by auto-detecting model changes.
|
340
|
-
|
341
|
-
**Options:**
|
342
|
-
- `-m, --message <text>` - Migration description (required)
|
343
|
-
|
344
|
-
**`upgrade`** - Apply Migrations
|
345
|
-
```bash
|
346
|
-
vega migrate upgrade [--revision head]
|
347
|
-
```
|
348
|
-
Apply pending migrations to the database.
|
349
|
-
|
350
|
-
**Options:**
|
351
|
-
- `--revision <id>` - Target revision (default: `head` - latest)
|
352
|
-
|
353
|
-
**`downgrade`** - Rollback Migrations
|
354
|
-
```bash
|
355
|
-
vega migrate downgrade [--revision -1]
|
356
|
-
```
|
357
|
-
Rollback database migrations.
|
358
|
-
|
359
|
-
**Options:**
|
360
|
-
- `--revision <id>` - Target revision (default: `-1` - previous)
|
361
|
-
|
362
|
-
**`current`** - Show Current Revision
|
363
|
-
```bash
|
364
|
-
vega migrate current
|
365
|
-
```
|
366
|
-
Display the current database migration revision.
|
367
|
-
|
368
|
-
**`history`** - Show Migration History
|
369
|
-
```bash
|
370
|
-
vega migrate history
|
371
|
-
```
|
372
|
-
Display complete migration history with details.
|
373
|
-
|
374
|
-
**Examples:**
|
375
|
-
```bash
|
376
|
-
# Initialize database
|
377
|
-
vega migrate init
|
378
|
-
|
379
|
-
# Create migration after changing models
|
380
|
-
vega migrate create -m "Add user table"
|
381
|
-
vega migrate create -m "Add email field to users"
|
382
|
-
|
383
|
-
# Apply all pending migrations
|
384
|
-
vega migrate upgrade
|
385
|
-
|
386
|
-
# Apply migrations up to specific revision
|
387
|
-
vega migrate upgrade --revision abc123
|
388
|
-
|
389
|
-
# Rollback last migration
|
390
|
-
vega migrate downgrade
|
391
|
-
|
392
|
-
# Rollback to specific revision
|
393
|
-
vega migrate downgrade --revision xyz789
|
394
|
-
|
395
|
-
# Check current status
|
396
|
-
vega migrate current
|
397
|
-
|
398
|
-
# View history
|
399
|
-
vega migrate history
|
400
|
-
```
|
401
|
-
|
402
|
-
---
|
403
|
-
|
404
|
-
### Getting Help
|
405
|
-
|
406
|
-
**Show Version:**
|
407
|
-
```bash
|
408
|
-
vega --version
|
409
|
-
```
|
410
|
-
|
411
|
-
**Show Help:**
|
412
|
-
```bash
|
413
|
-
vega --help # Main help
|
414
|
-
vega <command> --help # Command-specific help
|
415
|
-
vega generate --help # Generate command help
|
416
|
-
vega migrate --help # Migrate command help
|
417
|
-
```
|
418
|
-
|
419
|
-
**Examples:**
|
420
|
-
```bash
|
421
|
-
vega init --help
|
422
|
-
vega generate --help
|
423
|
-
vega add --help
|
424
|
-
vega migrate upgrade --help
|
425
|
-
```
|
426
|
-
|
427
|
-
## Async CLI Commands
|
428
|
-
|
429
|
-
Vega provides seamless async/await support in CLI commands, allowing you to execute interactors directly.
|
430
|
-
|
431
|
-
### Generate a CLI Command
|
432
|
-
|
433
|
-
```bash
|
434
|
-
# Generate an async command (default)
|
435
|
-
vega generate command CreateUser
|
436
|
-
|
437
|
-
# Generate a synchronous command
|
438
|
-
vega generate command ListUsers --impl sync
|
439
|
-
```
|
440
|
-
|
441
|
-
The generator will prompt you for:
|
442
|
-
- Command description
|
443
|
-
- Options and arguments
|
444
|
-
- Whether it will use interactors
|
445
|
-
|
446
|
-
### Manual Command Example
|
447
|
-
|
448
|
-
```python
|
449
|
-
import click
|
450
|
-
from vega.cli.utils import async_command
|
451
|
-
|
452
|
-
@click.command()
|
453
|
-
@click.option('--name', required=True)
|
454
|
-
@async_command
|
455
|
-
async def create_user(name: str):
|
456
|
-
"""Create a user using an interactor"""
|
457
|
-
import config # Initialize DI container
|
458
|
-
from domain.interactors.create_user import CreateUser
|
459
|
-
|
460
|
-
user = await CreateUser(name=name)
|
461
|
-
click.echo(f"Created: {user.name}")
|
462
|
-
```
|
463
|
-
|
464
|
-
This enables the same async business logic to work in both CLI and web (FastAPI) contexts.
|
465
|
-
|
466
|
-
## Use Cases
|
467
|
-
|
468
|
-
Perfect for:
|
469
|
-
|
470
|
-
- AI/RAG applications
|
471
|
-
- E-commerce platforms
|
472
|
-
- Fintech systems
|
473
|
-
- Mobile backends
|
474
|
-
- Microservices
|
475
|
-
- CLI tools
|
476
|
-
- Any Python application requiring clean architecture
|
477
|
-
|
478
|
-
## License
|
479
|
-
|
480
|
-
MIT
|
481
|
-
|
482
|
-
## Contributing
|
483
|
-
|
484
|
-
Contributions welcome! This framework is extracted from production code and battle-tested.
|
485
|
-
|
File without changes
|
File without changes
|
File without changes
|