vega-framework 0.1.30__tar.gz → 0.1.32__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.
Files changed (91) hide show
  1. vega_framework-0.1.32/PKG-INFO +349 -0
  2. vega_framework-0.1.32/README.md +316 -0
  3. {vega_framework-0.1.30 → vega_framework-0.1.32}/pyproject.toml +1 -1
  4. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/commands/generate.py +3 -3
  5. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/scaffolds/fastapi.py +0 -23
  6. vega_framework-0.1.30/PKG-INFO +0 -485
  7. vega_framework-0.1.30/README.md +0 -452
  8. {vega_framework-0.1.30 → vega_framework-0.1.32}/LICENSE +0 -0
  9. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/__init__.py +0 -0
  10. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/__init__.py +0 -0
  11. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/commands/__init__.py +0 -0
  12. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/commands/add.py +0 -0
  13. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/commands/init.py +0 -0
  14. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/commands/migrate.py +0 -0
  15. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/commands/update.py +0 -0
  16. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/commands/web.py +0 -0
  17. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/main.py +0 -0
  18. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/scaffolds/__init__.py +0 -0
  19. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/scaffolds/sqlalchemy.py +0 -0
  20. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/__init__.py +0 -0
  21. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/cli/command.py.j2 +0 -0
  22. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/cli/command_simple.py.j2 +0 -0
  23. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/cli/commands_init.py.j2 +0 -0
  24. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/components.py +0 -0
  25. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/domain/entity.py.j2 +0 -0
  26. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/domain/event.py.j2 +0 -0
  27. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/domain/event_handler.py.j2 +0 -0
  28. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/domain/interactor.py.j2 +0 -0
  29. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/domain/mediator.py.j2 +0 -0
  30. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/domain/repository_interface.py.j2 +0 -0
  31. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/domain/service_interface.py.j2 +0 -0
  32. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/infrastructure/model.py.j2 +0 -0
  33. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/infrastructure/repository_impl.py.j2 +0 -0
  34. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/infrastructure/service_impl.py.j2 +0 -0
  35. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/loader.py +0 -0
  36. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/project/.env.example +0 -0
  37. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/project/.gitignore +0 -0
  38. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/project/ARCHITECTURE.md.j2 +0 -0
  39. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/project/README.md.j2 +0 -0
  40. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/project/config.py.j2 +0 -0
  41. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/project/events_init.py.j2 +0 -0
  42. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/project/main.py.j2 +0 -0
  43. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/project/main_fastapi.py.j2 +0 -0
  44. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/project/main_standard.py.j2 +0 -0
  45. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/project/pyproject.toml.j2 +0 -0
  46. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/project/settings.py.j2 +0 -0
  47. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/sqlalchemy/alembic.ini.j2 +0 -0
  48. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/sqlalchemy/database_manager.py.j2 +0 -0
  49. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/sqlalchemy/env.py.j2 +0 -0
  50. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/sqlalchemy/script.py.mako +0 -0
  51. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/web/__init__.py.j2 +0 -0
  52. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/web/app.py.j2 +0 -0
  53. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/web/health_route.py.j2 +0 -0
  54. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/web/main.py.j2 +0 -0
  55. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/web/middleware.py.j2 +0 -0
  56. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/web/models_init.py.j2 +0 -0
  57. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/web/request_model.py.j2 +0 -0
  58. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/web/response_model.py.j2 +0 -0
  59. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/web/router.py.j2 +0 -0
  60. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/web/routes_init.py.j2 +0 -0
  61. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/web/routes_init_autodiscovery.py.j2 +0 -0
  62. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/web/user_models.py.j2 +0 -0
  63. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/templates/web/users_route.py.j2 +0 -0
  64. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/utils/__init__.py +0 -0
  65. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/utils/async_support.py +0 -0
  66. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/utils/messages.py +0 -0
  67. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/utils/naming.py +0 -0
  68. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/cli/utils/validators.py +0 -0
  69. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/di/__init__.py +0 -0
  70. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/di/container.py +0 -0
  71. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/di/decorators.py +0 -0
  72. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/di/errors.py +0 -0
  73. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/di/scope.py +0 -0
  74. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/discovery/__init__.py +0 -0
  75. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/discovery/commands.py +0 -0
  76. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/discovery/events.py +0 -0
  77. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/discovery/routes.py +0 -0
  78. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/events/README.md +0 -0
  79. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/events/SYNTAX_GUIDE.md +0 -0
  80. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/events/__init__.py +0 -0
  81. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/events/bus.py +0 -0
  82. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/events/decorators.py +0 -0
  83. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/events/event.py +0 -0
  84. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/events/middleware.py +0 -0
  85. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/patterns/__init__.py +0 -0
  86. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/patterns/interactor.py +0 -0
  87. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/patterns/mediator.py +0 -0
  88. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/patterns/repository.py +0 -0
  89. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/patterns/service.py +0 -0
  90. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/settings/__init__.py +0 -0
  91. {vega_framework-0.1.30 → vega_framework-0.1.32}/vega/settings/base.py +0 -0
