vega-framework 0.1.25__py3-none-any.whl → 0.1.27__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.
- vega/cli/commands/add.py +33 -14
- vega/cli/commands/generate.py +1 -29
- vega/cli/utils/__init__.py +5 -1
- vega/cli/utils/naming.py +20 -0
- {vega_framework-0.1.25.dist-info → vega_framework-0.1.27.dist-info}/METADATA +1 -1
- {vega_framework-0.1.25.dist-info → vega_framework-0.1.27.dist-info}/RECORD +9 -9
- {vega_framework-0.1.25.dist-info → vega_framework-0.1.27.dist-info}/WHEEL +0 -0
- {vega_framework-0.1.25.dist-info → vega_framework-0.1.27.dist-info}/entry_points.txt +0 -0
- {vega_framework-0.1.25.dist-info → vega_framework-0.1.27.dist-info}/licenses/LICENSE +0 -0
vega/cli/commands/add.py
CHANGED
@@ -113,28 +113,47 @@ def add_sqlalchemy_feature(project_path: Path, project_name: str):
|
|
113
113
|
|
114
114
|
def _create_user_example_repository(project_path: Path, project_name: str):
|
115
115
|
"""Create example User entity, repository, and SQLAlchemy implementation"""
|
116
|
-
from vega.cli.commands.generate import
|
116
|
+
from vega.cli.commands.generate import _generate_entity, _generate_repository, _generate_sqlalchemy_model, _generate_infrastructure_repository
|
117
|
+
import sys
|
118
|
+
from io import StringIO
|
117
119
|
|
118
120
|
# Generate User entity
|
119
|
-
click.echo(" +
|
120
|
-
|
121
|
+
click.echo(" + Creating User entity...")
|
122
|
+
_generate_entity(project_path, project_name, 'User', 'user')
|
121
123
|
|
122
|
-
# Generate UserRepository interface
|
123
|
-
click.echo(" +
|
124
|
-
|
124
|
+
# Generate UserRepository interface (without next steps)
|
125
|
+
click.echo(" + Creating UserRepository interface...")
|
126
|
+
original_stdout = sys.stdout
|
127
|
+
sys.stdout = StringIO() # Suppress "Next steps" output
|
128
|
+
|
129
|
+
try:
|
130
|
+
_generate_repository(project_path, project_name, 'UserRepository', 'user_repository', implementation=None)
|
131
|
+
finally:
|
132
|
+
sys.stdout = original_stdout
|
125
133
|
|
126
134
|
# Generate SQLAlchemy UserModel
|
127
|
-
click.echo(" +
|
128
|
-
|
135
|
+
click.echo(" + Creating UserModel (SQLAlchemy)...")
|
136
|
+
sys.stdout = StringIO() # Suppress verbose output
|
137
|
+
try:
|
138
|
+
_generate_sqlalchemy_model(project_path, project_name, 'User', 'user')
|
139
|
+
finally:
|
140
|
+
sys.stdout = original_stdout
|
129
141
|
|
130
142
|
# Generate SQLAlchemy repository implementation
|
131
|
-
click.echo(" +
|
132
|
-
|
133
|
-
|
134
|
-
|
143
|
+
click.echo(" + Creating SQLAlchemyUserRepository implementation...")
|
144
|
+
_generate_infrastructure_repository(
|
145
|
+
project_path,
|
146
|
+
'UserRepository',
|
147
|
+
'user_repository',
|
148
|
+
'User',
|
149
|
+
'user',
|
150
|
+
'sql'
|
151
|
+
)
|
152
|
+
|
153
|
+
click.echo(click.style("\n [OK] Example User repository created!", fg='green'))
|
135
154
|
click.echo("\nGenerated files:")
|
136
155
|
click.echo(" - domain/entities/user.py")
|
137
156
|
click.echo(" - domain/repositories/user_repository.py")
|
138
|
-
click.echo(" - infrastructure/models/
|
157
|
+
click.echo(" - infrastructure/models/user.py")
|
139
158
|
click.echo(" - infrastructure/repositories/sqlalchemy_user_repository.py")
|
140
|
-
click.echo("\
|
159
|
+
click.echo("\nNext step: Update config.py to register SQLAlchemyUserRepository in SERVICES dict")
|
vega/cli/commands/generate.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
"""Generate command - Create components in Vega project"""
|
2
2
|
import click
|
3
|
-
import re
|
4
3
|
from pathlib import Path
|
5
4
|
|
6
5
|
from vega.cli.templates import (
|
@@ -19,34 +18,7 @@ from vega.cli.templates import (
|
|
19
18
|
render_template,
|
20
19
|
)
|
21
20
|
from vega.cli.scaffolds import create_fastapi_scaffold
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
def to_snake_case(name: str) -> str:
|
26
|
-
"""Convert CamelCase to snake_case"""
|
27
|
-
name = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
|
28
|
-
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', name).lower()
|
29
|
-
|
30
|
-
|
31
|
-
def to_pascal_case(name: str) -> str:
|
32
|
-
"""Convert strings to PascalCase, handling separators and camelCase input"""
|
33
|
-
cleaned = name.strip()
|
34
|
-
if not cleaned:
|
35
|
-
return ""
|
36
|
-
|
37
|
-
# Normalize common separators to spaces
|
38
|
-
normalized = cleaned.replace('-', ' ').replace('_', ' ')
|
39
|
-
if ' ' in normalized:
|
40
|
-
parts = normalized.split()
|
41
|
-
else:
|
42
|
-
parts = re.findall(r'[A-Z]+(?=$|[A-Z][a-z0-9])|[A-Z]?[a-z0-9]+|[0-9]+', cleaned)
|
43
|
-
if not parts:
|
44
|
-
parts = [cleaned]
|
45
|
-
|
46
|
-
def _pascal_piece(piece: str) -> str:
|
47
|
-
return piece if piece.isupper() else piece[:1].upper() + piece[1:].lower()
|
48
|
-
|
49
|
-
return ''.join(_pascal_piece(part) for part in parts if part)
|
21
|
+
from vega.cli.utils import to_snake_case, to_pascal_case
|
50
22
|
|
51
23
|
|
52
24
|
def _resolve_implementation_names(class_name: str, implementation: str) -> tuple[str, str]:
|
vega/cli/utils/__init__.py
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
"""Utility modules for Vega CLI"""
|
2
|
-
from .naming import NamingConverter
|
2
|
+
from .naming import NamingConverter, to_snake_case, to_pascal_case, to_camel_case, to_kebab_case
|
3
3
|
from .messages import CLIMessages
|
4
4
|
from .validators import validate_project_name, validate_path_exists
|
5
5
|
from .async_support import async_command, coro
|
6
6
|
|
7
7
|
__all__ = [
|
8
8
|
"NamingConverter",
|
9
|
+
"to_snake_case",
|
10
|
+
"to_pascal_case",
|
11
|
+
"to_camel_case",
|
12
|
+
"to_kebab_case",
|
9
13
|
"CLIMessages",
|
10
14
|
"validate_project_name",
|
11
15
|
"validate_path_exists",
|
vega/cli/utils/naming.py
CHANGED
@@ -2,6 +2,26 @@
|
|
2
2
|
import re
|
3
3
|
|
4
4
|
|
5
|
+
def to_snake_case(name: str) -> str:
|
6
|
+
"""Convert CamelCase/PascalCase to snake_case (standalone function for convenience)"""
|
7
|
+
return NamingConverter.to_snake_case(name)
|
8
|
+
|
9
|
+
|
10
|
+
def to_pascal_case(name: str) -> str:
|
11
|
+
"""Convert any format to PascalCase (standalone function for convenience)"""
|
12
|
+
return NamingConverter.to_pascal_case(name)
|
13
|
+
|
14
|
+
|
15
|
+
def to_camel_case(name: str) -> str:
|
16
|
+
"""Convert any format to camelCase (standalone function for convenience)"""
|
17
|
+
return NamingConverter.to_camel_case(name)
|
18
|
+
|
19
|
+
|
20
|
+
def to_kebab_case(name: str) -> str:
|
21
|
+
"""Convert any format to kebab-case (standalone function for convenience)"""
|
22
|
+
return NamingConverter.to_kebab_case(name)
|
23
|
+
|
24
|
+
|
5
25
|
class NamingConverter:
|
6
26
|
"""Utility class for converting between naming conventions"""
|
7
27
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
vega/__init__.py,sha256=A05RwOYXooAZUz3GnbJ--ofLXgtRZK9gaSmsLVRdGPY,1811
|
2
2
|
vega/cli/__init__.py,sha256=NCzOOyhKHqLeN1r80ekhMfkQwBdAQXKcKiKoNwYPNiY,304
|
3
3
|
vega/cli/commands/__init__.py,sha256=UH7MdYduBG_YoulgdiWkUCtcgGLzuYRGFzxaqoa0pyg,19
|
4
|
-
vega/cli/commands/add.py,sha256=
|
5
|
-
vega/cli/commands/generate.py,sha256=
|
4
|
+
vega/cli/commands/add.py,sha256=5Li588W1KWQqCKV0VZSURx4J3I8dQE297c4V_3anf5U,6465
|
5
|
+
vega/cli/commands/generate.py,sha256=Rb4hXPHm_pFEKFViWJ2sMzyUNJWCCoTjLq2H2GvruGc,33720
|
6
6
|
vega/cli/commands/init.py,sha256=kBRtntHT7e-y9uOwZm9o9IUED64e_pO5fBEsIx5m-X8,5592
|
7
7
|
vega/cli/commands/migrate.py,sha256=00swKeVhmKr1_1VJhg3GpIMcJ6Jfgz5FUpmJoLf5qSQ,3805
|
8
8
|
vega/cli/commands/update.py,sha256=0zRWkHvQwKGlJL9XF3bi--dThkFapyNOugL6AgGr6Ic,5897
|
@@ -52,10 +52,10 @@ vega/cli/templates/web/routes_init.py.j2,sha256=uyeuLGRZ-bDY-xefJ1eI9wU1kt9z7lwo
|
|
52
52
|
vega/cli/templates/web/routes_init_autodiscovery.py.j2,sha256=jxvFGmWsmW1tMCeOoYfPi4l0U94YkUxcZm2VFsGgTsw,310
|
53
53
|
vega/cli/templates/web/user_models.py.j2,sha256=_lbG-oL8-C7Lk3-48YuKR65USD5TV4D9JNoFT9kktIM,1250
|
54
54
|
vega/cli/templates/web/users_route.py.j2,sha256=TjKu28jxVY3SwToptjOZoclUnZkobbDOUfOYlDkjs40,1927
|
55
|
-
vega/cli/utils/__init__.py,sha256=
|
55
|
+
vega/cli/utils/__init__.py,sha256=18sBatA5Y9TaJCCJqSCYRyF0XJrSty_UlPeZrJPlTlI,513
|
56
56
|
vega/cli/utils/async_support.py,sha256=eU4HVZUCeJclZzpQQoDysiJ_qewwyCtu3C0TcSsuKl4,1511
|
57
57
|
vega/cli/utils/messages.py,sha256=EtRWqMD6BUGaIuEWiH0cigpQPEaLOhnURSACSzdxBdA,2399
|
58
|
-
vega/cli/utils/naming.py,sha256=
|
58
|
+
vega/cli/utils/naming.py,sha256=vrXOqoZYty_gX9HPv7scPduh4My6uEl-CCbyP_WoPAQ,4242
|
59
59
|
vega/cli/utils/validators.py,sha256=YhQ1KQsALdovMh9zgCsuh_I2Tm9C7fBzBkLb05pgX40,3028
|
60
60
|
vega/di/__init__.py,sha256=fgXpF4qaFJrkzAjb_QmZkpJ_thJ2yQQvQgfbd03v4AE,1599
|
61
61
|
vega/di/container.py,sha256=o4cpxCx53wWSNLcrr8Qt9tc7_YiDtHpYvUrdruNVwEc,5467
|
@@ -72,8 +72,8 @@ vega/patterns/repository.py,sha256=uYUyLs-O8OqW1Wb9ZqIo8UUcCjZ5UFuHors_F2iDg9A,1
|
|
72
72
|
vega/patterns/service.py,sha256=buFRgJoeQtZQK22Upb4vh84c1elWKFXWBaB0X4RaruE,1374
|
73
73
|
vega/settings/__init__.py,sha256=Eb8PMUyXAlCAQIcL2W8QhTTUHUbVlkAfXdpTUlADo1I,786
|
74
74
|
vega/settings/base.py,sha256=bL45hyoa3t-hQOvur860eSo7O833sQMsXJJPwbTVbwE,1321
|
75
|
-
vega_framework-0.1.
|
76
|
-
vega_framework-0.1.
|
77
|
-
vega_framework-0.1.
|
78
|
-
vega_framework-0.1.
|
79
|
-
vega_framework-0.1.
|
75
|
+
vega_framework-0.1.27.dist-info/METADATA,sha256=Jl0mO0_4DJtvUlJLYrqqX1rJaQEeIUcEpPROD18bIdA,12349
|
76
|
+
vega_framework-0.1.27.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
77
|
+
vega_framework-0.1.27.dist-info/entry_points.txt,sha256=p3gyTmPYjNRLbuiKS-hG3ytWd-ssBweFy6VZ-F9FTNk,42
|
78
|
+
vega_framework-0.1.27.dist-info/licenses/LICENSE,sha256=wlHh1MBTcs2kSQr99P30mZ61s7uh7Cp9Rk0YiJxots0,1084
|
79
|
+
vega_framework-0.1.27.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|