vega-framework 0.1.24__tar.gz → 0.1.26__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 (81) hide show
  1. {vega_framework-0.1.24 → vega_framework-0.1.26}/PKG-INFO +3 -1
  2. {vega_framework-0.1.24 → vega_framework-0.1.26}/pyproject.toml +3 -1
  3. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/commands/add.py +61 -24
  4. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/commands/init.py +2 -11
  5. vega_framework-0.1.26/vega/cli/commands/web.py +90 -0
  6. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/main.py +3 -1
  7. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/project/README.md.j2 +2 -2
  8. vega_framework-0.1.26/vega/cli/templates/project/main.py.j2 +25 -0
  9. vega_framework-0.1.26/vega/cli/templates/project/main_fastapi.py.j2 +26 -0
  10. vega_framework-0.1.26/vega/cli/templates/project/main_standard.py.j2 +26 -0
  11. vega_framework-0.1.24/vega/cli/templates/project/main.py.j2 +0 -110
  12. vega_framework-0.1.24/vega/cli/templates/project/main_fastapi.py.j2 +0 -76
  13. vega_framework-0.1.24/vega/cli/templates/project/main_standard.py.j2 +0 -84
  14. {vega_framework-0.1.24 → vega_framework-0.1.26}/LICENSE +0 -0
  15. {vega_framework-0.1.24 → vega_framework-0.1.26}/README.md +0 -0
  16. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/__init__.py +0 -0
  17. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/__init__.py +0 -0
  18. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/commands/__init__.py +0 -0
  19. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/commands/generate.py +0 -0
  20. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/commands/migrate.py +0 -0
  21. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/commands/update.py +0 -0
  22. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/scaffolds/__init__.py +0 -0
  23. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/scaffolds/fastapi.py +0 -0
  24. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/scaffolds/sqlalchemy.py +0 -0
  25. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/__init__.py +0 -0
  26. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/cli/command.py.j2 +0 -0
  27. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/cli/command_simple.py.j2 +0 -0
  28. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/cli/commands_init.py.j2 +0 -0
  29. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/components.py +0 -0
  30. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/domain/entity.py.j2 +0 -0
  31. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/domain/interactor.py.j2 +0 -0
  32. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/domain/mediator.py.j2 +0 -0
  33. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/domain/repository_interface.py.j2 +0 -0
  34. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/domain/service_interface.py.j2 +0 -0
  35. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/infrastructure/model.py.j2 +0 -0
  36. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/infrastructure/repository_impl.py.j2 +0 -0
  37. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/infrastructure/service_impl.py.j2 +0 -0
  38. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/loader.py +0 -0
  39. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/project/.env.example +0 -0
  40. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/project/.gitignore +0 -0
  41. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/project/ARCHITECTURE.md.j2 +0 -0
  42. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/project/config.py.j2 +0 -0
  43. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/project/pyproject.toml.j2 +0 -0
  44. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/project/settings.py.j2 +0 -0
  45. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/sqlalchemy/alembic.ini.j2 +0 -0
  46. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/sqlalchemy/database_manager.py.j2 +0 -0
  47. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/sqlalchemy/env.py.j2 +0 -0
  48. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/sqlalchemy/script.py.mako +0 -0
  49. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/web/__init__.py.j2 +0 -0
  50. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/web/app.py.j2 +0 -0
  51. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/web/health_route.py.j2 +0 -0
  52. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/web/main.py.j2 +0 -0
  53. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/web/middleware.py.j2 +0 -0
  54. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/web/models_init.py.j2 +0 -0
  55. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/web/request_model.py.j2 +0 -0
  56. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/web/response_model.py.j2 +0 -0
  57. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/web/router.py.j2 +0 -0
  58. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/web/routes_init.py.j2 +0 -0
  59. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/web/routes_init_autodiscovery.py.j2 +0 -0
  60. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/web/user_models.py.j2 +0 -0
  61. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/templates/web/users_route.py.j2 +0 -0
  62. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/utils/__init__.py +0 -0
  63. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/utils/async_support.py +0 -0
  64. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/utils/messages.py +0 -0
  65. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/utils/naming.py +0 -0
  66. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/cli/utils/validators.py +0 -0
  67. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/di/__init__.py +0 -0
  68. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/di/container.py +0 -0
  69. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/di/decorators.py +0 -0
  70. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/di/errors.py +0 -0
  71. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/di/scope.py +0 -0
  72. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/discovery/__init__.py +0 -0
  73. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/discovery/commands.py +0 -0
  74. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/discovery/routes.py +0 -0
  75. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/patterns/__init__.py +0 -0
  76. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/patterns/interactor.py +0 -0
  77. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/patterns/mediator.py +0 -0
  78. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/patterns/repository.py +0 -0
  79. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/patterns/service.py +0 -0
  80. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/settings/__init__.py +0 -0
  81. {vega_framework-0.1.24 → vega_framework-0.1.26}/vega/settings/base.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vega-framework