@@ -0,0 +1,349 @@
1
+ Metadata-Version: 2.4
2
+ Name: vega-framework
3
+ Version: 0.1.32
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
+
@@ -0,0 +1,316 @@
1
+ # Vega Framework
2
+
3
+ An enterprise-ready Python framework that enforces Clean Architecture for building maintainable and scalable applications.
4
+
5
+ ## Why Vega?
6
+
7
+ Traditional Python frameworks show you **how to build** but don't enforce **how to architect**. Vega provides:
8
+
9
+ - ✅ **Clean Architecture** - Enforced separation of concerns
10
+ - ✅ **Dependency Injection** - Zero boilerplate, type-safe DI
11
+ - ✅ **Business Logic First** - Pure, testable, framework-independent
12
+ - ✅ **CLI Scaffolding** - Generate entire projects and components
13
+ - ✅ **Async Support** - Full async/await for CLI and web
14
+ - ✅ **FastAPI & SQLAlchemy** - Built-in integrations when needed
15
+
16
+ **[Read the Philosophy →](docs/explanation/philosophy.md)** to understand why architecture matters.
17
+
18
+ ## Quick Start
19
+
20
+ ### Installation
21
+
22
+ ```bash
23
+ pip install vega-framework
24
+ ```
25
+
26
+ ### Create Your First Project
27
+
28
+ ```bash
29
+ # Create project
30
+ vega init my-app
31
+ cd my-app
32
+
33
+ # Install dependencies
34
+ poetry install
35
+
36
+ # Generate components
37
+ vega generate entity User
38
+ vega generate repository UserRepository --impl memory
39
+ vega generate interactor CreateUser
40
+
41
+ # Run your app
42
+ poetry run python main.py
43
+ ```
44
+
45
+ ### Your First Use Case
46
+
47
+ ```python
48
+ # domain/interactors/create_user.py
49
+ from vega.patterns import Interactor
50
+ from vega.di import bind
51
+
52
+ class CreateUser(Interactor[User]):
53
+ def __init__(self, name: str, email: str):
54
+ self.name = name
55
+ self.email = email
56
+
57
+ @bind
58
+ async def call(self, repository: UserRepository) -> User:
59
+ # Pure business logic - no framework code!
60
+ user = User(name=self.name, email=self.email)
61
+ return await repository.save(user)
62
+
63
+ # Usage - clean and simple
64
+ user = await CreateUser(name="John", email="john@example.com")
65
+ ```
66
+
67
+ **[See Full Quick Start →](docs/tutorials/quickstart.md)**
68
+
69
+ ## Key Concepts
70
+
71
+ ### Clean Architecture Layers
72
+
73
+ ```
74
+ ┌─────────────────────────────────────┐
75
+ │ Presentation (CLI, Web) │ User interfaces
76
+ ├─────────────────────────────────────┤
77
+ │ Application (Workflows) │ Multi-step operations
78
+ ├─────────────────────────────────────┤
79
+ │ Domain (Business Logic) │ Core business rules
80
+ ├─────────────────────────────────────┤
81
+ │ Infrastructure (Technical) │ Databases, APIs
82
+ └─────────────────────────────────────┘
83
+ ```
84
+
85
+ **[Learn Clean Architecture →](docs/explanation/architecture/clean-architecture.md)**
86
+
87
+ ### Core Patterns
88
+
89
+ - **[Interactor](docs/explanation/patterns/interactor.md)** - Single-purpose use case
90
+ - **[Mediator](docs/explanation/patterns/mediator.md)** - Complex workflow orchestration
91
+ - **[Repository](docs/explanation/patterns/repository.md)** - Data persistence abstraction
92
+ - **[Service](docs/explanation/patterns/service.md)** - External service abstraction
93
+
94
+ ### Dependency Injection
95
+
96
+ ```python
97
+ # Define what you need (domain)
98
+ class UserRepository(Repository[User]):
99
+ async def save(self, user: User) -> User:
100
+ pass
101
+
102
+ # Implement how it works (infrastructure)
103
+ @injectable(scope=Scope.SINGLETON)
104
+ class PostgresUserRepository(UserRepository):
105
+ async def save(self, user: User) -> User:
106
+ # PostgreSQL implementation
107
+ pass
108
+
109
+ # Wire it together (config)
110
+ container = Container({
111
+ UserRepository: PostgresUserRepository
112
+ })
113
+ ```
114
+
115
+ **[Learn Dependency Injection →](docs/explanation/core/dependency-injection.md)**
116
+
117
+ ## CLI Commands
118
+
119
+ ### Project Management
120
+
121
+ ```bash
122
+ vega init my-app # Create new project
123
+ vega init my-api --template fastapi # Create with FastAPI
124
+ vega doctor # Validate architecture
125
+ vega update # Update framework
126
+ ```
127
+
128
+ ### Code Generation
129
+
130
+ ```bash
131
+ # Domain layer
132
+ vega generate entity Product
133
+ vega generate repository ProductRepository --impl sql
134
+ vega generate interactor CreateProduct
135
+
136
+ # Application layer
137
+ vega generate mediator CheckoutWorkflow
138
+
139
+ # Presentation layer
140
+ vega generate router Product # FastAPI (requires: vega add web)
141
+ vega generate command create-product # CLI
142
+
143
+ # Infrastructure
144
+ vega generate model Product # SQLAlchemy (requires: vega add db)
145
+ ```
146
+
147
+ ### Add Features
148
+
149
+ ```bash
150
+ vega add web # Add FastAPI web support
151
+ vega add sqlalchemy # Add database support
152
+ ```
153
+
154
+ ### Database Migrations
155
+
156
+ ```bash
157
+ vega migrate init # Initialize database
158
+ vega migrate create -m "add users" # Create migration
159
+ vega migrate upgrade # Apply migrations
160
+ vega migrate downgrade # Rollback
161
+ ```
162
+
163
+ **[See All CLI Commands →](docs/reference/cli/overview.md)**
164
+
165
+ ## Event System
166
+
167
+ Built-in event-driven architecture support:
168
+
169
+ ```python
170
+ from vega.events import Event, subscribe
171
+
172
+ # Define event
173
+ @dataclass(frozen=True)
174
+ class UserCreated(Event):
175
+ user_id: str
176
+ email: str
177
+
178
+ # Subscribe to event
179
+ @subscribe(UserCreated)
180
+ async def send_welcome_email(event: UserCreated):
181
+ await email_service.send(event.email, "Welcome!")
182
+
183
+ # Publish event
184
+ await UserCreated(user_id="123", email="test@test.com").publish()
185
+ ```
186
+
187
+ **[Learn Event System →](docs/explanation/events/overview.md)**
188
+
189
+ ## Documentation
190
+
191
+ ### Getting Started
192
+ - [Installation](docs/how-to/install.md)
193
+ - [Quick Start](docs/tutorials/quickstart.md)
194
+ - [Project Structure](docs/explanation/project-structure.md)
195
+
196
+ ### Core Concepts
197
+ - [Philosophy](docs/explanation/philosophy.md) - Why Vega exists
198
+ - [Clean Architecture](docs/explanation/architecture/clean-architecture.md) - Architecture principles
199
+ - [Dependency Injection](docs/explanation/core/dependency-injection.md) - DI system
200
+ - [Patterns](docs/explanation/patterns/interactor.md) - Interactor, Mediator, Repository, Service
201
+
202
+ ### Guides
203
+ - [Building Domain Layer](docs/how-to/build-domain-layer.md) - Business logic first
204
+ - [CLI Reference](docs/reference/cli/overview.md) - All CLI commands
205
+ - [Events System](docs/explanation/events/overview.md) - Event-driven architecture
206
+
207
+ ### Reference
208
+ - [Changelog](docs/reference/CHANGELOG.md)
209
+ - [Roadmap](docs/reference/ROADMAP.md)
210
+
211
+ **[Browse All Documentation →](docs/README.md)**
212
+
213
+ ## Perfect For
214
+
215
+ - E-commerce platforms
216
+ - Financial systems
217
+ - Enterprise SaaS applications
218
+ - AI/RAG applications
219
+ - Complex workflow systems
220
+ - Multi-tenant applications
221
+ - Any project requiring clean architecture
222
+
223
+ ## Example Project
224
+
225
+ ```
226
+ my-app/
227
+ ├── domain/ # Business logic
228
+ │ ├── entities/ # Business objects
229
+ │ ├── repositories/ # Data interfaces
230
+ │ ├── services/ # External service interfaces
231
+ │ └── interactors/ # Use cases
232
+ ├── application/ # Workflows
233
+ │ └── mediators/ # Complex orchestrations
234
+ ├── infrastructure/ # Implementations
235
+ │ ├── repositories/ # Database code
236
+ │ └── services/ # API integrations
237
+ ├── presentation/ # User interfaces
238
+ │ ├── cli/ # CLI commands
239
+ │ └── web/ # FastAPI routes
240
+ ├── config.py # Dependency injection
241
+ ├── settings.py # Configuration
242
+ └── main.py # Entry point
243
+ ```
244
+
245
+ ## Why Clean Architecture?
246
+
247
+ **Without Vega:**
248
+ ```python
249
+ # ❌ Business logic mixed with framework code
250
+ @app.post("/orders")
251
+ async def create_order(request: Request):
252
+ data = await request.json()
253
+ order = OrderModel(**data) # SQLAlchemy
254
+ session.add(order)
255
+ stripe.Charge.create(...) # Stripe
256
+ return {"id": order.id}
257
+ ```
258
+
259
+ **Problems:**
260
+ - Can't test without FastAPI, database, and Stripe
261
+ - Can't reuse for CLI or other interfaces
262
+ - Business rules are unclear
263
+ - Tightly coupled to specific technologies
264
+
265
+ **With Vega:**
266
+ ```python
267
+ # ✅ Pure business logic (Domain)
268
+ class PlaceOrder(Interactor[Order]):
269
+ @bind
270
+ async def call(
271
+ self,
272
+ order_repo: OrderRepository,
273
+ payment_service: PaymentService
274
+ ) -> Order:
275
+ # Pure business logic - testable, reusable
276
+ order = Order(...)
277
+ await payment_service.charge(...)
278
+ return await order_repo.save(order)
279
+
280
+ # ✅ FastAPI route (Presentation) - just wiring
281
+ @router.post("/orders")
282
+ async def create_order_api(request: CreateOrderRequest):
283
+ return await PlaceOrder(...)
284
+
285
+ # ✅ CLI command (Presentation) - same logic
286
+ @click.command()
287
+ async def create_order_cli(...):
288
+ return await PlaceOrder(...)
289
+ ```
290
+
291
+ **Benefits:**
292
+ - ✅ Test business logic without any infrastructure
293
+ - ✅ Same logic works for Web, CLI, GraphQL, etc.
294
+ - ✅ Swap databases without changing business code
295
+ - ✅ Clear business rules and operations
296
+
297
+ ## Community & Support
298
+
299
+ - **GitHub Issues**: [Report bugs and request features](https://github.com/RobyFerro/vega-framework/issues)
300
+ - **Documentation**: [Complete guides and API reference](docs/README.md)
301
+ - **Examples**: Check `examples/` directory for working code
302
+
303
+ ## Contributing
304
+
305
+ Contributions are welcome! This framework is extracted from production code and battle-tested in real-world applications.
306
+
307
+ ## License
308
+
309
+ MIT License - see [LICENSE](LICENSE) for details.
310
+
311
+ ---
312
+
313
+ **Built with ❤️ for developers who care about architecture.**
314
+
315
+ [Get Started →](docs/tutorials/quickstart.md) | [Read Philosophy →](docs/explanation/philosophy.md) | [View Documentation →](docs/README.md)
316
+
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "vega-framework"
3
- version = "0.1.30"
3
+ version = "0.1.32"
4
4
  description = "Enterprise-ready Python framework that enforces Clean Architecture for building maintainable and scalable applications."
5
5
  authors = ["Roberto Ferro"]
6
6
  license = "MIT"
@@ -933,9 +933,9 @@ def _generate_event(project_root: Path, project_name: str, class_name: str, file
933
933
 
934
934
 
935
935
  def _generate_event_handler(project_root: Path, project_name: str, class_name: str, file_name: str):
936
- """Generate an application-level event handler/subscriber."""
936
+ """Generate an application-level event handler/subscriber in events/ for auto-discovery."""
937
937
 
938
- handlers_path = project_root / "application" / "events"
938
+ handlers_path = project_root / "events"
939
939
  handlers_path.mkdir(parents=True, exist_ok=True)
940
940
 
941
941
  init_file = handlers_path / "__init__.py"
@@ -987,5 +987,5 @@ def _generate_event_handler(project_root: Path, project_name: str, class_name: s
987
987
 
988
988
  click.echo("\nNext steps:")
989
989
  click.echo(f" 1. Implement your handler in {handler_file.relative_to(project_root)}")
990
- click.echo(" 2. Ensure the module is imported during application bootstrap (autodiscovery or manual import).")
990
+ click.echo(" 2. Call events.register_all_handlers() during startup so auto-discovery loads it.")
991
991
  click.echo(" 3. Run your workflow and verify the subscriber reacts to the event.")