vega-framework 0.1.29__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.
@@ -1,485 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: vega-framework
3
- Version: 0.1.29
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
-