3
- Version: 0.1.24
3
+ Version: 0.1.26
4
4
  Summary: Enterprise-ready Python framework that enforces Clean Architecture for building maintainable and scalable applications.
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -19,10 +19,12 @@ Classifier: Programming Language :: Python :: 3.14
19
19
  Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
20
20
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
21
  Requires-Dist: click (>=8.0,<9.0)
22
+ Requires-Dist: fastapi (>=0.109,<0.110)
22
23
  Requires-Dist: jinja2 (>=3.1,<4.0)
23
24
  Requires-Dist: pydantic (>=2.0,<3.0)
24
25
  Requires-Dist: pydantic-settings (>=2.0,<3.0)
25
26
  Requires-Dist: toml (>=0.10,<0.11)
27
+ Requires-Dist: uvicorn (>=0.27,<0.28)
26
28
  Project-URL: Documentation, https://vega-framework.readthedocs.io
27
29
  Project-URL: Homepage, https://github.com/RobyFerro/vega-framework
28
30
  Project-URL: Repository, https://github.com/RobyFerro/vega-framework
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "vega-framework"
3
- version = "0.1.24"
3
+ version = "0.1.26"
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"
@@ -42,6 +42,8 @@ pydantic-settings = "^2.0"
42
42
  click = "^8.0"
43
43
  jinja2 = "^3.1"
44
44
  toml = "^0.10"
45
+ uvicorn = "^0.27"
46
+ fastapi = "^0.109"
45
47
 
46
48
  [tool.poetry.group.dev.dependencies]
47
49
  pytest = "^7.0"
@@ -58,39 +58,18 @@ def add_web_feature(project_path: Path, project_name: str):
58
58
  presentation_dir = project_path / "presentation"
59
59
  if not presentation_dir.exists():
60
60
  presentation_dir.mkdir(parents=True, exist_ok=True)
61
- (presentation_dir / "__init__.py").write_text("")
62
61
  click.echo(f" + Created presentation/")
63
62
 
64
63
  # Create FastAPI scaffold
65
64
  create_fastapi_scaffold(project_path, project_name, overwrite=overwrite)
66
65
 
67
- # Update main.py to use web command
68
- main_file = project_path / "main.py"
69
- if main_file.exists():
70
- click.echo("\n[!] Update main.py to add web command:")
71
- click.echo(" Add the following to your main.py CLI group:\n")
72
- click.echo(click.style('''
73
- @cli.command()
74
- @click.option('--host', default='0.0.0.0', help='Host to bind')
75
- @click.option('--port', default=8000, help='Port to bind')
76
- @click.option('--reload', is_flag=True, help='Enable auto-reload')
77
- def web(host: str, port: int, reload: bool):
78
- """Start FastAPI web server"""
79
- import uvicorn
80
- from presentation.web.main import app
81
-
82
- click.echo(f"Starting web server on http://{host}:{port}")
83
- uvicorn.run(app, host=host, port=port, reload=reload)
84
- ''', fg='cyan'))
85
-
86
66
  click.echo(f"\n{click.style('SUCCESS: FastAPI web scaffold added!', fg='green', bold=True)}\n")
87
67
  click.echo("Next steps:")
88
68
  click.echo(" 1. Add FastAPI dependencies:")
89
69
  click.echo(" poetry add fastapi uvicorn[standard]")
90
- click.echo(" 2. Update your main.py with the web command (see above)")
91
- click.echo(" 3. Run the server:")
92
- click.echo(" python main.py web --reload")
93
- click.echo(" 4. Visit http://localhost:8000/api/health/status")
70
+ click.echo(" 2. Run the server:")
71
+ click.echo(" vega web run --reload")
72
+ click.echo(" 3. Visit http://localhost:8000/api/health/status")
94
73
 
