|
16 | 16 | import logging
|
17 | 17 | from importlib import import_module
|
18 | 18 | from pathlib import Path
|
19 |
| -from typing import Literal |
20 | 19 | from typing import Optional
|
21 | 20 |
|
22 | 21 | from fractal_tasks_core.dev.lib_args_schemas import (
|
|
28 | 27 | logging.basicConfig(level=logging.INFO)
|
29 | 28 |
|
30 | 29 |
|
31 |
| -def check_args_schema_version(args_schema_version: Optional[str]) -> str: |
32 |
| - if args_schema_version is None: |
33 |
| - import pydantic |
34 |
| - |
35 |
| - if pydantic.__version__.startswith("1"): |
36 |
| - args_schema_version = "pydantic_v1" |
37 |
| - elif pydantic.__version__.startswith("2"): |
38 |
| - args_schema_version = "pydantic_v2" |
39 |
| - else: |
40 |
| - raise ValueError(f"Unsupported {pydantic.__version__=}") |
41 |
| - elif args_schema_version not in ["pydantic_v1", "pydantic_v2"]: |
42 |
| - raise ValueError(f"Unsupported {args_schema_version=}") |
43 |
| - return args_schema_version |
| 30 | +ARGS_SCHEMA_VERSION = "pydantic_v2" |
44 | 31 |
|
45 | 32 |
|
46 | 33 | def create_manifest(
|
47 | 34 | package: str = "fractal_tasks_core",
|
48 | 35 | manifest_version: str = "2",
|
49 | 36 | has_args_schemas: bool = True,
|
50 |
| - args_schema_version: Literal["pydantic_v1", "pydantic_v2", None] = None, |
51 | 37 | docs_link: Optional[str] = None,
|
52 | 38 | custom_pydantic_models: Optional[list[tuple[str, str, str]]] = None,
|
53 | 39 | ):
|
@@ -85,17 +71,14 @@ def create_manifest(
|
85 | 71 |
|
86 | 72 | logging.info("Start generating a new manifest")
|
87 | 73 |
|
88 |
| - args_schema_version = check_args_schema_version(args_schema_version) |
89 |
| - logging.warning(f"{args_schema_version=}") |
90 |
| - |
91 | 74 | # Prepare an empty manifest
|
92 | 75 | manifest = dict(
|
93 | 76 | manifest_version=manifest_version,
|
94 | 77 | task_list=[],
|
95 | 78 | has_args_schemas=has_args_schemas,
|
96 | 79 | )
|
97 | 80 | if has_args_schemas:
|
98 |
| - manifest["args_schema_version"] = args_schema_version |
| 81 | + manifest["args_schema_version"] = ARGS_SCHEMA_VERSION |
99 | 82 |
|
100 | 83 | # Prepare a default value of docs_link
|
101 | 84 | if package == "fractal_tasks_core" and docs_link is None:
|
@@ -138,7 +121,6 @@ def create_manifest(
|
138 | 121 | executable,
|
139 | 122 | package=package,
|
140 | 123 | custom_pydantic_models=custom_pydantic_models,
|
141 |
| - args_schema_version=args_schema_version, |
142 | 124 | )
|
143 | 125 | logging.info(f"[{executable}] END (new schema)")
|
144 | 126 | task_dict[f"args_schema_{kind}"] = schema
|
|
0 commit comments