amsdal_cli 0.5.5__py3-none-any.whl → 0.5.6__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.
- amsdal_cli/__about__.py +1 -1
- amsdal_cli/commands/migrations/sub_commands/make.py +3 -0
- amsdal_cli/commands/plugin/command.py +5 -3
- amsdal_cli/commands/plugin/templates/src/transactions/example_transaction.py +4 -4
- amsdal_cli/utils/schema_repository.py +4 -2
- {amsdal_cli-0.5.5.dist-info → amsdal_cli-0.5.6.dist-info}/METADATA +1 -1
- {amsdal_cli-0.5.5.dist-info → amsdal_cli-0.5.6.dist-info}/RECORD +10 -10
- {amsdal_cli-0.5.5.dist-info → amsdal_cli-0.5.6.dist-info}/WHEEL +0 -0
- {amsdal_cli-0.5.5.dist-info → amsdal_cli-0.5.6.dist-info}/entry_points.txt +0 -0
- {amsdal_cli-0.5.5.dist-info → amsdal_cli-0.5.6.dist-info}/licenses/LICENSE.txt +0 -0
amsdal_cli/__about__.py
CHANGED
|
@@ -4,6 +4,7 @@ from typing import TYPE_CHECKING
|
|
|
4
4
|
from typing import Annotated
|
|
5
5
|
|
|
6
6
|
import typer
|
|
7
|
+
from amsdal_utils.models.enums import ModuleType
|
|
7
8
|
from rich import print as rprint
|
|
8
9
|
|
|
9
10
|
from amsdal_cli.commands.migrations.app import sub_app
|
|
@@ -45,6 +46,7 @@ def _sync_make_migrations(
|
|
|
45
46
|
core_migrations_path=CORE_MIGRATIONS_PATH,
|
|
46
47
|
app_migrations_path=migrations_dir,
|
|
47
48
|
contrib_migrations_directory_name=settings.CONTRIB_MIGRATIONS_DIRECTORY_NAME,
|
|
49
|
+
module_type=ModuleType.CONTRIB if cli_config.is_plugin else ModuleType.USER,
|
|
48
50
|
)
|
|
49
51
|
|
|
50
52
|
try:
|
|
@@ -98,6 +100,7 @@ async def _async_make_migrations(
|
|
|
98
100
|
core_migrations_path=CORE_MIGRATIONS_PATH,
|
|
99
101
|
app_migrations_path=migrations_dir,
|
|
100
102
|
contrib_migrations_directory_name=settings.CONTRIB_MODELS_PACKAGE_NAME,
|
|
103
|
+
module_type=ModuleType.CONTRIB if cli_config.is_plugin else ModuleType.USER,
|
|
101
104
|
)
|
|
102
105
|
|
|
103
106
|
try:
|
|
@@ -79,6 +79,8 @@ def plugin_command(
|
|
|
79
79
|
'plugin_name_slugify': slugify(plugin_name),
|
|
80
80
|
'plugin_name_snake': to_snake_case(plugin_name),
|
|
81
81
|
'amsdal_version': amsdal_version,
|
|
82
|
+
'state_backend': 'sqlite-state-async' if is_async_mode else 'sqlite-state',
|
|
83
|
+
'historical_backend': 'sqlite-historical-async' if is_async_mode else 'sqlite-historical',
|
|
82
84
|
'models_format': models_format.value,
|
|
83
85
|
'is_async_mode': is_async_mode,
|
|
84
86
|
}
|
|
@@ -135,12 +137,12 @@ def _create_example_model(output_path: Path, models_format: ModelsFormat, contex
|
|
|
135
137
|
write_file(json_content, model_dir / 'model.json', confirm_overwriting=False)
|
|
136
138
|
else:
|
|
137
139
|
# Create Python model
|
|
138
|
-
py_content = f"""from
|
|
139
|
-
from amsdal.types import Field
|
|
140
|
+
py_content = f"""from amsdal_models.classes.model import Model
|
|
140
141
|
from amsdal_utils.models.enums import ModuleType
|
|
142
|
+
from pydantic.fields import Field
|
|
141
143
|
|
|
142
144
|
|
|
143
|
-
class ExampleModel(
|
|
145
|
+
class ExampleModel(Model):
|
|
144
146
|
\"\"\"Example model for {context['plugin_name']} plugin.\"\"\"
|
|
145
147
|
|
|
146
148
|
__module_type__ = ModuleType.CONTRIB
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
{% if ctx.is_async_mode %}from
|
|
1
|
+
{% if ctx.is_async_mode %}from amsdal_data.transactions.decorators import async_transaction
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
@
|
|
4
|
+
@async_transaction(name='ExampleTransaction')
|
|
5
5
|
async def example_transaction(name: str, description: str = "") -> None:
|
|
6
6
|
"""
|
|
7
7
|
Example transaction for {{ ctx.plugin_name }} plugin.
|
|
@@ -21,7 +21,7 @@ async def example_transaction(name: str, description: str = "") -> None:
|
|
|
21
21
|
# )
|
|
22
22
|
# await new_model.async_save()
|
|
23
23
|
pass
|
|
24
|
-
{% else %}from
|
|
24
|
+
{% else %}from amsdal_data.transactions.decorators import transaction
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
@transaction(name='ExampleTransaction')
|
|
@@ -44,4 +44,4 @@ def example_transaction(name: str, description: str = "") -> None:
|
|
|
44
44
|
# )
|
|
45
45
|
# new_model.save()
|
|
46
46
|
pass
|
|
47
|
-
{% endif %}
|
|
47
|
+
{% endif %}
|
|
@@ -52,13 +52,15 @@ def build_schema_repository(
|
|
|
52
52
|
|
|
53
53
|
_contrib_modules_paths.append(contrib_models_module_path)
|
|
54
54
|
|
|
55
|
+
target_module_type = ModuleType.CONTRIB if cli_config.is_plugin else ModuleType.USER
|
|
56
|
+
|
|
55
57
|
if cli_config.models_format == ModelsFormat.PY:
|
|
56
58
|
if skip_user_models:
|
|
57
59
|
user_schema_loader = DummySchemaLoader()
|
|
58
60
|
else:
|
|
59
61
|
user_schema_loader = ClassSchemaLoader(
|
|
60
62
|
settings.USER_MODELS_MODULE,
|
|
61
|
-
class_filter=lambda cls: cls.__module_type__ ==
|
|
63
|
+
class_filter=lambda cls: cls.__module_type__ == target_module_type,
|
|
62
64
|
) # type: ignore[assignment]
|
|
63
65
|
else:
|
|
64
66
|
_models_path = cli_config.app_directory / SOURCES_DIR / 'models'
|
|
@@ -66,7 +68,7 @@ def build_schema_repository(
|
|
|
66
68
|
SchemasDirectory(
|
|
67
69
|
path=_models_path,
|
|
68
70
|
module_path=settings.USER_MODELS_MODULE,
|
|
69
|
-
module_type=
|
|
71
|
+
module_type=target_module_type,
|
|
70
72
|
),
|
|
71
73
|
)
|
|
72
74
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
amsdal_cli/Third-Party Materials - AMSDAL Dependencies - License Notices.md,sha256=uHJlGG0D4tbpUi8cq-497NNO9ltQ67a5448k-T14HTw,68241
|
|
2
|
-
amsdal_cli/__about__.py,sha256=
|
|
2
|
+
amsdal_cli/__about__.py,sha256=FVhogeUXIvF04uzQhGOvAB-kHp5Toh3bylNItK77X40,124
|
|
3
3
|
amsdal_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
amsdal_cli/app.py,sha256=_ucuLT5ospf1ifFKEG0IMfVnxKjnvPUQ4iMhkvOfCrc,466
|
|
5
5
|
amsdal_cli/main.py,sha256=LtH-BD1eJrAUecjKzC8Gx7kYFUstOMH1erdeJUVqFB8,144
|
|
@@ -149,7 +149,7 @@ amsdal_cli/commands/migrations/utils.py,sha256=Fvu6NlIFL3OAz0MhLkvnucIsHBZlDDCOZ
|
|
|
149
149
|
amsdal_cli/commands/migrations/sub_commands/__init__.py,sha256=HHxiJxcbJUQLv6QOLwcvcSjTYJTixiRJ89IUb1H7sRo,1100
|
|
150
150
|
amsdal_cli/commands/migrations/sub_commands/apply.py,sha256=4MyO_gP7r4PBRz_agi2xnoMTHcLlvxlo4335mmLrpYQ,8696
|
|
151
151
|
amsdal_cli/commands/migrations/sub_commands/list.py,sha256=vC-oeTVHjYNzI_HhiylZSNeOsIFvnDZ6TRwrqQ-wpUk,5833
|
|
152
|
-
amsdal_cli/commands/migrations/sub_commands/make.py,sha256=
|
|
152
|
+
amsdal_cli/commands/migrations/sub_commands/make.py,sha256=fWfsH3bRKDlYQp1SfbP4WNT7rOW7D5aCXUDkfjK2iLU,6541
|
|
153
153
|
amsdal_cli/commands/migrations/sub_commands/make_contrib.py,sha256=KbB19I95Uh3dy00Peg9dDc09rcxI2c8FrTIazSaTVw8,6449
|
|
154
154
|
amsdal_cli/commands/new/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
155
155
|
amsdal_cli/commands/new/command.py,sha256=NDuDZNwreyuHsv4tbE-yrNOJViB8wk35IcKvGKQXPXo,3302
|
|
@@ -162,7 +162,7 @@ amsdal_cli/commands/new/templates/.amsdal/.dependencies,sha256=47DEQpj8HBSa-_TIm
|
|
|
162
162
|
amsdal_cli/commands/new/templates/.amsdal/.environment,sha256=DW5AeeNnA-vTfAByL1iR0osOKBHcEUsSkhUSOtzONgU,4
|
|
163
163
|
amsdal_cli/commands/new/templates/.amsdal/.secrets,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
164
164
|
amsdal_cli/commands/plugin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
165
|
-
amsdal_cli/commands/plugin/command.py,sha256=
|
|
165
|
+
amsdal_cli/commands/plugin/command.py,sha256=xNjqRr2npAobhsPJTzDD_W2gNpreCGxc5z7I2YBRGn8,4781
|
|
166
166
|
amsdal_cli/commands/plugin/templates/.amsdal-cli,sha256=fhvckKLvaFEzt6ePdgre01vFkr-_AmWHVfJlD6rZZaQ,289
|
|
167
167
|
amsdal_cli/commands/plugin/templates/README.md,sha256=FMwYTXOJ0ZsrhY-wq-c3pH8OeT-oAckjK48s5kh9lW4,1231
|
|
168
168
|
amsdal_cli/commands/plugin/templates/config.yml,sha256=ZEjr5RA0iSG3Nwf_N11WFwpNI8xKbcqoEip_BZgtOtw,635
|
|
@@ -171,7 +171,7 @@ amsdal_cli/commands/plugin/templates/src/__about__.py,sha256=IMjkMO3twhQzluVTo8Z
|
|
|
171
171
|
amsdal_cli/commands/plugin/templates/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
172
172
|
amsdal_cli/commands/plugin/templates/src/models/__init__.py,sha256=93F5MjA9NayBY6wY_ypyf55KYER3eovgj5K0IM8w3Qs,49
|
|
173
173
|
amsdal_cli/commands/plugin/templates/src/transactions/__init__.py,sha256=NzpIjXV6XKtBiZoteisyuWYjZNebuh3EAZ3tzrkAFvU,55
|
|
174
|
-
amsdal_cli/commands/plugin/templates/src/transactions/example_transaction.py,sha256=
|
|
174
|
+
amsdal_cli/commands/plugin/templates/src/transactions/example_transaction.py,sha256=UFSXw7UbYtTSAFuKji0E6c-XTIVASjduOLFAvQJmqVE,1328
|
|
175
175
|
amsdal_cli/commands/register_connection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
176
176
|
amsdal_cli/commands/register_connection/command.py,sha256=MdW8j1Q4TfufMl3Z4JVECX_OXIVya0tQ-vJj0Zc5Bdk,5145
|
|
177
177
|
amsdal_cli/commands/register_connection/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -216,15 +216,15 @@ amsdal_cli/utils/cli_config.py,sha256=t1R-U6lh3xzKkBpTgd-Wg7scVeEmf-RAPaL_-DSDaP
|
|
|
216
216
|
amsdal_cli/utils/copier.py,sha256=nKo0-P1AhWIb7IjbndYr3Vnvd_avCa566iIbXLK_5a0,5122
|
|
217
217
|
amsdal_cli/utils/markdown_patch.py,sha256=RW58pJhRoUYW1fhId70hw8MD2DF-UqXTYfv7JrSGz5I,1816
|
|
218
218
|
amsdal_cli/utils/render_template.py,sha256=wVjw6K4JZDKz0VElC76Dkgme8di4yfhHIb6hVju9el4,645
|
|
219
|
-
amsdal_cli/utils/schema_repository.py,sha256=
|
|
219
|
+
amsdal_cli/utils/schema_repository.py,sha256=rskAFQEcRIVapmYotWo_QZa57Xd2dXkh6z9kd1xn6yo,3029
|
|
220
220
|
amsdal_cli/utils/text.py,sha256=oAC6H6nhuH_jSdKqbC3vRKpgzs2Qot7DluojWOwh9GU,2489
|
|
221
221
|
amsdal_cli/utils/vcs/__init__.py,sha256=WWxqfpYP5AK9zGj6_KzKfbQCX6H1FCLqHfQyVnRof9E,513
|
|
222
222
|
amsdal_cli/utils/vcs/base.py,sha256=jC05ExJZDnyHAsW7_4IDf8gQcYgK4dXq3zNlFIX66T4,422
|
|
223
223
|
amsdal_cli/utils/vcs/dummy.py,sha256=Lk8MT-b0YlHHUsiXsq5cvmPwcl4jTYdo8piN5_C8ORA,434
|
|
224
224
|
amsdal_cli/utils/vcs/enums.py,sha256=tYR9LN1IOr8BZFbSeX_vDlhn8fPl4IU-Yakii8lRDYs,69
|
|
225
225
|
amsdal_cli/utils/vcs/git.py,sha256=xHynbZcV6p2D3RFCwu1MGGpV9D7eK-pGUtO8kVexTQM,1269
|
|
226
|
-
amsdal_cli-0.5.
|
|
227
|
-
amsdal_cli-0.5.
|
|
228
|
-
amsdal_cli-0.5.
|
|
229
|
-
amsdal_cli-0.5.
|
|
230
|
-
amsdal_cli-0.5.
|
|
226
|
+
amsdal_cli-0.5.6.dist-info/METADATA,sha256=9fe080hVYqf7OMsJ-5nd7slBMVaKoyBssakkFiUdMvs,57105
|
|
227
|
+
amsdal_cli-0.5.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
228
|
+
amsdal_cli-0.5.6.dist-info/entry_points.txt,sha256=GC-8LZsD3W--Pd9_gD4W3tw3ZZyPbSvkZ-qWc9Fx0NI,47
|
|
229
|
+
amsdal_cli-0.5.6.dist-info/licenses/LICENSE.txt,sha256=hG-541PFYfNJi9WRZi_hno91UyqNg7YLK8LR3vLblZA,27355
|
|
230
|
+
amsdal_cli-0.5.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|