95
74
 
96
75
  def add_sqlalchemy_feature(project_path: Path, project_name: str):
@@ -111,6 +90,13 @@ def add_sqlalchemy_feature(project_path: Path, project_name: str):
111
90
  # Create SQLAlchemy scaffold
112
91
  create_sqlalchemy_scaffold(project_path, project_name, overwrite=overwrite)
113
92
 
93
+ # Ask if user wants an example repository
94
+ create_example = click.confirm("\nDo you want to create an example User repository with SQLAlchemy implementation?", default=True)
95
+
96
+ if create_example:
97
+ click.echo("\n[*] Creating example User repository...")
98
+ _create_user_example_repository(project_path, project_name)
99
+
114
100
  click.echo(f"\n{click.style('SUCCESS: SQLAlchemy database support added!', fg='green', bold=True)}\n")
115
101
  click.echo("Next steps:")
116
102
  click.echo(" 1. Add DATABASE_URL to your settings.py:")
@@ -123,3 +109,54 @@ def add_sqlalchemy_feature(project_path: Path, project_name: str):
123
109
  click.echo(' vega migrate create -m "Initial migration"')
124
110
  click.echo(" 5. Apply migrations:")
125
111
  click.echo(" vega migrate upgrade")
112
+
113
+
114
+ def _create_user_example_repository(project_path: Path, project_name: str):
115
+ """Create example User entity, repository, and SQLAlchemy implementation"""
116
+ from vega.cli.commands.generate import _generate_entity, _generate_repository, _generate_sqlalchemy_model, _generate_infrastructure_repository
117
+ from vega.cli.utils import to_pascal_case, to_snake_case
118
+
119
+ # Suppress verbose output temporarily by redirecting
120
+ import sys
121
+ from io import StringIO
122
+
123
+ # Generate User entity
124
+ click.echo(" + Creating User entity...")
125
+ _generate_entity(project_path, project_name, 'User', 'user')
126
+
127
+ # Generate UserRepository interface (without next steps)
128
+ click.echo(" + Creating UserRepository interface...")
129
+ original_stdout = sys.stdout
130
+ sys.stdout = StringIO() # Suppress "Next steps" output
131
+
132
+ try:
133
+ _generate_repository(project_path, project_name, 'UserRepository', 'user_repository', implementation=None)
134
+ finally:
135
+ sys.stdout = original_stdout
136
+
137
+ # Generate SQLAlchemy UserModel
138
+ click.echo(" + Creating UserModel (SQLAlchemy)...")
139
+ sys.stdout = StringIO() # Suppress verbose output
140
+ try:
141
+ _generate_sqlalchemy_model(project_path, project_name, 'User', 'user')
142
+ finally:
143
+ sys.stdout = original_stdout
144
+
145
+ # Generate SQLAlchemy repository implementation
146
+ click.echo(" + Creating SQLAlchemyUserRepository implementation...")
147
+ _generate_infrastructure_repository(
148
+ project_path,
149
+ 'UserRepository',
150
+ 'user_repository',
151
+ 'User',
152
+ 'user',
153
+ 'sql'
154
+ )
155
+
156
+ click.echo(click.style("\n ✓ Example User repository created!", fg='green'))
157
+ click.echo("\nGenerated files:")
158
+ click.echo(" - domain/entities/user.py")
159
+ click.echo(" - domain/repositories/user_repository.py")
160
+ click.echo(" - infrastructure/models/user.py")
161
+ click.echo(" - infrastructure/repositories/sqlalchemy_user_repository.py")
162
+ click.echo("\nNext step: Update config.py to register SQLAlchemyUserRepository in SERVICES dict")
@@ -53,18 +53,9 @@ def init_project(project_name: str, template: str, parent_path: str):
53
53
  from vega.cli.templates import render_cli_commands_init
54
54
  content = render_cli_commands_init()
55
55
  (dir_path / "__init__.py").write_text(content)
56
- else:
57
- (dir_path / "__init__.py").write_text("")
58
56
 
59
57
  click.echo(f" + Created {directory}/")
60
58
 
