vega-framework 0.2.0__tar.gz → 0.2.1__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.2.0 → vega_framework-0.2.1}/PKG-INFO +1 -1
- {vega_framework-0.2.0 → vega_framework-0.2.1}/pyproject.toml +1 -1
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/commands/generate.py +15 -15
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/commands/web.py +8 -7
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/project/ARCHITECTURE.md.j2 +13 -13
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/project/README.md.j2 +5 -5
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/web/main.py.j2 +2 -3
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/web/middleware.py.j2 +3 -3
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/web/routes_init.py.j2 +3 -3
- {vega_framework-0.2.0 → vega_framework-0.2.1}/LICENSE +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/README.md +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/__init__.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/__init__.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/commands/__init__.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/commands/add.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/commands/init.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/commands/migrate.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/commands/update.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/main.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/scaffolds/__init__.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/scaffolds/fastapi.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/scaffolds/sqlalchemy.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/scaffolds/vega_web.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/__init__.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/cli/command.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/cli/command_simple.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/cli/commands_init.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/components.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/domain/entity.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/domain/event.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/domain/event_handler.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/domain/interactor.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/domain/mediator.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/domain/repository_interface.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/domain/service_interface.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/infrastructure/model.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/infrastructure/repository_impl.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/infrastructure/service_impl.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/loader.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/project/.env.example +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/project/.gitignore +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/project/config.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/project/events_init.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/project/main.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/project/main_fastapi.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/project/main_standard.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/project/pyproject.toml.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/project/settings.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/sqlalchemy/alembic.ini.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/sqlalchemy/database_manager.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/sqlalchemy/env.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/sqlalchemy/script.py.mako +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/web/__init__.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/web/app.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/web/health_route.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/web/models_init.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/web/request_model.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/web/response_model.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/web/router.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/web/routes_init_autodiscovery.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/web/user_models.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/web/users_route.py.j2 +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/utils/__init__.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/utils/async_support.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/utils/messages.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/utils/naming.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/utils/validators.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/di/__init__.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/di/container.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/di/decorators.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/di/errors.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/di/scope.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/discovery/__init__.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/discovery/commands.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/discovery/events.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/discovery/routes.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/events/README.md +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/events/SYNTAX_GUIDE.md +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/events/__init__.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/events/bus.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/events/decorators.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/events/event.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/events/middleware.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/patterns/__init__.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/patterns/interactor.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/patterns/mediator.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/patterns/repository.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/patterns/service.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/settings/__init__.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/settings/base.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/web/__init__.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/web/application.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/web/builtin_middlewares.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/web/exceptions.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/web/middleware.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/web/request.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/web/response.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/web/route_middleware.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/web/router.py +0 -0
- {vega_framework-0.2.0 → vega_framework-0.2.1}/vega/web/routing.py +0 -0
@@ -394,13 +394,13 @@ def _register_router_in_init(project_root: Path, resource_file: str, resource_na
|
|
394
394
|
|
395
395
|
|
396
396
|
def _generate_router(project_root: Path, project_name: str, name: str) -> None:
|
397
|
-
"""Generate a
|
397
|
+
"""Generate a Vega Web router for a resource"""
|
398
398
|
|
399
399
|
# Check if web folder exists
|
400
400
|
web_path = project_root / "presentation" / "web"
|
401
401
|
if not web_path.exists():
|
402
402
|
click.echo(click.style("ERROR: Web module not found", fg='red'))
|
403
|
-
click.echo(" Router generation requires
|
403
|
+
click.echo(" Router generation requires Vega Web module")
|
404
404
|
click.echo(" Install it with: vega add web")
|
405
405
|
return
|
406
406
|
|
@@ -440,13 +440,13 @@ def _generate_router(project_root: Path, project_name: str, name: str) -> None:
|
|
440
440
|
|
441
441
|
|
442
442
|
def _generate_web_models(project_root: Path, project_name: str, name: str, is_request: bool, is_response: bool) -> None:
|
443
|
-
"""Generate Pydantic request or response model for
|
443
|
+
"""Generate Pydantic request or response model for Vega Web"""
|
444
444
|
|
445
445
|
# Check if web folder exists
|
446
446
|
web_path = project_root / "presentation" / "web"
|
447
447
|
if not web_path.exists():
|
448
448
|
click.echo(click.style("ERROR: Web module not found", fg='red'))
|
449
|
-
click.echo(" Model generation requires
|
449
|
+
click.echo(" Model generation requires Vega Web module")
|
450
450
|
click.echo(" Install it with: vega add web")
|
451
451
|
return
|
452
452
|
|
@@ -531,13 +531,13 @@ def _generate_web_models(project_root: Path, project_name: str, name: str, is_re
|
|
531
531
|
|
532
532
|
|
533
533
|
def _generate_middleware(project_root: Path, project_name: str, class_name: str, file_name: str) -> None:
|
534
|
-
"""Generate a
|
534
|
+
"""Generate a Vega Web middleware"""
|
535
535
|
|
536
536
|
# Check if web folder exists
|
537
537
|
web_path = project_root / "presentation" / "web"
|
538
538
|
if not web_path.exists():
|
539
539
|
click.echo(click.style("ERROR: Web module not found", fg='red'))
|
540
|
-
click.echo(" Middleware generation requires
|
540
|
+
click.echo(" Middleware generation requires Vega Web module")
|
541
541
|
click.echo(" Install it with: vega add web")
|
542
542
|
return
|
543
543
|
|
@@ -554,7 +554,7 @@ def _generate_middleware(project_root: Path, project_name: str, class_name: str,
|
|
554
554
|
# Check if __init__.py exists
|
555
555
|
init_file = middleware_path / "__init__.py"
|
556
556
|
if not init_file.exists():
|
557
|
-
init_file.write_text('"""
|
557
|
+
init_file.write_text('"""Vega Web Middlewares"""\n')
|
558
558
|
click.echo(f"+ Created {click.style(str(init_file.relative_to(project_root)), fg='green')}")
|
559
559
|
|
560
560
|
# Generate middleware file
|
@@ -589,8 +589,8 @@ def _register_middleware_in_app(project_root: Path, class_name: str, file_name:
|
|
589
589
|
click.echo(click.style(f'''
|
590
590
|
from .middleware.{file_name} import {class_name}Middleware
|
591
591
|
|
592
|
-
def create_app() ->
|
593
|
-
app =
|
592
|
+
def create_app() -> VegaApp:
|
593
|
+
app = VegaApp(...)
|
594
594
|
app.add_middleware({class_name}Middleware)
|
595
595
|
app.include_router(get_api_router())
|
596
596
|
return app
|
@@ -619,9 +619,9 @@ def create_app() -> FastAPI:
|
|
619
619
|
break
|
620
620
|
|
621
621
|
if not import_added:
|
622
|
-
# Fallback: add after
|
622
|
+
# Fallback: add after VegaApp import
|
623
623
|
for i, line in enumerate(lines):
|
624
|
-
if 'from
|
624
|
+
if 'from vega.web import' in line:
|
625
625
|
lines.insert(i + 1, middleware_import)
|
626
626
|
lines.insert(i + 2, '')
|
627
627
|
break
|
@@ -629,8 +629,8 @@ def create_app() -> FastAPI:
|
|
629
629
|
# Find create_app function and add middleware registration
|
630
630
|
middleware_added = False
|
631
631
|
for i, line in enumerate(lines):
|
632
|
-
if 'app =
|
633
|
-
# Find the end of
|
632
|
+
if 'app = VegaApp(' in line:
|
633
|
+
# Find the end of VegaApp initialization
|
634
634
|
j = i + 1
|
635
635
|
while j < len(lines) and not lines[j].strip().startswith('app.include_router'):
|
636
636
|
j += 1
|
@@ -649,8 +649,8 @@ def create_app() -> FastAPI:
|
|
649
649
|
click.echo(click.style(f'''
|
650
650
|
from .middleware.{file_name} import {class_name}Middleware
|
651
651
|
|
652
|
-
def create_app() ->
|
653
|
-
app =
|
652
|
+
def create_app() -> VegaApp:
|
653
|
+
app = VegaApp(...)
|
654
654
|
app.add_middleware({class_name}Middleware)
|
655
655
|
app.include_router(get_api_router())
|
656
656
|
return app
|
@@ -1,4 +1,4 @@
|
|
1
|
-
"""Web command - Manage
|
1
|
+
"""Web command - Manage Vega Web server"""
|
2
2
|
import sys
|
3
3
|
from pathlib import Path
|
4
4
|
|
@@ -7,7 +7,7 @@ import click
|
|
7
7
|
|
8
8
|
@click.group()
|
9
9
|
def web():
|
10
|
-
"""Manage
|
10
|
+
"""Manage Vega Web server
|
11
11
|
|
12
12
|
Commands to manage the web server for your Vega project.
|
13
13
|
The web module must be added to the project first using 'vega add web'.
|
@@ -21,7 +21,7 @@ def web():
|
|
21
21
|
@click.option('--reload', is_flag=True, help='Enable auto-reload')
|
22
22
|
@click.option('--path', default='.', help='Path to Vega project (default: current directory)')
|
23
23
|
def run(host: str, port: int, reload: bool, path: str):
|
24
|
-
"""Start the
|
24
|
+
"""Start the Vega Web server
|
25
25
|
|
26
26
|
Examples:
|
27
27
|
vega web run
|
@@ -42,7 +42,7 @@ def run(host: str, port: int, reload: bool, path: str):
|
|
42
42
|
web_main = project_path / "presentation" / "web" / "main.py"
|
43
43
|
if not web_main.exists():
|
44
44
|
click.echo(click.style("ERROR: Web module not found", fg='red'))
|
45
|
-
click.echo("\nThe
|
45
|
+
click.echo("\nThe Vega Web module is not available in this project.")
|
46
46
|
click.echo("Add it using:")
|
47
47
|
click.echo(click.style(" vega add web", fg='cyan', bold=True))
|
48
48
|
sys.exit(1)
|
@@ -56,8 +56,9 @@ def run(host: str, port: int, reload: bool, path: str):
|
|
56
56
|
import uvicorn
|
57
57
|
except ImportError:
|
58
58
|
click.echo(click.style("ERROR: uvicorn not installed", fg='red'))
|
59
|
-
click.echo("\
|
60
|
-
click.echo(
|
59
|
+
click.echo("\nUvicorn is required but not installed.")
|
60
|
+
click.echo("It should be included with vega-framework, but you can also install it with:")
|
61
|
+
click.echo(click.style(" poetry add uvicorn[standard]", fg='cyan', bold=True))
|
61
62
|
sys.exit(1)
|
62
63
|
|
63
64
|
# Initialize DI container first
|
@@ -73,7 +74,7 @@ def run(host: str, port: int, reload: bool, path: str):
|
|
73
74
|
try:
|
74
75
|
from presentation.web.main import app
|
75
76
|
except ImportError as e:
|
76
|
-
click.echo(click.style("ERROR: Failed to import
|
77
|
+
click.echo(click.style("ERROR: Failed to import Vega Web app", fg='red'))
|
77
78
|
click.echo(f"\nDetails: {e}")
|
78
79
|
click.echo("\nMake sure:")
|
79
80
|
click.echo(" 1. You are in the project directory or use --path")
|
@@ -38,7 +38,7 @@ The innermost layer containing pure business logic, completely independent of an
|
|
38
38
|
**Rules:**
|
39
39
|
|
40
40
|
- ✅ **NO** dependencies on any other layer
|
41
|
-
- ✅ **NO** framework-specific code (no
|
41
|
+
- ✅ **NO** framework-specific code (no Vega Web, SQLAlchemy, etc.)
|
42
42
|
- ✅ **NO** infrastructure details (no database, HTTP, file system)
|
43
43
|
- ✅ Pure business logic only
|
44
44
|
- ✅ Only defines **interfaces**, never concrete implementations
|
@@ -90,7 +90,7 @@ Handles user interaction and external communication, acting as the entry point t
|
|
90
90
|
|
91
91
|
**Contains:**
|
92
92
|
|
93
|
-
- **Web API** -
|
93
|
+
- **Web API** - Vega Web routes, controllers, request/response models (when web is enabled)
|
94
94
|
- **CLI** - Command-line interface commands and argument parsing
|
95
95
|
- **GraphQL/gRPC** - Alternative API implementations (if needed)
|
96
96
|
- **WebSockets** - Real-time communication handlers (if needed)
|
@@ -108,7 +108,7 @@ Handles user interaction and external communication, acting as the entry point t
|
|
108
108
|
**Examples:**
|
109
109
|
|
110
110
|
- **CLI**: Uses Click/Typer to define commands that invoke interactors or mediators
|
111
|
-
- **Web API**:
|
111
|
+
- **Web API**: Vega Web endpoints that receive HTTP requests and call domain use cases
|
112
112
|
- **Both**: Can coexist in the same application, sharing the same business logic
|
113
113
|
|
114
114
|
## Core Patterns
|
@@ -344,7 +344,7 @@ The generator will interactively prompt for:
|
|
344
344
|
|
345
345
|
Commands are **automatically discovered** from `presentation/cli/commands/` - no manual registration required.
|
346
346
|
|
347
|
-
**
|
347
|
+
**Vega Web Routers** - HTTP API endpoints (requires web support):
|
348
348
|
```bash
|
349
349
|
vega generate router User
|
350
350
|
vega generate router Product
|
@@ -353,7 +353,7 @@ vega generate router Order
|
|
353
353
|
|
354
354
|
Routers are **automatically discovered** from `presentation/web/routes/` - no manual registration required.
|
355
355
|
|
356
|
-
**
|
356
|
+
**Vega Web Middleware** - Request/response processing (requires web support):
|
357
357
|
```bash
|
358
358
|
vega generate middleware Logging
|
359
359
|
vega generate middleware Authentication
|
@@ -362,12 +362,12 @@ vega generate middleware RateLimiting
|
|
362
362
|
|
363
363
|
### Adding Features to Existing Projects
|
364
364
|
|
365
|
-
**Add
|
365
|
+
**Add Vega Web Support**:
|
366
366
|
```bash
|
367
367
|
vega add web
|
368
368
|
```
|
369
369
|
|
370
|
-
Creates complete
|
370
|
+
Creates complete Vega Web scaffold:
|
371
371
|
- `presentation/web/` directory structure
|
372
372
|
- Routes and middleware setup
|
373
373
|
- Health check endpoints
|
@@ -482,9 +482,9 @@ vega doctor
|
|
482
482
|
| `vega generate interactor <Name>` | Generate use case |
|
483
483
|
| `vega generate mediator <Name>` | Generate workflow |
|
484
484
|
| `vega generate command <Name>` | Generate CLI command |
|
485
|
-
| `vega generate router <Name>` | Generate
|
485
|
+
| `vega generate router <Name>` | Generate Vega Web router |
|
486
486
|
| `vega generate model <Name>` | Generate SQLAlchemy model |
|
487
|
-
| `vega add web` | Add
|
487
|
+
| `vega add web` | Add Vega Web support |
|
488
488
|
| `vega add sqlalchemy` | Add database support |
|
489
489
|
| `vega migrate <command>` | Manage database migrations |
|
490
490
|
| `vega doctor` | Validate project architecture |
|
@@ -519,9 +519,9 @@ vega generate router Product
|
|
519
519
|
|
520
520
|
This creates `presentation/web/routes/product.py`:
|
521
521
|
```python
|
522
|
-
from
|
522
|
+
from vega.web import Router
|
523
523
|
|
524
|
-
router =
|
524
|
+
router = Router() # MUST be named 'router'
|
525
525
|
|
526
526
|
@router.get("/")
|
527
527
|
async def list_products():
|
@@ -682,7 +682,7 @@ Vega projects follow a standard 4-layer structure:
|
|
682
682
|
│ └── sendgrid_email_service.py # Sendgrid implementation
|
683
683
|
│
|
684
684
|
├── presentation/ # 🟠 PRESENTATION LAYER (Delivery Mechanisms)
|
685
|
-
│ ├── web/ #
|
685
|
+
│ ├── web/ # Vega Web interface (if enabled)
|
686
686
|
│ │ ├── __init__.py
|
687
687
|
│ │ ├── routes/
|
688
688
|
│ │ │ └── user_routes.py
|
@@ -833,7 +833,7 @@ async def create_user(name: str, email: str):
|
|
833
833
|
|
834
834
|
**Benefits:**
|
835
835
|
- Execute async interactors directly in CLI commands
|
836
|
-
- Same business logic works in both CLI and Web (
|
836
|
+
- Same business logic works in both CLI and Web (Vega Web) contexts
|
837
837
|
- Clean async/await syntax
|
838
838
|
- Automatic asyncio event loop management
|
839
839
|
|
@@ -20,9 +20,9 @@ Vega Framework application with Clean Architecture.
|
|
20
20
|
│ └── services/ # Service implementations
|
21
21
|
│
|
22
22
|
├── presentation/ # Delivery mechanisms
|
23
|
-
│ ├── web/ #
|
23
|
+
│ ├── web/ # Vega Web interface (if added)
|
24
24
|
│ │ ├── routes/ # HTTP endpoints
|
25
|
-
│ │ ├── app.py #
|
25
|
+
│ │ ├── app.py # Vega app factory
|
26
26
|
│ │ └── main.py # ASGI entrypoint
|
27
27
|
│ └── cli/ # CLI commands
|
28
28
|
│
|
@@ -45,7 +45,7 @@ cp .env.example .env
|
|
45
45
|
python main.py hello
|
46
46
|
python main.py greet --name John
|
47
47
|
|
48
|
-
# If using
|
48
|
+
# If using web template, run the web server
|
49
49
|
vega web run
|
50
50
|
vega web run --reload # With auto-reload
|
51
51
|
# Visit http://localhost:8000/api/health/status
|
@@ -81,7 +81,7 @@ vega generate command ListUsers --impl sync
|
|
81
81
|
|
82
82
|
### Add Features
|
83
83
|
|
84
|
-
Add
|
84
|
+
Add Vega Web support to your project:
|
85
85
|
|
86
86
|
```bash
|
87
87
|
vega add web
|
@@ -140,7 +140,7 @@ async def create_user(name: str):
|
|
140
140
|
click.echo(f"Created: {user.name}")
|
141
141
|
```
|
142
142
|
|
143
|
-
This allows the same async business logic to work in both CLI and web contexts (
|
143
|
+
This allows the same async business logic to work in both CLI and web contexts (Vega Web).
|
144
144
|
|
145
145
|
## Project Commands Quick Reference
|
146
146
|
|
@@ -1,5 +1,4 @@
|
|
1
|
-
"""
|
2
|
-
from fastapi import FastAPI
|
1
|
+
"""Vega Web ASGI entrypoint for {{ project_name }}"""
|
3
2
|
import config # noqa: F401 - Import to initialize DI container
|
4
3
|
|
5
4
|
# Auto-discover event subscribers so @subscribe handlers are ready
|
@@ -12,7 +11,7 @@ else:
|
|
12
11
|
|
13
12
|
from .app import create_app
|
14
13
|
|
15
|
-
app
|
14
|
+
app = create_app()
|
16
15
|
|
17
16
|
|
18
17
|
if __name__ == "__main__":
|
@@ -1,5 +1,5 @@
|
|
1
|
-
"""{{ class_name }} middleware for
|
2
|
-
from
|
1
|
+
"""{{ class_name }} middleware for Vega Web application"""
|
2
|
+
from vega.web import Request, Response
|
3
3
|
from starlette.middleware.base import BaseHTTPMiddleware
|
4
4
|
from starlette.types import ASGIApp
|
5
5
|
import time
|
@@ -14,7 +14,7 @@ class {{ class_name }}Middleware(BaseHTTPMiddleware):
|
|
14
14
|
and responses before they're returned to clients.
|
15
15
|
|
16
16
|
Usage:
|
17
|
-
Add to your
|
17
|
+
Add to your Vega Web app in app.py:
|
18
18
|
from .middleware.{{ file_name }} import {{ class_name }}Middleware
|
19
19
|
app.add_middleware({{ class_name }}Middleware)
|
20
20
|
"""
|
@@ -1,5 +1,5 @@
|
|
1
1
|
"""API routers aggregation"""
|
2
|
-
from
|
2
|
+
from vega.web import Router
|
3
3
|
|
4
4
|
from . import health, users
|
5
5
|
|
@@ -7,9 +7,9 @@ from . import health, users
|
|
7
7
|
API_PREFIX = "/api"
|
8
8
|
|
9
9
|
|
10
|
-
def get_api_router() ->
|
10
|
+
def get_api_router() -> Router:
|
11
11
|
"""Return application API router"""
|
12
|
-
router =
|
12
|
+
router = Router(prefix=API_PREFIX)
|
13
13
|
router.include_router(health.router, tags=["health"], prefix="/health")
|
14
14
|
router.include_router(users.router, tags=["users"], prefix="/users")
|
15
15
|
return router
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/domain/repository_interface.py.j2
RENAMED
File without changes
|
{vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/domain/service_interface.py.j2
RENAMED
File without changes
|
File without changes
|
File without changes
|
{vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/infrastructure/service_impl.py.j2
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/project/main_standard.py.j2
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/sqlalchemy/database_manager.py.j2
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{vega_framework-0.2.0 → vega_framework-0.2.1}/vega/cli/templates/web/routes_init_autodiscovery.py.j2
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|