vega-framework 0.1.16__tar.gz → 0.1.17__tar.gz
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.17/PKG-INFO +483 -0
- vega_framework-0.1.17/README.md +452 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/pyproject.toml +1 -1
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/project/ARCHITECTURE.md.j2 +226 -0
- vega_framework-0.1.17/vega/cli/templates/project/README.md.j2 +188 -0
- vega_framework-0.1.16/PKG-INFO +0 -200
- vega_framework-0.1.16/README.md +0 -169
- vega_framework-0.1.16/vega/cli/templates/project/README.md.j2 +0 -91
- {vega_framework-0.1.16 → vega_framework-0.1.17}/LICENSE +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/__init__.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/__init__.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/commands/__init__.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/commands/add.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/commands/generate.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/commands/init.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/commands/migrate.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/commands/update.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/main.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/scaffolds/__init__.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/scaffolds/fastapi.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/scaffolds/sqlalchemy.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/__init__.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/cli/command.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/cli/command_simple.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/components.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/domain/entity.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/domain/interactor.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/domain/mediator.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/domain/repository_interface.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/domain/service_interface.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/infrastructure/model.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/infrastructure/repository_impl.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/infrastructure/service_impl.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/loader.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/project/.env.example +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/project/.gitignore +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/project/config.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/project/main.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/project/main_fastapi.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/project/main_standard.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/project/pyproject.toml.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/project/settings.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/sqlalchemy/alembic.ini.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/sqlalchemy/database_manager.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/sqlalchemy/env.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/sqlalchemy/script.py.mako +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/web/__init__.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/web/app.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/web/health_route.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/web/main.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/web/middleware.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/web/models_init.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/web/router.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/web/routes_init.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/web/user_models.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/templates/web/users_route.py.j2 +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/utils/__init__.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/utils/async_support.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/utils/messages.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/utils/naming.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/cli/utils/validators.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/di/__init__.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/di/container.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/di/decorators.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/di/errors.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/di/scope.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/patterns/__init__.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/patterns/interactor.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/patterns/mediator.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/patterns/repository.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/patterns/service.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/settings/__init__.py +0 -0
- {vega_framework-0.1.16 → vega_framework-0.1.17}/vega/settings/base.py +0 -0
@@ -0,0 +1,483 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: vega-framework
|
3
|
+
Version: 0.1.17
|
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
|
+
|