61
- # Create __init__.py files
62
- (project_path / "__init__.py").write_text("")
63
- (project_path / "domain" / "__init__.py").write_text("")
64
- (project_path / "application" / "__init__.py").write_text("")
65
- (project_path / "infrastructure" / "__init__.py").write_text("")
66
- (project_path / "presentation" / "__init__.py").write_text("")
67
- (project_path / "tests" / "__init__.py").write_text("")
68
59
 
69
60
  # Create config.py
70
61
  config_content = render_template("config.py.j2", project_name=project_name)
@@ -131,8 +122,8 @@ def init_project(project_name: str, template: str, parent_path: str):
131
122
 
132
123
  if template == "fastapi":
133
124
  click.echo(f"\nRun commands:")
134
- click.echo(f" python main.py web # Start FastAPI server (http://localhost:8000)")
135
- click.echo(f" python main.py web --reload # Start with auto-reload")
125
+ click.echo(f" vega web run # Start FastAPI server (http://localhost:8000)")
126
+ click.echo(f" vega web run --reload # Start with auto-reload")
136
127
  click.echo(f" python main.py hello # Run CLI command")
137
128
  click.echo(f" python main.py --help # Show all commands")
138
129
  else:
@@ -0,0 +1,90 @@
1
+ """Web command - Manage FastAPI web server"""
2
+ import sys
3
+ from pathlib import Path
4
+
5
+ import click
6
+
7
+
8
+ @click.group()
9
+ def web():
10
+ """Manage FastAPI web server
11
+
12
+ Commands to manage the web server for your Vega project.
13
+ The web module must be added to the project first using 'vega add web'.
14
+ """
15
+ pass
16
+
17
+
18
+ @web.command()
19
+ @click.option('--host', default='0.0.0.0', help='Host to bind')
20
+ @click.option('--port', default=8000, help='Port to bind')
21
+ @click.option('--reload', is_flag=True, help='Enable auto-reload')
22
+ @click.option('--path', default='.', help='Path to Vega project (default: current directory)')
23
+ def run(host: str, port: int, reload: bool, path: str):
24
+ """Start the FastAPI web server
25
+
26
+ Examples:
27
+ vega web run
28
+ vega web run --reload
29
+ vega web run --host 127.0.0.1 --port 3000
30
+ vega web run --path ./my-project --reload
31
+ """
32
+ project_path = Path(path).resolve()
33
+
34
+ # Validate it's a Vega project
35
+ if not (project_path / "config.py").exists():
36
+ click.echo(click.style("ERROR: Not a Vega project (config.py not found)", fg='red'))
37
+ click.echo(f"Path checked: {project_path}")
38
+ click.echo("\nRun 'vega init <project-name>' to create a new Vega project.")
39
+ sys.exit(1)
40
+
41
+ # Check if web module exists
42
+ web_main = project_path / "presentation" / "web" / "main.py"
43
+ if not web_main.exists():
44
+ click.echo(click.style("ERROR: Web module not found", fg='red'))
45
+ click.echo("\nThe FastAPI web module is not available in this project.")
46
+ click.echo("Add it using:")
47
+ click.echo(click.style(" vega add web", fg='cyan', bold=True))
48
+ sys.exit(1)
49
+
50
+ # Add project path to sys.path so we can import from it
51
+ if str(project_path) not in sys.path:
52
+ sys.path.insert(0, str(project_path))
53
+
54
+ # Try to import uvicorn
55
+ try:
56
+ import uvicorn
57
+ except ImportError:
58
+ click.echo(click.style("ERROR: uvicorn not installed", fg='red'))
59
+ click.echo("\nInstall FastAPI dependencies:")
60
+ click.echo(click.style(" poetry add fastapi uvicorn[standard]", fg='cyan', bold=True))
61
+ sys.exit(1)
62
+
63
+ # Try to import the app
64
+ try:
65
+ from presentation.web.main import app
66
+ except ImportError as e:
67
+ click.echo(click.style("ERROR: Failed to import FastAPI app", fg='red'))
68
+ click.echo(f"\nDetails: {e}")
69
+ click.echo("\nMake sure:")
70
+ click.echo(" 1. You are in the project directory or use --path")
71
+ click.echo(" 2. The web module is properly configured")
72
+ click.echo(" 3. All dependencies are installed (poetry install)")
73
+ sys.exit(1)
74
+
75
+ click.echo(f"Starting web server on http://{host}:{port}")
76
+ if reload:
77
+ click.echo(click.style("Auto-reload enabled", fg='yellow'))
78
+
79
+ # Run the server
80
+ try:
81
+ uvicorn.run(
82
+ "presentation.web.main:app",
83
+ host=host,
84
+ port=port,
85
+ reload=reload,
86
+ )
87
+ except Exception as e:
88
+ click.echo(click.style(f"\nERROR: Failed to start server", fg='red'))
89
+ click.echo(f"Details: {e}")
90
+ sys.exit(1)
@@ -9,6 +9,7 @@ from vega.cli.commands.generate import generate_component
9
9
  from vega.cli.commands.add import add
