vega-framework 0.1.16__py3-none-any.whl → 0.1.18__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/cli/templates/cli/command.py.j2 +4 -4
- vega/cli/templates/cli/command_simple.py.j2 +4 -4
- vega/cli/templates/project/ARCHITECTURE.md.j2 +226 -0
- vega/cli/templates/project/README.md.j2 +111 -14
- vega_framework-0.1.18.dist-info/METADATA +483 -0
- {vega_framework-0.1.16.dist-info → vega_framework-0.1.18.dist-info}/RECORD +9 -9
- vega_framework-0.1.16.dist-info/METADATA +0 -200
- {vega_framework-0.1.16.dist-info → vega_framework-0.1.18.dist-info}/WHEEL +0 -0
- {vega_framework-0.1.16.dist-info → vega_framework-0.1.18.dist-info}/entry_points.txt +0 -0
- {vega_framework-0.1.16.dist-info → vega_framework-0.1.18.dist-info}/licenses/LICENSE +0 -0
@@ -9,12 +9,12 @@ import config # noqa: F401 - Initialize DI container
|
|
9
9
|
{% endif %}
|
10
10
|
|
11
11
|
@click.command()
|
12
|
-
{
|
12
|
+
{% for option in options %}
|
13
13
|
@click.option('{{ option.flag }}', {{ option.params }})
|
14
|
-
{
|
15
|
-
{
|
14
|
+
{% endfor %}
|
15
|
+
{% for argument in arguments %}
|
16
16
|
@click.argument('{{ argument.name }}'{{ argument.params }})
|
17
|
-
{
|
17
|
+
{% endfor %}
|
18
18
|
@async_command
|
19
19
|
async def {{ command_name }}({{ params_signature }}):
|
20
20
|
"""
|
@@ -3,12 +3,12 @@ import click
|
|
3
3
|
|
4
4
|
|
5
5
|
@click.command()
|
6
|
-
{
|
6
|
+
{% for option in options %}
|
7
7
|
@click.option('{{ option.flag }}', {{ option.params }})
|
8
|
-
{
|
9
|
-
{
|
8
|
+
{% endfor %}
|
9
|
+
{% for argument in arguments %}
|
10
10
|
@click.argument('{{ argument.name }}'{{ argument.params }})
|
11
|
-
{
|
11
|
+
{% endfor %}
|
12
12
|
def {{ command_name }}({{ params_signature }}):
|
13
13
|
"""{{ description }}"""
|
14
14
|
click.echo("{{ command_name }} executed!")
|
@@ -262,6 +262,232 @@ class StripePaymentService(PaymentService):
|
|
262
262
|
pass
|
263
263
|
```
|
264
264
|
|
265
|
+
## Development Workflow with Vega CLI
|
266
|
+
|
267
|
+
Vega provides powerful CLI commands to quickly scaffold components following Clean Architecture principles. These commands help you maintain the correct architectural boundaries while accelerating development.
|
268
|
+
|
269
|
+
### Generating Domain Layer Components
|
270
|
+
|
271
|
+
**Entities** - Pure business objects:
|
272
|
+
```bash
|
273
|
+
vega generate entity User
|
274
|
+
vega generate entity Product
|
275
|
+
vega generate entity Order
|
276
|
+
```
|
277
|
+
|
278
|
+
**Repository Interfaces** - Data persistence abstractions:
|
279
|
+
```bash
|
280
|
+
vega generate repository UserRepository
|
281
|
+
vega generate repository Product # Auto-adds "Repository" suffix
|
282
|
+
```
|
283
|
+
|
284
|
+
**Repository with Implementation** - Create both interface and concrete implementation:
|
285
|
+
```bash
|
286
|
+
vega generate repository User --impl memory # In-memory implementation
|
287
|
+
vega generate repository User --impl sql # SQL implementation
|
288
|
+
vega generate repository User --impl postgres # PostgreSQL implementation
|
289
|
+
```
|
290
|
+
|
291
|
+
**Service Interfaces** - External service abstractions:
|
292
|
+
```bash
|
293
|
+
vega generate service EmailService
|
294
|
+
vega generate service PaymentService
|
295
|
+
```
|
296
|
+
|
297
|
+
**Service with Implementation**:
|
298
|
+
```bash
|
299
|
+
vega generate service Email --impl sendgrid
|
300
|
+
vega generate service Payment --impl stripe
|
301
|
+
```
|
302
|
+
|
303
|
+
**Interactors** - Single-purpose use cases:
|
304
|
+
```bash
|
305
|
+
vega generate interactor CreateUser
|
306
|
+
vega generate interactor GetUserById
|
307
|
+
vega generate interactor UpdateUserEmail
|
308
|
+
vega generate interactor DeleteUser
|
309
|
+
```
|
310
|
+
|
311
|
+
### Generating Application Layer Components
|
312
|
+
|
313
|
+
**Mediators** - Complex workflows:
|
314
|
+
```bash
|
315
|
+
vega generate mediator UserRegistrationFlow
|
316
|
+
vega generate mediator CheckoutWorkflow
|
317
|
+
vega generate mediator OrderProcessingPipeline
|
318
|
+
```
|
319
|
+
|
320
|
+
### Generating Infrastructure Layer Components
|
321
|
+
|
322
|
+
**SQLAlchemy Models** - Database models (requires database support):
|
323
|
+
```bash
|
324
|
+
vega generate model User
|
325
|
+
vega generate model Product
|
326
|
+
vega generate model Order
|
327
|
+
```
|
328
|
+
|
329
|
+
Note: Models are automatically registered in Alembic for migrations.
|
330
|
+
|
331
|
+
### Generating Presentation Layer Components
|
332
|
+
|
333
|
+
**CLI Commands** - Command-line interfaces:
|
334
|
+
```bash
|
335
|
+
vega generate command CreateUser # Async command (default)
|
336
|
+
vega generate command ListUsers --impl sync # Synchronous command
|
337
|
+
```
|
338
|
+
|
339
|
+
The generator will interactively prompt for:
|
340
|
+
- Command description
|
341
|
+
- Options and arguments (flags, parameters)
|
342
|
+
- Whether to use interactors
|
343
|
+
- Parameter types and validation
|
344
|
+
|
345
|
+
**FastAPI Routers** - HTTP API endpoints (requires web support):
|
346
|
+
```bash
|
347
|
+
vega generate router User
|
348
|
+
vega generate router Product
|
349
|
+
vega generate router Order
|
350
|
+
```
|
351
|
+
|
352
|
+
**FastAPI Middleware** - Request/response processing (requires web support):
|
353
|
+
```bash
|
354
|
+
vega generate middleware Logging
|
355
|
+
vega generate middleware Authentication
|
356
|
+
vega generate middleware RateLimiting
|
357
|
+
```
|
358
|
+
|
359
|
+
### Adding Features to Existing Projects
|
360
|
+
|
361
|
+
**Add FastAPI Web Support**:
|
362
|
+
```bash
|
363
|
+
vega add web
|
364
|
+
```
|
365
|
+
|
366
|
+
Creates complete FastAPI scaffold:
|
367
|
+
- `presentation/web/` directory structure
|
368
|
+
- Routes and middleware setup
|
369
|
+
- Health check endpoints
|
370
|
+
- App factory pattern
|
371
|
+
|
372
|
+
**Add Database Support**:
|
373
|
+
```bash
|
374
|
+
vega add sqlalchemy # or: vega add db
|
375
|
+
```
|
376
|
+
|
377
|
+
Adds complete database infrastructure:
|
378
|
+
- SQLAlchemy async support
|
379
|
+
- Alembic migrations
|
380
|
+
- Database manager
|
381
|
+
- Base model classes
|
382
|
+
|
383
|
+
### Database Migrations Workflow
|
384
|
+
|
385
|
+
After adding SQLAlchemy support, manage your database schema:
|
386
|
+
|
387
|
+
```bash
|
388
|
+
# Initialize database (creates tables)
|
389
|
+
vega migrate init
|
390
|
+
|
391
|
+
# Create migration after model changes
|
392
|
+
vega migrate create -m "Add users table"
|
393
|
+
vega migrate create -m "Add email_verified field to users"
|
394
|
+
|
395
|
+
# Apply pending migrations
|
396
|
+
vega migrate upgrade
|
397
|
+
|
398
|
+
# Rollback last migration
|
399
|
+
vega migrate downgrade
|
400
|
+
|
401
|
+
# Check current migration status
|
402
|
+
vega migrate current
|
403
|
+
|
404
|
+
# View migration history
|
405
|
+
vega migrate history
|
406
|
+
```
|
407
|
+
|
408
|
+
### Project Validation
|
409
|
+
|
410
|
+
Validate your project structure and architecture compliance:
|
411
|
+
|
412
|
+
```bash
|
413
|
+
vega doctor
|
414
|
+
vega doctor --path ./my-project
|
415
|
+
```
|
416
|
+
|
417
|
+
Checks for:
|
418
|
+
- Correct folder structure
|
419
|
+
- DI container configuration
|
420
|
+
- Import dependencies
|
421
|
+
- Architecture violations (e.g., domain depending on infrastructure)
|
422
|
+
|
423
|
+
### Development Best Practices with CLI
|
424
|
+
|
425
|
+
**1. Start with Domain Layer**:
|
426
|
+
```bash
|
427
|
+
# Define your entities first
|
428
|
+
vega generate entity User
|
429
|
+
|
430
|
+
# Create repository interfaces
|
431
|
+
vega generate repository UserRepository
|
432
|
+
|
433
|
+
# Implement use cases
|
434
|
+
vega generate interactor CreateUser
|
435
|
+
vega generate interactor GetUserById
|
436
|
+
```
|
437
|
+
|
438
|
+
**2. Add Infrastructure Implementations**:
|
439
|
+
```bash
|
440
|
+
# Generate repository implementation
|
441
|
+
vega generate repository User --impl memory # Start with in-memory
|
442
|
+
|
443
|
+
# Later, add database support
|
444
|
+
vega add sqlalchemy
|
445
|
+
vega generate model User
|
446
|
+
vega generate repository User --impl sql
|
447
|
+
```
|
448
|
+
|
449
|
+
**3. Build Application Workflows**:
|
450
|
+
```bash
|
451
|
+
# Orchestrate multiple use cases
|
452
|
+
vega generate mediator UserRegistrationFlow
|
453
|
+
```
|
454
|
+
|
455
|
+
**4. Create Delivery Mechanisms**:
|
456
|
+
```bash
|
457
|
+
# CLI interface
|
458
|
+
vega generate command create-user
|
459
|
+
|
460
|
+
# Web API (add web first if not present)
|
461
|
+
vega add web
|
462
|
+
vega generate router User
|
463
|
+
```
|
464
|
+
|
465
|
+
**5. Validate Architecture**:
|
466
|
+
```bash
|
467
|
+
# Ensure clean architecture compliance
|
468
|
+
vega doctor
|
469
|
+
```
|
470
|
+
|
471
|
+
### CLI Quick Reference
|
472
|
+
|
473
|
+
| Command | Purpose |
|
474
|
+
|---------|---------|
|
475
|
+
| `vega init <name>` | Create new Vega project |
|
476
|
+
| `vega generate entity <Name>` | Generate domain entity |
|
477
|
+
| `vega generate repository <Name>` | Generate repository interface |
|
478
|
+
| `vega generate interactor <Name>` | Generate use case |
|
479
|
+
| `vega generate mediator <Name>` | Generate workflow |
|
480
|
+
| `vega generate command <Name>` | Generate CLI command |
|
481
|
+
| `vega generate router <Name>` | Generate FastAPI router |
|
482
|
+
| `vega generate model <Name>` | Generate SQLAlchemy model |
|
483
|
+
| `vega add web` | Add FastAPI support |
|
484
|
+
| `vega add sqlalchemy` | Add database support |
|
485
|
+
| `vega migrate <command>` | Manage database migrations |
|
486
|
+
| `vega doctor` | Validate project architecture |
|
487
|
+
| `vega update` | Update Vega Framework |
|
488
|
+
|
489
|
+
For complete documentation, see the [README](README.md#cli-commands).
|
490
|
+
|
265
491
|
## Dependency Injection
|
266
492
|
|
267
493
|
Vega provides automatic dependency injection through decorators and a container.
|
@@ -20,15 +20,11 @@ Vega Framework application with Clean Architecture.
|
|
20
20
|
│ └── services/ # Service implementations
|
21
21
|
│
|
22
22
|
├── presentation/ # Delivery mechanisms
|
23
|
-
|
24
|
-
│ ├── web/ # FastAPI web interface
|
23
|
+
│ ├── web/ # FastAPI web interface (if added)
|
25
24
|
│ │ ├── routes/ # HTTP endpoints
|
26
25
|
│ │ ├── app.py # FastAPI app factory
|
27
26
|
│ │ └── main.py # ASGI entrypoint
|
28
|
-
│ └── cli/ # CLI commands (if needed)
|
29
|
-
{% else -%}
|
30
27
|
│ └── cli/ # CLI commands
|
31
|
-
{% endif -%}
|
32
28
|
│
|
33
29
|
├── config.py # Dependency injection setup
|
34
30
|
├── settings.py # Application configuration
|
@@ -45,15 +41,85 @@ poetry install
|
|
45
41
|
cp .env.example .env
|
46
42
|
# Edit .env with your configuration
|
47
43
|
|
48
|
-
#
|
49
|
-
|
50
|
-
|
51
|
-
|
44
|
+
# Run CLI commands
|
45
|
+
python main.py hello
|
46
|
+
python main.py greet --name John
|
47
|
+
|
48
|
+
# If using FastAPI template, run the web server
|
49
|
+
python main.py web
|
50
|
+
python main.py web --reload # With auto-reload
|
51
|
+
# Visit http://localhost:8000/api/health/status
|
52
52
|
|
53
53
|
# Run tests
|
54
54
|
poetry run pytest
|
55
55
|
```
|
56
56
|
|
57
|
+
## Development with Vega CLI
|
58
|
+
|
59
|
+
### Generate Components
|
60
|
+
|
61
|
+
Generate Clean Architecture components quickly:
|
62
|
+
|
63
|
+
```bash
|
64
|
+
# Domain layer
|
65
|
+
vega generate entity Product
|
66
|
+
vega generate repository ProductRepository --impl memory
|
67
|
+
vega generate service EmailService
|
68
|
+
vega generate interactor CreateProduct
|
69
|
+
|
70
|
+
# Application layer
|
71
|
+
vega generate mediator CheckoutFlow
|
72
|
+
|
73
|
+
# Presentation layer (web)
|
74
|
+
vega generate router Product
|
75
|
+
vega generate middleware Logging
|
76
|
+
|
77
|
+
# Presentation layer (CLI)
|
78
|
+
vega generate command CreateUser
|
79
|
+
vega generate command ListUsers --impl sync
|
80
|
+
```
|
81
|
+
|
82
|
+
### Add Features
|
83
|
+
|
84
|
+
Add FastAPI web support to your project:
|
85
|
+
|
86
|
+
```bash
|
87
|
+
vega add web
|
88
|
+
```
|
89
|
+
|
90
|
+
### Add Database Support
|
91
|
+
|
92
|
+
Add SQLAlchemy and Alembic for database management:
|
93
|
+
|
94
|
+
```bash
|
95
|
+
vega add sqlalchemy # or: vega add db
|
96
|
+
```
|
97
|
+
|
98
|
+
Then manage your database:
|
99
|
+
|
100
|
+
```bash
|
101
|
+
# Initialize database
|
102
|
+
vega migrate init
|
103
|
+
|
104
|
+
# Create migrations
|
105
|
+
vega migrate create -m "Add users table"
|
106
|
+
|
107
|
+
# Apply migrations
|
108
|
+
vega migrate upgrade
|
109
|
+
|
110
|
+
# Rollback migrations
|
111
|
+
vega migrate downgrade
|
112
|
+
```
|
113
|
+
|
114
|
+
### Generate Database Models
|
115
|
+
|
116
|
+
After adding SQLAlchemy support:
|
117
|
+
|
118
|
+
```bash
|
119
|
+
vega generate model User
|
120
|
+
vega generate model Product
|
121
|
+
```
|
122
|
+
|
57
123
|
## Using Async Commands
|
58
124
|
|
59
125
|
Vega Framework supports async/await in CLI commands, allowing you to execute interactors seamlessly:
|
@@ -76,16 +142,47 @@ async def create_user(name: str):
|
|
76
142
|
|
77
143
|
This allows the same async business logic to work in both CLI and web contexts (FastAPI).
|
78
144
|
|
145
|
+
## Project Commands Quick Reference
|
146
|
+
|
147
|
+
```bash
|
148
|
+
# Component generation
|
149
|
+
vega generate entity <Name>
|
150
|
+
vega generate repository <Name> [--impl memory|sql]
|
151
|
+
vega generate interactor <Name>
|
152
|
+
vega generate mediator <Name>
|
153
|
+
vega generate command <Name> [--impl sync]
|
154
|
+
|
155
|
+
# Feature management
|
156
|
+
vega add web
|
157
|
+
vega add sqlalchemy
|
158
|
+
|
159
|
+
# Database management (requires SQLAlchemy)
|
160
|
+
vega migrate init
|
161
|
+
vega migrate create -m "message"
|
162
|
+
vega migrate upgrade
|
163
|
+
vega migrate downgrade
|
164
|
+
|
165
|
+
# Project validation
|
166
|
+
vega doctor
|
167
|
+
|
168
|
+
# Framework updates
|
169
|
+
vega update
|
170
|
+
vega update --check
|
171
|
+
```
|
172
|
+
|
79
173
|
## Vega Framework
|
80
174
|
|
81
|
-
This project uses [Vega Framework](https://github.com/
|
175
|
+
This project uses [Vega Framework](https://github.com/robertosixty1/vega-framework) for Clean Architecture:
|
82
176
|
|
83
|
-
- Automatic Dependency Injection
|
84
|
-
- Clean Architecture patterns (4 layers: Domain, Application, Infrastructure, Presentation)
|
85
|
-
- Type-safe with Python type hints
|
86
|
-
-
|
177
|
+
- ✅ Automatic Dependency Injection
|
178
|
+
- ✅ Clean Architecture patterns (4 layers: Domain, Application, Infrastructure, Presentation)
|
179
|
+
- ✅ Type-safe with Python type hints
|
180
|
+
- ✅ Async/await support for CLI and web
|
181
|
+
- ✅ Easy to test and maintain
|
182
|
+
- ✅ Framework-agnostic business logic
|
87
183
|
|
88
184
|
## Documentation
|
89
185
|
|
90
186
|
- [Vega Framework Docs](https://vega-framework.readthedocs.io/)
|
91
187
|
- [Clean Architecture](https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html)
|
188
|
+
- [Vega CLI Reference](https://github.com/robertosixty1/vega-framework#cli-commands)
|
@@ -0,0 +1,483 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: vega-framework
|
3
|
+
Version: 0.1.18
|
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: jinja2 (>=3.1,<4.0)
|
23
|
+
Requires-Dist: pydantic (>=2.0,<3.0)
|
24
|
+
Requires-Dist: pydantic-settings (>=2.0,<3.0)
|
25
|
+
Requires-Dist: toml (>=0.10,<0.11)
|
26
|
+
Project-URL: Documentation, https://vega-framework.readthedocs.io
|
27
|
+
Project-URL: Homepage, https://github.com/RobyFerro/vega-framework
|
28
|
+
Project-URL: Repository, https://github.com/RobyFerro/vega-framework
|
29
|
+
Description-Content-Type: text/markdown
|
30
|
+
|
31
|
+
# Vega Framework
|
32
|
+
|
33
|
+
An enterprise-ready Python framework that enforces Clean Architecture for building maintainable and scalable applications.
|
34
|
+
|
35
|
+
## Features
|
36
|
+
|
37
|
+
- ✅ **Automatic Dependency Injection** - Zero boilerplate, type-safe DI
|
38
|
+
- ✅ **Clean Architecture Patterns** - Interactor, Mediator, Repository, Service
|
39
|
+
- ✅ **Async/Await Support** - Full async support for CLI and web
|
40
|
+
- ✅ **Scope Management** - Singleton, Scoped, Transient lifetimes
|
41
|
+
- ✅ **Type-Safe** - Full type hints support
|
42
|
+
- ✅ **Framework-Agnostic** - Works with any domain (web, AI, IoT, fintech, etc.)
|
43
|
+
- ✅ **CLI Scaffolding** - Generate projects and components instantly
|
44
|
+
- ✅ **FastAPI Integration** - Built-in web scaffold with routing and middleware
|
45
|
+
- ✅ **SQLAlchemy Support** - Database management with async support and migrations
|
46
|
+
- ✅ **Lightweight** - No unnecessary dependencies
|
47
|
+
|
48
|
+
## Installation
|
49
|
+
|
50
|
+
```bash
|
51
|
+
pip install vega-framework
|
52
|
+
```
|
53
|
+
|
54
|
+
## Quick Start
|
55
|
+
|
56
|
+
```bash
|
57
|
+
# Create new project
|
58
|
+
vega init my-app
|
59
|
+
|
60
|
+
# Generate components
|
61
|
+
vega generate entity User
|
62
|
+
vega generate repository UserRepository
|
63
|
+
vega generate interactor CreateUser
|
64
|
+
|
65
|
+
# Create FastAPI project
|
66
|
+
vega init my-api --template fastapi
|
67
|
+
```
|
68
|
+
|
69
|
+
## CLI Commands
|
70
|
+
|
71
|
+
Vega Framework provides a comprehensive CLI for scaffolding and managing Clean Architecture projects.
|
72
|
+
|
73
|
+
### Project Management
|
74
|
+
|
75
|
+
#### `vega init` - Initialize New Project
|
76
|
+
|
77
|
+
Create a new Vega project with Clean Architecture structure.
|
78
|
+
|
79
|
+
```bash
|
80
|
+
vega init <project_name> [OPTIONS]
|
81
|
+
```
|
82
|
+
|
83
|
+
**Options:**
|
84
|
+
- `--template <type>` - Project template (default: `basic`)
|
85
|
+
- `basic` - Standard Clean Architecture project with CLI support
|
86
|
+
- `fastapi` - Project with FastAPI web scaffold included
|
87
|
+
- `ai-rag` - AI/RAG application template (coming soon)
|
88
|
+
- `--path <directory>` - Parent directory for project (default: current directory)
|
89
|
+
|
90
|
+
**Examples:**
|
91
|
+
```bash
|
92
|
+
vega init my-app
|
93
|
+
vega init my-api --template fastapi
|
94
|
+
vega init my-ai --template ai-rag --path ./projects
|
95
|
+
```
|
96
|
+
|
97
|
+
**Creates:**
|
98
|
+
- `domain/` - Entities, repositories, services, interactors
|
99
|
+
- `application/` - Mediators and workflows
|
100
|
+
- `infrastructure/` - Repository and service implementations
|
101
|
+
- `presentation/` - CLI and web interfaces
|
102
|
+
- `config.py` - DI container configuration
|
103
|
+
- `settings.py` - Application settings
|
104
|
+
- `pyproject.toml` - Dependencies and project metadata
|
105
|
+
|
106
|
+
---
|
107
|
+
|
108
|
+
#### `vega doctor` - Validate Project
|
109
|
+
|
110
|
+
Validate your Vega project structure and architecture compliance.
|
111
|
+
|
112
|
+
```bash
|
113
|
+
vega doctor [--path .]
|
114
|
+
```
|
115
|
+
|
116
|
+
**Options:**
|
117
|
+
- `--path <directory>` - Project path to validate (default: current directory)
|
118
|
+
|
119
|
+
**Checks:**
|
120
|
+
- Correct folder structure
|
121
|
+
- DI container configuration
|
122
|
+
- Import dependencies
|
123
|
+
- Architecture violations
|
124
|
+
|
125
|
+
**Example:**
|
126
|
+
```bash
|
127
|
+
vega doctor
|
128
|
+
vega doctor --path ./my-app
|
129
|
+
```
|
130
|
+
|
131
|
+
---
|
132
|
+
|
133
|
+
#### `vega update` - Update Framework
|
134
|
+
|
135
|
+
Update Vega Framework to the latest version.
|
136
|
+
|
137
|
+
```bash
|
138
|
+
vega update [OPTIONS]
|
139
|
+
```
|
140
|
+
|
141
|
+
**Options:**
|
142
|
+
- `--check` - Check for updates without installing
|
143
|
+
- `--force` - Force reinstall even if up to date
|
144
|
+
|
145
|
+
**Examples:**
|
146
|
+
```bash
|
147
|
+
vega update # Update to latest version
|
148
|
+
vega update --check # Check for updates only
|
149
|
+
vega update --force # Force reinstall
|
150
|
+
```
|
151
|
+
|
152
|
+
---
|
153
|
+
|
154
|
+
### Code Generation
|
155
|
+
|
156
|
+
#### `vega generate` - Generate Components
|
157
|
+
|
158
|
+
Generate Clean Architecture components in your project.
|
159
|
+
|
160
|
+
```bash
|
161
|
+
vega generate <component_type> <name> [OPTIONS]
|
162
|
+
```
|
163
|
+
|
164
|
+
**Component Types:**
|
165
|
+
|
166
|
+
##### Domain Layer
|
167
|
+
|
168
|
+
**`entity`** - Domain Entity (dataclass)
|
169
|
+
```bash
|
170
|
+
vega generate entity Product
|
171
|
+
```
|
172
|
+
Creates a domain entity in `domain/entities/`
|
173
|
+
|
174
|
+
**`repository`** - Repository Interface
|
175
|
+
```bash
|
176
|
+
vega generate repository ProductRepository
|
177
|
+
vega generate repository Product --impl memory # With in-memory implementation
|
178
|
+
vega generate repository Product --impl sql # With SQL implementation
|
179
|
+
```
|
180
|
+
Creates repository interface in `domain/repositories/` and optionally an implementation in `infrastructure/repositories/`
|
181
|
+
|
182
|
+
**Alias:** `repo` can be used instead of `repository`
|
183
|
+
|
184
|
+
**`service`** - Service Interface
|
185
|
+
```bash
|
186
|
+
vega generate service EmailService
|
187
|
+
vega generate service Email --impl smtp # With SMTP implementation
|
188
|
+
```
|
189
|
+
Creates service interface in `domain/services/` and optionally an implementation in `infrastructure/services/`
|
190
|
+
|
191
|
+
**`interactor`** - Use Case / Interactor
|
192
|
+
```bash
|
193
|
+
vega generate interactor CreateProduct
|
194
|
+
vega generate interactor GetUserById
|
195
|
+
```
|
196
|
+
Creates interactor (use case) in `domain/interactors/`
|
197
|
+
|
198
|
+
##### Application Layer
|
199
|
+
|
200
|
+
**`mediator`** - Workflow / Mediator
|
201
|
+
```bash
|
202
|
+
vega generate mediator CheckoutFlow
|
203
|
+
vega generate mediator OrderProcessing
|
204
|
+
```
|
205
|
+
Creates mediator (workflow orchestrator) in `application/mediators/`
|
206
|
+
|
207
|
+
##### Infrastructure Layer
|
208
|
+
|
209
|
+
**`model`** - SQLAlchemy Model *(requires SQLAlchemy)*
|
210
|
+
```bash
|
211
|
+
vega generate model User
|
212
|
+
vega generate model ProductCategory
|
213
|
+
```
|
214
|
+
Creates SQLAlchemy model in `infrastructure/models/` and registers it in Alembic
|
215
|
+
|
216
|
+
##### Presentation Layer
|
217
|
+
|
218
|
+
**`router`** - FastAPI Router *(requires FastAPI)*
|
219
|
+
```bash
|
220
|
+
vega generate router Product
|
221
|
+
vega generate router User
|
222
|
+
```
|
223
|
+
Creates FastAPI router in `presentation/web/routes/` and auto-registers it
|
224
|
+
|
225
|
+
**`middleware`** - FastAPI Middleware *(requires FastAPI)*
|
226
|
+
```bash
|
227
|
+
vega generate middleware Logging
|
228
|
+
vega generate middleware Authentication
|
229
|
+
```
|
230
|
+
Creates FastAPI middleware in `presentation/web/middleware/` and auto-registers it
|
231
|
+
|
232
|
+
**`command`** - CLI Command
|
233
|
+
```bash
|
234
|
+
vega generate command CreateUser # Async command (default)
|
235
|
+
vega generate command ListUsers --impl sync # Synchronous command
|
236
|
+
```
|
237
|
+
Creates CLI command in `presentation/cli/commands/`
|
238
|
+
|
239
|
+
The generator will prompt for:
|
240
|
+
- Command description
|
241
|
+
- Options and arguments
|
242
|
+
- Whether it will use interactors
|
243
|
+
|
244
|
+
**Options:**
|
245
|
+
- `--path <directory>` - Project root path (default: current directory)
|
246
|
+
- `--impl <type>` - Generate infrastructure implementation
|
247
|
+
- For `repository`: `memory`, `sql`, or custom name
|
248
|
+
- For `service`: custom implementation name
|
249
|
+
- For `command`: `sync` or `async` (default: async)
|
250
|
+
|
251
|
+
**Examples:**
|
252
|
+
```bash
|
253
|
+
# Domain layer
|
254
|
+
vega generate entity Product
|
255
|
+
vega generate repository ProductRepository --impl memory
|
256
|
+
vega generate service EmailService --impl smtp
|
257
|
+
vega generate interactor CreateProduct
|
258
|
+
|
259
|
+
# Application layer
|
260
|
+
vega generate mediator CheckoutFlow
|
261
|
+
|
262
|
+
# Presentation layer (web)
|
263
|
+
vega generate router Product
|
264
|
+
vega generate middleware Logging
|
265
|
+
|
266
|
+
# Presentation layer (CLI)
|
267
|
+
vega generate command CreateUser
|
268
|
+
vega generate command ListUsers --impl sync
|
269
|
+
|
270
|
+
# Infrastructure layer
|
271
|
+
vega generate model User
|
272
|
+
```
|
273
|
+
|
274
|
+
---
|
275
|
+
|
276
|
+
### Feature Management
|
277
|
+
|
278
|
+
#### `vega add` - Add Features to Project
|
279
|
+
|
280
|
+
Add additional features to an existing Vega project.
|
281
|
+
|
282
|
+
```bash
|
283
|
+
vega add <feature> [OPTIONS]
|
284
|
+
```
|
285
|
+
|
286
|
+
**Features:**
|
287
|
+
|
288
|
+
**`web`** - Add FastAPI Web Scaffold
|
289
|
+
```bash
|
290
|
+
vega add web
|
291
|
+
```
|
292
|
+
Adds FastAPI web scaffold to your project:
|
293
|
+
- `presentation/web/` - Web application structure
|
294
|
+
- `presentation/web/routes/` - API routes
|
295
|
+
- `presentation/web/middleware/` - Middleware components
|
296
|
+
- `presentation/web/app.py` - FastAPI app factory
|
297
|
+
|
298
|
+
**`sqlalchemy` / `db`** - Add SQLAlchemy Database Support
|
299
|
+
```bash
|
300
|
+
vega add sqlalchemy
|
301
|
+
vega add db # Alias
|
302
|
+
```
|
303
|
+
Adds SQLAlchemy database support:
|
304
|
+
- `infrastructure/database_manager.py` - Database connection manager
|
305
|
+
- `infrastructure/models/` - SQLAlchemy models directory
|
306
|
+
- `alembic/` - Database migration system
|
307
|
+
- `alembic.ini` - Alembic configuration
|
308
|
+
|
309
|
+
**Options:**
|
310
|
+
- `--path <directory>` - Path to Vega project (default: current directory)
|
311
|
+
|
312
|
+
**Examples:**
|
313
|
+
```bash
|
314
|
+
vega add web
|
315
|
+
vega add sqlalchemy
|
316
|
+
vega add db --path ./my-project
|
317
|
+
```
|
318
|
+
|
319
|
+
---
|
320
|
+
|
321
|
+
### Database Management
|
322
|
+
|
323
|
+
#### `vega migrate` - Database Migration Commands
|
324
|
+
|
325
|
+
Manage database schema migrations with Alembic *(requires SQLAlchemy)*.
|
326
|
+
|
327
|
+
**`init`** - Initialize Database
|
328
|
+
```bash
|
329
|
+
vega migrate init
|
330
|
+
```
|
331
|
+
Creates all database tables based on current models. Use this for initial setup.
|
332
|
+
|
333
|
+
**`create`** - Create New Migration
|
334
|
+
```bash
|
335
|
+
vega migrate create -m "migration message"
|
336
|
+
```
|
337
|
+
Generates a new migration file by auto-detecting model changes.
|
338
|
+
|
339
|
+
**Options:**
|
340
|
+
- `-m, --message <text>` - Migration description (required)
|
341
|
+
|
342
|
+
**`upgrade`** - Apply Migrations
|
343
|
+
```bash
|
344
|
+
vega migrate upgrade [--revision head]
|
345
|
+
```
|
346
|
+
Apply pending migrations to the database.
|
347
|
+
|
348
|
+
**Options:**
|
349
|
+
- `--revision <id>` - Target revision (default: `head` - latest)
|
350
|
+
|
351
|
+
**`downgrade`** - Rollback Migrations
|
352
|
+
```bash
|
353
|
+
vega migrate downgrade [--revision -1]
|
354
|
+
```
|
355
|
+
Rollback database migrations.
|
356
|
+
|
357
|
+
**Options:**
|
358
|
+
- `--revision <id>` - Target revision (default: `-1` - previous)
|
359
|
+
|
360
|
+
**`current`** - Show Current Revision
|
361
|
+
```bash
|
362
|
+
vega migrate current
|
363
|
+
```
|
364
|
+
Display the current database migration revision.
|
365
|
+
|
366
|
+
**`history`** - Show Migration History
|
367
|
+
```bash
|
368
|
+
vega migrate history
|
369
|
+
```
|
370
|
+
Display complete migration history with details.
|
371
|
+
|
372
|
+
**Examples:**
|
373
|
+
```bash
|
374
|
+
# Initialize database
|
375
|
+
vega migrate init
|
376
|
+
|
377
|
+
# Create migration after changing models
|
378
|
+
vega migrate create -m "Add user table"
|
379
|
+
vega migrate create -m "Add email field to users"
|
380
|
+
|
381
|
+
# Apply all pending migrations
|
382
|
+
vega migrate upgrade
|
383
|
+
|
384
|
+
# Apply migrations up to specific revision
|
385
|
+
vega migrate upgrade --revision abc123
|
386
|
+
|
387
|
+
# Rollback last migration
|
388
|
+
vega migrate downgrade
|
389
|
+
|
390
|
+
# Rollback to specific revision
|
391
|
+
vega migrate downgrade --revision xyz789
|
392
|
+
|
393
|
+
# Check current status
|
394
|
+
vega migrate current
|
395
|
+
|
396
|
+
# View history
|
397
|
+
vega migrate history
|
398
|
+
```
|
399
|
+
|
400
|
+
---
|
401
|
+
|
402
|
+
### Getting Help
|
403
|
+
|
404
|
+
**Show Version:**
|
405
|
+
```bash
|
406
|
+
vega --version
|
407
|
+
```
|
408
|
+
|
409
|
+
**Show Help:**
|
410
|
+
```bash
|
411
|
+
vega --help # Main help
|
412
|
+
vega <command> --help # Command-specific help
|
413
|
+
vega generate --help # Generate command help
|
414
|
+
vega migrate --help # Migrate command help
|
415
|
+
```
|
416
|
+
|
417
|
+
**Examples:**
|
418
|
+
```bash
|
419
|
+
vega init --help
|
420
|
+
vega generate --help
|
421
|
+
vega add --help
|
422
|
+
vega migrate upgrade --help
|
423
|
+
```
|
424
|
+
|
425
|
+
## Async CLI Commands
|
426
|
+
|
427
|
+
Vega provides seamless async/await support in CLI commands, allowing you to execute interactors directly.
|
428
|
+
|
429
|
+
### Generate a CLI Command
|
430
|
+
|
431
|
+
```bash
|
432
|
+
# Generate an async command (default)
|
433
|
+
vega generate command CreateUser
|
434
|
+
|
435
|
+
# Generate a synchronous command
|
436
|
+
vega generate command ListUsers --impl sync
|
437
|
+
```
|
438
|
+
|
439
|
+
The generator will prompt you for:
|
440
|
+
- Command description
|
441
|
+
- Options and arguments
|
442
|
+
- Whether it will use interactors
|
443
|
+
|
444
|
+
### Manual Command Example
|
445
|
+
|
446
|
+
```python
|
447
|
+
import click
|
448
|
+
from vega.cli.utils import async_command
|
449
|
+
|
450
|
+
@click.command()
|
451
|
+
@click.option('--name', required=True)
|
452
|
+
@async_command
|
453
|
+
async def create_user(name: str):
|
454
|
+
"""Create a user using an interactor"""
|
455
|
+
import config # Initialize DI container
|
456
|
+
from domain.interactors.create_user import CreateUser
|
457
|
+
|
458
|
+
user = await CreateUser(name=name)
|
459
|
+
click.echo(f"Created: {user.name}")
|
460
|
+
```
|
461
|
+
|
462
|
+
This enables the same async business logic to work in both CLI and web (FastAPI) contexts.
|
463
|
+
|
464
|
+
## Use Cases
|
465
|
+
|
466
|
+
Perfect for:
|
467
|
+
|
468
|
+
- AI/RAG applications
|
469
|
+
- E-commerce platforms
|
470
|
+
- Fintech systems
|
471
|
+
- Mobile backends
|
472
|
+
- Microservices
|
473
|
+
- CLI tools
|
474
|
+
- Any Python application requiring clean architecture
|
475
|
+
|
476
|
+
## License
|
477
|
+
|
478
|
+
MIT
|
479
|
+
|
480
|
+
## Contributing
|
481
|
+
|
482
|
+
Contributions welcome! This framework is extracted from production code and battle-tested.
|
483
|
+
|
@@ -11,8 +11,8 @@ vega/cli/scaffolds/__init__.py,sha256=WFJf2H_4UWL89gDxX8PXKkTVSVOfw7hFfyaPWKokp1
|
|
11
11
|
vega/cli/scaffolds/fastapi.py,sha256=dA1RRWuS2HjCRh5q8T-VEBU8r8C-IqRbNZW_SqTv1Wg,3760
|
12
12
|
vega/cli/scaffolds/sqlalchemy.py,sha256=il5JqiA8LSQKnNoOYfAFD82rdYx5l_ZsqsjHnplYohw,6164
|
13
13
|
vega/cli/templates/__init__.py,sha256=0-jsxHcM4IbJiiZXqszm1XiYRYVcHgOivXdq7jqxBrk,1720
|
14
|
-
vega/cli/templates/cli/command.py.j2,sha256=
|
15
|
-
vega/cli/templates/cli/command_simple.py.j2,sha256=
|
14
|
+
vega/cli/templates/cli/command.py.j2,sha256=HUVRBHzQJlgqg7IgregDpBJRd-g1t2S0uOgC6wwPtI4,1108
|
15
|
+
vega/cli/templates/cli/command_simple.py.j2,sha256=fXxVauGVlzofshenmMlsEfVLI9EAp7SFfPbbF_ayLBQ,542
|
16
16
|
vega/cli/templates/components.py,sha256=NvGJqjP2-EYy52YW8xihQOV0FHeWhqUEFKul5qe1XFY,7231
|
17
17
|
vega/cli/templates/domain/entity.py.j2,sha256=dl5rzuJMnTRqOdU5SYV2o_OPGy9l6DNf_symCcjdjK0,344
|
18
18
|
vega/cli/templates/domain/interactor.py.j2,sha256=Hv6whUyW67smjMRw_HuvC3_-q7g32dEUOFZdmi5xkrc,684
|
@@ -25,8 +25,8 @@ vega/cli/templates/infrastructure/service_impl.py.j2,sha256=AgP2oqMbbcd0ctVfiVyO
|
|
25
25
|
vega/cli/templates/loader.py,sha256=cyt9ZOVLwBgv4ijPxoqR4JgFSbdkXCMzviHcq3fdv8Q,2712
|
26
26
|
vega/cli/templates/project/.env.example,sha256=BqfRxYeOasgZMz4_B2kybu6areIy9dHCt5BJ6fa56ik,221
|
27
27
|
vega/cli/templates/project/.gitignore,sha256=7JSDihCtBznd-QxQ4wUtHM9fnbYnbw6PK4Auh56ofAY,229
|
28
|
-
vega/cli/templates/project/ARCHITECTURE.md.j2,sha256=
|
29
|
-
vega/cli/templates/project/README.md.j2,sha256=
|
28
|
+
vega/cli/templates/project/ARCHITECTURE.md.j2,sha256=P7NiaGDp3ekPP3Fn5mtlMUWf66qqAAFtZzcmYRXJKis,23737
|
29
|
+
vega/cli/templates/project/README.md.j2,sha256=Oea0AiDb_rm-GPsLFAPhYEpMmtHt_pqCRjrreymZj8Y,4601
|
30
30
|
vega/cli/templates/project/config.py.j2,sha256=1Iva9JEz5ej_WmTbRVBvOfSBhYUKIzN88p6GYKR0m4s,866
|
31
31
|
vega/cli/templates/project/main.py.j2,sha256=WhV5rm2K_jtXrSorChcgwWN7XraRoXwvfYOcQ852lM0,2387
|
32
32
|
vega/cli/templates/project/main_fastapi.py.j2,sha256=BRd91YwFbr4H5mBKYClO8NM2VGODh3xaGLdkfkGskUA,1980
|
@@ -64,8 +64,8 @@ vega/patterns/repository.py,sha256=uYUyLs-O8OqW1Wb9ZqIo8UUcCjZ5UFuHors_F2iDg9A,1
|
|
64
64
|
vega/patterns/service.py,sha256=buFRgJoeQtZQK22Upb4vh84c1elWKFXWBaB0X4RaruE,1374
|
65
65
|
vega/settings/__init__.py,sha256=Eb8PMUyXAlCAQIcL2W8QhTTUHUbVlkAfXdpTUlADo1I,786
|
66
66
|
vega/settings/base.py,sha256=bL45hyoa3t-hQOvur860eSo7O833sQMsXJJPwbTVbwE,1321
|
67
|
-
vega_framework-0.1.
|
68
|
-
vega_framework-0.1.
|
69
|
-
vega_framework-0.1.
|
70
|
-
vega_framework-0.1.
|
71
|
-
vega_framework-0.1.
|
67
|
+
vega_framework-0.1.18.dist-info/METADATA,sha256=fV4NIlBhT5TvAO91i_rWx1gg6mvAX_7vvzII9VSU2m4,12271
|
68
|
+
vega_framework-0.1.18.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
69
|
+
vega_framework-0.1.18.dist-info/entry_points.txt,sha256=p3gyTmPYjNRLbuiKS-hG3ytWd-ssBweFy6VZ-F9FTNk,42
|
70
|
+
vega_framework-0.1.18.dist-info/licenses/LICENSE,sha256=wlHh1MBTcs2kSQr99P30mZ61s7uh7Cp9Rk0YiJxots0,1084
|
71
|
+
vega_framework-0.1.18.dist-info/RECORD,,
|
@@ -1,200 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: vega-framework
|
3
|
-
Version: 0.1.16
|
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: jinja2 (>=3.1,<4.0)
|
23
|
-
Requires-Dist: pydantic (>=2.0,<3.0)
|
24
|
-
Requires-Dist: pydantic-settings (>=2.0,<3.0)
|
25
|
-
Requires-Dist: toml (>=0.10,<0.11)
|
26
|
-
Project-URL: Documentation, https://vega-framework.readthedocs.io
|
27
|
-
Project-URL: Homepage, https://github.com/RobyFerro/vega-framework
|
28
|
-
Project-URL: Repository, https://github.com/RobyFerro/vega-framework
|
29
|
-
Description-Content-Type: text/markdown
|
30
|
-
|
31
|
-
# Vega Framework
|
32
|
-
|
33
|
-
An enterprise-ready Python framework that enforces Clean Architecture for building maintainable and scalable applications.
|
34
|
-
|
35
|
-
## Features
|
36
|
-
|
37
|
-
- ✅ **Automatic Dependency Injection** - Zero boilerplate, type-safe DI
|
38
|
-
- ✅ **Clean Architecture Patterns** - Interactor, Mediator, Repository, Service
|
39
|
-
- ✅ **Async/Await Support** - Full async support for CLI and web
|
40
|
-
- ✅ **Scope Management** - Singleton, Scoped, Transient lifetimes
|
41
|
-
- ✅ **Type-Safe** - Full type hints support
|
42
|
-
- ✅ **Framework-Agnostic** - Works with any domain (web, AI, IoT, fintech, etc.)
|
43
|
-
- ✅ **CLI Scaffolding** - Generate projects and components instantly
|
44
|
-
- ✅ **FastAPI Integration** - Built-in web scaffold with routing and middleware
|
45
|
-
- ✅ **SQLAlchemy Support** - Database management with async support and migrations
|
46
|
-
- ✅ **Lightweight** - No unnecessary dependencies
|
47
|
-
|
48
|
-
## Installation
|
49
|
-
|
50
|
-
```bash
|
51
|
-
pip install vega-framework
|
52
|
-
```
|
53
|
-
|
54
|
-
## Quick Start
|
55
|
-
|
56
|
-
```bash
|
57
|
-
# Create new project
|
58
|
-
vega init my-app
|
59
|
-
|
60
|
-
# Generate components
|
61
|
-
vega generate entity User
|
62
|
-
vega generate repository UserRepository
|
63
|
-
vega generate interactor CreateUser
|
64
|
-
|
65
|
-
# Create FastAPI project
|
66
|
-
vega init my-api --template fastapi
|
67
|
-
```
|
68
|
-
|
69
|
-
## CLI Commands
|
70
|
-
|
71
|
-
### Initialize Project
|
72
|
-
|
73
|
-
```bash
|
74
|
-
vega init <project_name> [--template basic|fastapi|ai-rag] [--path .]
|
75
|
-
```
|
76
|
-
|
77
|
-
Creates a new Vega project with Clean Architecture structure:
|
78
|
-
|
79
|
-
- `domain/` - Entities, repositories, services, interactors
|
80
|
-
- `application/` - Mediators and workflows
|
81
|
-
- `infrastructure/` - Repository and service implementations
|
82
|
-
- `config.py` - DI container setup
|
83
|
-
- `settings.py` - Application configuration
|
84
|
-
|
85
|
-
### Generate Components
|
86
|
-
|
87
|
-
```bash
|
88
|
-
vega generate entity <Name>
|
89
|
-
vega generate repository <Name> [--impl memory|sql]
|
90
|
-
vega generate service <Name>
|
91
|
-
vega generate interactor <Name>
|
92
|
-
vega generate mediator <Name>
|
93
|
-
vega generate router <Name> # Requires FastAPI
|
94
|
-
vega generate middleware <Name> # Requires FastAPI
|
95
|
-
vega generate model <Name> # Requires SQLAlchemy
|
96
|
-
vega generate command <Name> # CLI command (async by default)
|
97
|
-
vega generate command <Name> --impl sync # Synchronous CLI command
|
98
|
-
```
|
99
|
-
|
100
|
-
### Add Features
|
101
|
-
|
102
|
-
```bash
|
103
|
-
# Add FastAPI web scaffold
|
104
|
-
vega add web
|
105
|
-
|
106
|
-
# Add SQLAlchemy database support
|
107
|
-
vega add sqlalchemy
|
108
|
-
# or
|
109
|
-
vega add db
|
110
|
-
```
|
111
|
-
|
112
|
-
### Database Migrations (SQLAlchemy)
|
113
|
-
|
114
|
-
```bash
|
115
|
-
# Initialize database
|
116
|
-
vega migrate init
|
117
|
-
|
118
|
-
# Create a new migration
|
119
|
-
vega migrate create -m "migration message"
|
120
|
-
|
121
|
-
# Apply migrations
|
122
|
-
vega migrate upgrade [--revision head]
|
123
|
-
|
124
|
-
# Rollback migrations
|
125
|
-
vega migrate downgrade [--revision -1]
|
126
|
-
|
127
|
-
# Show current revision
|
128
|
-
vega migrate current
|
129
|
-
|
130
|
-
# Show migration history
|
131
|
-
vega migrate history
|
132
|
-
```
|
133
|
-
|
134
|
-
### Validate Project
|
135
|
-
|
136
|
-
```bash
|
137
|
-
vega doctor [--path .]
|
138
|
-
```
|
139
|
-
|
140
|
-
Validates project structure, DI configuration, and architecture compliance.
|
141
|
-
|
142
|
-
## Async CLI Commands
|
143
|
-
|
144
|
-
Vega provides seamless async/await support in CLI commands, allowing you to execute interactors directly.
|
145
|
-
|
146
|
-
### Generate a CLI Command
|
147
|
-
|
148
|
-
```bash
|
149
|
-
# Generate an async command (default)
|
150
|
-
vega generate command CreateUser
|
151
|
-
|
152
|
-
# Generate a synchronous command
|
153
|
-
vega generate command ListUsers --impl sync
|
154
|
-
```
|
155
|
-
|
156
|
-
The generator will prompt you for:
|
157
|
-
- Command description
|
158
|
-
- Options and arguments
|
159
|
-
- Whether it will use interactors
|
160
|
-
|
161
|
-
### Manual Command Example
|
162
|
-
|
163
|
-
```python
|
164
|
-
import click
|
165
|
-
from vega.cli.utils import async_command
|
166
|
-
|
167
|
-
@click.command()
|
168
|
-
@click.option('--name', required=True)
|
169
|
-
@async_command
|
170
|
-
async def create_user(name: str):
|
171
|
-
"""Create a user using an interactor"""
|
172
|
-
import config # Initialize DI container
|
173
|
-
from domain.interactors.create_user import CreateUser
|
174
|
-
|
175
|
-
user = await CreateUser(name=name)
|
176
|
-
click.echo(f"Created: {user.name}")
|
177
|
-
```
|
178
|
-
|
179
|
-
This enables the same async business logic to work in both CLI and web (FastAPI) contexts.
|
180
|
-
|
181
|
-
## Use Cases
|
182
|
-
|
183
|
-
Perfect for:
|
184
|
-
|
185
|
-
- AI/RAG applications
|
186
|
-
- E-commerce platforms
|
187
|
-
- Fintech systems
|
188
|
-
- Mobile backends
|
189
|
-
- Microservices
|
190
|
-
- CLI tools
|
191
|
-
- Any Python application requiring clean architecture
|
192
|
-
|
193
|
-
## License
|
194
|
-
|
195
|
-
MIT
|
196
|
-
|
197
|
-
## Contributing
|
198
|
-
|
199
|
-
Contributions welcome! This framework is extracted from production code and battle-tested.
|
200
|
-
|
File without changes
|
File without changes
|
File without changes
|