cadwyn 3.6.6__tar.gz → 3.7.0__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.
Potentially problematic release.
This version of cadwyn might be problematic. Click here for more details.
- {cadwyn-3.6.6 → cadwyn-3.7.0}/PKG-INFO +1 -1
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/__main__.py +43 -2
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/codegen/_main.py +3 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/pyproject.toml +1 -1
- {cadwyn-3.6.6 → cadwyn-3.7.0}/LICENSE +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/README.md +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/__init__.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/_asts.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/_compat.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/_package_utils.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/_utils.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/applications.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/codegen/README.md +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/codegen/__init__.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/codegen/_common.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/codegen/_plugins/__init__.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/codegen/_plugins/class_migrations.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/codegen/_plugins/class_rebuilding.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/codegen/_plugins/class_renaming.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/codegen/_plugins/import_auto_adding.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/codegen/_plugins/latest_version_aliasing.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/codegen/_plugins/module_migrations.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/exceptions.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/main.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/py.typed +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/routing.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/structure/__init__.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/structure/common.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/structure/data.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/structure/endpoints.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/structure/enums.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/structure/modules.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/structure/schemas.py +0 -0
- {cadwyn-3.6.6 → cadwyn-3.7.0}/cadwyn/structure/versions.py +0 -0
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import importlib
|
|
2
2
|
import sys
|
|
3
|
+
import warnings
|
|
3
4
|
from pathlib import Path
|
|
4
5
|
from typing import Any
|
|
5
6
|
|
|
6
7
|
import typer
|
|
7
8
|
|
|
9
|
+
from cadwyn.exceptions import CadwynError
|
|
8
10
|
from cadwyn.structure.versions import VersionBundle
|
|
9
11
|
|
|
10
12
|
app = typer.Typer(
|
|
@@ -22,8 +24,8 @@ def version_callback(value: bool):
|
|
|
22
24
|
raise typer.Exit
|
|
23
25
|
|
|
24
26
|
|
|
25
|
-
@app.command(name="generate-code-for-versioned-packages")
|
|
26
|
-
def
|
|
27
|
+
@app.command(name="generate-code-for-versioned-packages", hidden=True)
|
|
28
|
+
def deprecated_generate_versioned_packages(
|
|
27
29
|
path_to_template_package: str = typer.Argument(
|
|
28
30
|
...,
|
|
29
31
|
help=(
|
|
@@ -43,6 +45,12 @@ def generate_versioned_packages(
|
|
|
43
45
|
),
|
|
44
46
|
) -> None:
|
|
45
47
|
"""For each version in the version bundle, generate a versioned package based on the template package"""
|
|
48
|
+
warnings.warn(
|
|
49
|
+
"`cadwyn generate-code-for-versioned-packages` is deprecated. Please, use `cadwyn codegen` instead",
|
|
50
|
+
DeprecationWarning,
|
|
51
|
+
stacklevel=1,
|
|
52
|
+
)
|
|
53
|
+
|
|
46
54
|
from .codegen._main import generate_code_for_versioned_packages
|
|
47
55
|
|
|
48
56
|
sys.path.append(str(Path.cwd()))
|
|
@@ -59,6 +67,39 @@ def generate_versioned_packages(
|
|
|
59
67
|
)
|
|
60
68
|
|
|
61
69
|
|
|
70
|
+
@app.command(
|
|
71
|
+
name="codegen",
|
|
72
|
+
help=(
|
|
73
|
+
"For each version in the version bundle, generate a versioned package based on the "
|
|
74
|
+
"`latest_schema_package` package"
|
|
75
|
+
),
|
|
76
|
+
short_help="Generate code for all versions of schemas",
|
|
77
|
+
)
|
|
78
|
+
def generate_versioned_packages(
|
|
79
|
+
full_path_to_version_bundle: str = typer.Argument(
|
|
80
|
+
...,
|
|
81
|
+
help="The python path to the version bundle. Format: 'path.to.version_bundle:my_version_bundle_var'",
|
|
82
|
+
show_default=False,
|
|
83
|
+
),
|
|
84
|
+
) -> None:
|
|
85
|
+
from .codegen._main import generate_code_for_versioned_packages
|
|
86
|
+
|
|
87
|
+
sys.path.append(str(Path.cwd()))
|
|
88
|
+
path_to_version_bundle, version_bundle_variable_name = full_path_to_version_bundle.split(":")
|
|
89
|
+
version_bundle_module = importlib.import_module(path_to_version_bundle)
|
|
90
|
+
possibly_version_bundle = getattr(version_bundle_module, version_bundle_variable_name)
|
|
91
|
+
version_bundle = _get_version_bundle(possibly_version_bundle)
|
|
92
|
+
|
|
93
|
+
if version_bundle.latest_schemas_package is None: # pragma: no cover
|
|
94
|
+
raise CadwynError("VersionBundle requires a 'latest_schemas_package' argument to generate schemas.")
|
|
95
|
+
|
|
96
|
+
return generate_code_for_versioned_packages(
|
|
97
|
+
version_bundle.latest_schemas_package,
|
|
98
|
+
version_bundle,
|
|
99
|
+
ignore_coverage_for_latest_aliases=True,
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
|
|
62
103
|
def _get_version_bundle(possibly_version_bundle: Any) -> VersionBundle:
|
|
63
104
|
if not isinstance(possibly_version_bundle, VersionBundle):
|
|
64
105
|
err = TypeError(
|
|
@@ -96,6 +96,7 @@ def _generate_versioned_directories(
|
|
|
96
96
|
migration_plugins: Collection[MigrationPlugin],
|
|
97
97
|
):
|
|
98
98
|
for version in versions:
|
|
99
|
+
print(f"Generating code for version={version.value!s}") # noqa: T201
|
|
99
100
|
global_context = GlobalCodegenContext(
|
|
100
101
|
current_version=version,
|
|
101
102
|
versions=versions,
|
|
@@ -104,6 +105,7 @@ def _generate_versioned_directories(
|
|
|
104
105
|
modules=modules,
|
|
105
106
|
extra=extra_context,
|
|
106
107
|
)
|
|
108
|
+
|
|
107
109
|
_generate_directory_for_version(template_package, codegen_plugins, version, global_context)
|
|
108
110
|
for plugin in migration_plugins:
|
|
109
111
|
plugin(global_context)
|
|
@@ -117,6 +119,7 @@ def _generate_directory_for_version(
|
|
|
117
119
|
):
|
|
118
120
|
template_dir = get_package_path_from_module(template_package)
|
|
119
121
|
version_dir = get_version_dir_path(template_package, version.value)
|
|
122
|
+
|
|
120
123
|
for (
|
|
121
124
|
_relative_path_to_file,
|
|
122
125
|
template_module,
|
|
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
|