10
10
  from vega.cli.commands.update import update_vega, check_version
11
11
  from vega.cli.commands.migrate import migrate
12
+ from vega.cli.commands.web import web
12
13
 
13
14
 
14
15
  @click.group()
@@ -139,9 +140,10 @@ def update(check, force):
139
140
  update_vega(force=force)
140
141
 
141
142
 
142
- # Register the add and migrate commands
143
+ # Register the add, migrate and web commands
143
144
  cli.add_command(add)
144
145
  cli.add_command(migrate)
146
+ cli.add_command(web)
145
147
 
146
148
 
147
149
  if __name__ == '__main__':
@@ -46,8 +46,8 @@ python main.py hello
46
46
  python main.py greet --name John
47
47
 
48
48
  # If using FastAPI template, run the web server
49
- python main.py web
50
- python main.py web --reload # With auto-reload
49
+ vega web run
50
+ vega web run --reload # With auto-reload
51
51
  # Visit http://localhost:8000/api/health/status
52
52
 
53
53
  # Run tests
@@ -0,0 +1,25 @@
1
+ """Main entry point for {{ project_name }}"""
2
+ import click
3
+ import config # noqa: F401 - Import to initialize DI container
4
+
5
+ # Import your use cases here
6
+ # from domain.interactors.create_user import CreateUser
7
+
8
+
9
+ @click.group()
10
+ def cli():
11
+ """Vega Framework Application"""
12
+ pass
13
+
14
+ # Auto-register custom commands from presentation/cli/commands/
15
+ try:
16
+ from presentation.cli.commands import get_commands
17
+ for cmd in get_commands():
18
+ cli.add_command(cmd)
19
+ except ImportError:
20
+ # cli/commands/ not created yet
21
+ pass
22
+
23
+
24
+ if __name__ == "__main__":
25
+ cli()
@@ -0,0 +1,26 @@
1
+ """Main entry point for {{ project_name }}"""
2
+ import click
3
+ from vega.cli.utils import async_command
4
+ import config # noqa: F401 - Import to initialize DI container
5
+
6
+ # Import your use cases here
7
+ # from domain.interactors.create_user import CreateUser
8
+
9
+
10
+ @click.group()
11
+ def cli():
12
+ """Vega Framework Application"""
13
+ pass
14
+
15
+ # Auto-register custom commands from presentation/cli/commands/
16
+ try:
17
+ from presentation.cli.commands import get_commands
18
+ for cmd in get_commands():
19
+ cli.add_command(cmd)
20
+ except ImportError:
21
+ # cli/commands/ not created yet
22
+ pass
23
+
24
+
25
+ if __name__ == "__main__":
26
+ cli()
@@ -0,0 +1,26 @@
1
+ """Main entry point for {{ project_name }}"""
2
+ import click
3
+ from vega.cli.utils import async_command
4
+ import config # noqa: F401 - Import to initialize DI container
5
+
6
+ # Import your use cases here
7
+ # from domain.interactors.create_user import CreateUser
8
+
9
+
10
+ @click.group()
11
+ def cli():
12
+ """Vega Framework CLI Application"""
13
+ pass
14
+
15
+ # Auto-register custom commands from presentation/cli/commands/
16
+ try:
17
+ from presentation.cli.commands import get_commands
18
+ for cmd in get_commands():
19
+ cli.add_command(cmd)
20
+ except ImportError:
21
+ # cli/commands/ not created yet
22
+ pass
23
+
24
+
25
+ if __name__ == "__main__":
26
+ cli()
@@ -1,110 +0,0 @@
1
- """Main entry point for {{ project_name }}"""
2
- {% if template == "fastapi" -%}
3
- import click
4
- import config # noqa: F401 - Import to initialize DI container
5
-
6
-
7
- @click.group()
8
- def cli():
9
- """Vega Framework Application - CLI and Web"""
10
- pass
11
-
12
-
13
- @cli.command()
14
- @click.option('--host', default='0.0.0.0', help='Host to bind')
15
- @click.option('--port', default=8000, help='Port to bind')
16
- @click.option('--reload', is_flag=True, help='Enable auto-reload')
17
- def web(host: str, port: int, reload: bool):
18
- """Start FastAPI web server"""
19
- import uvicorn
20
- from presentation.web.main import app
21
-
22
- click.echo(f"Starting web server on http://{host}:{port}")
23
- uvicorn.run(
24
- app,
25
- host=host,
26
- port=port,
27
- reload=reload,
28
- )
29
-
30
-
31
- @cli.command()
32
- def hello():
33
- """Example CLI command"""
34
- click.echo("Hello from Vega Framework!")
35
- click.echo("Add your CLI commands in presentation/cli/commands/")
36
-
37
-
38
- # Auto-register custom commands from presentation/cli/commands/
39
- try:
40
- from presentation.cli.commands import get_commands
41
- for cmd in get_commands():
42
- cli.add_command(cmd)
43
- except ImportError:
44
- # cli/commands/ not created yet
45
- pass
46
-
47
-
48
- if __name__ == "__main__":
49
- cli()
50
- {% else -%}
51
- import asyncio
52
- import click
53
- import config # noqa: F401 - Import to initialize DI container
54
-
55
- # Import your use cases here
56
- # from domain.interactors.create_user import CreateUser
57
-
58
-
59
- @click.group()
60
- def cli():
61
- """Vega Framework CLI Application"""
62
- pass
63
-
64
-
65
- @cli.command()
66
- def hello():
67
- """Example CLI command"""
68
- click.echo("Hello from Vega Framework!")
69
- click.echo("Add your CLI commands in presentation/cli/commands/")
70
-
71
-
72
- @cli.command()
73
- @click.option('--name', default='World', help='Name to greet')
74
- def greet(name: str):
75
- """Example command with parameter"""
76
- click.echo(f"Hello, {name}!")
77
-
78
-
79
- # Uncomment this block if you enable FastAPI support
80
- # @cli.command()
81
- # @click.option('--host', default='0.0.0.0', help='Host to bind')
82
- # @click.option('--port', default=8000, help='Port to bind')
83
- # @click.option('--reload', is_flag=True, help='Enable auto-reload')
84
- # def web(host: str, port: int, reload: bool):
85
- # """Start FastAPI web server"""
86
- # import uvicorn
87
- # from presentation.web.main import app
88
- #
89
- # click.echo(f"Starting web server on http://{host}:{port}")
90
- # uvicorn.run(
91
- # app,
92
- # host=host,
93
- # port=port,
94
- # reload=reload,
95
- # )
96
-
97
-
98
- # Auto-register custom commands from presentation/cli/commands/
99
- try:
100
- from presentation.cli.commands import get_commands
101
- for cmd in get_commands():
102
- cli.add_command(cmd)
103
- except ImportError:
104
- # cli/commands/ not created yet
105
- pass
106
-
107
-
108
- if __name__ == "__main__":
109
- cli()
110
- {% endif -%}
@@ -1,76 +0,0 @@
1
- """Main entry point for {{ project_name }}"""
2
- import click
3
- from vega.cli.utils import async_command
4
- import config # noqa: F401 - Import to initialize DI container
5
-
6
- # Import your use cases here
7
- # from domain.interactors.create_user import CreateUser
8
-
9
-
10
- @click.group()
11
- def cli():
12
- """Vega Framework Application - CLI and Web"""
13
- pass
14
-
15
-
16
- @cli.command()
17
- @click.option('--host', default='0.0.0.0', help='Host to bind')
18
- @click.option('--port', default=8000, help='Port to bind')
19
- @click.option('--reload', is_flag=True, help='Enable auto-reload')
20
- def web(host: str, port: int, reload: bool):
21
- """Start FastAPI web server"""
22
- import uvicorn
23
- from presentation.web.main import app
24
-
25
- click.echo(f"Starting web server on http://{host}:{port}")
26
- uvicorn.run(
27
- app,
28
- host=host,
29
- port=port,
30
- reload=reload,
31
- )
32
-
33
-
34
- @cli.command()
35
- def hello():
36
- """Example CLI command"""
37
- click.echo("Hello from Vega Framework!")
38
- click.echo("Add your CLI commands in presentation/cli/commands/")
39
-
40
-
41
- @cli.command()
42
- @click.option('--name', required=True, help='User name')
43
- @click.option('--email', required=True, help='User email')
44
- @async_command
45
- async def create_user(name: str, email: str):
46
- """
47
- Example async CLI command that uses an interactor.
48
-
49
- This demonstrates how to use async/await with Click commands
50
- to execute interactors and other async operations.
51
-
52
- Usage:
53
- python main.py create-user --name="John Doe" --email="john@example.com"
54
- """
55
- # Import your interactor
56
- # from domain.interactors.create_user import CreateUser
57
- # user = await CreateUser(name=name, email=email)
58
- # click.echo(f"Created user: {user.id} - {user.name}")
59
-
60
- # Placeholder implementation
61
- click.echo(f"Creating user: {name} ({email})")
62
- click.echo("Note: Replace this with your actual CreateUser interactor")
63
-
64
-
65
- # Auto-register custom commands from presentation/cli/commands/
66
- try:
67
- from presentation.cli.commands import get_commands
68
- for cmd in get_commands():
69
- cli.add_command(cmd)
70
- except ImportError:
71
- # cli/commands/ not created yet
72
- pass
73
-
74
-
75
- if __name__ == "__main__":
76
- cli()
@@ -1,84 +0,0 @@
1
- """Main entry point for {{ project_name }}"""
2
- import click
3
- from vega.cli.utils import async_command
4
- import config # noqa: F401 - Import to initialize DI container
5
-
6
- # Import your use cases here
7
- # from domain.interactors.create_user import CreateUser
8
-
9
-
10
- @click.group()
11
- def cli():
12
- """Vega Framework CLI Application"""
13
- pass
14
-
15
-
16
- @cli.command()
17
- def hello():
18
- """Example CLI command"""
19
- click.echo("Hello from Vega Framework!")
20
- click.echo("Add your CLI commands in presentation/cli/commands/")
21
-
22
-
23
- @cli.command()
24
- @click.option('--name', default='World', help='Name to greet')
25
- def greet(name: str):
26
- """Example command with parameter"""
27
- click.echo(f"Hello, {name}!")
28
-
29
-
30
- @cli.command()
31
- @click.option('--name', required=True, help='User name')
32
- @click.option('--email', required=True, help='User email')
33
- @async_command
34
- async def create_user(name: str, email: str):
35
- """
36
- Example async command that uses an interactor.
37
-
38
- This demonstrates how to use async/await with Click commands
39
- to execute interactors and other async operations.
40
-
41
- Usage:
42
- python main.py create-user --name="John Doe" --email="john@example.com"
43
- """
44
- # Import your interactor
45
- # from domain.interactors.create_user import CreateUser
46
- # user = await CreateUser(name=name, email=email)
47
- # click.echo(f"Created user: {user.id} - {user.name}")
48
-
49
- # Placeholder implementation
50
- click.echo(f"Creating user: {name} ({email})")
51
- click.echo("Note: Replace this with your actual CreateUser interactor")
52
-
53
-
54
- # Uncomment this block if you enable FastAPI support
55
- # @cli.command()
56
- # @click.option('--host', default='0.0.0.0', help='Host to bind')
57
- # @click.option('--port', default=8000, help='Port to bind')
58
- # @click.option('--reload', is_flag=True, help='Enable auto-reload')
59
- # def web(host: str, port: int, reload: bool):
60
- # """Start FastAPI web server"""
61
- # import uvicorn
62
- # from presentation.web.main import app
63
- #
64
- # click.echo(f"Starting web server on http://{host}:{port}")
65
- # uvicorn.run(
66
- # app,
67
- # host=host,
68
- # port=port,
69
- # reload=reload,
70
- # )
71
-
72
-
73
- # Auto-register custom commands from presentation/cli/commands/
74
- try:
75
- from presentation.cli.commands import get_commands
76
- for cmd in get_commands():
77
- cli.add_command(cmd)
78
- except ImportError:
79
- # cli/commands/ not created yet
80
- pass
81
-
82
-
83
- if __name__ == "__main__":
84
- cli()
File without changes