fractal-task-tools 0.0.10__tar.gz → 0.0.12__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 fractal-task-tools might be problematic. Click here for more details.

Files changed (36) hide show
  1. {fractal_task_tools-0.0.10/src/fractal_task_tools.egg-info → fractal_task_tools-0.0.12}/PKG-INFO +3 -2
  2. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/pyproject.toml +4 -3
  3. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/src/fractal_task_tools/__init__.py +1 -1
  4. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/src/fractal_task_tools/_args_schemas.py +37 -12
  5. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/src/fractal_task_tools/_cli.py +15 -0
  6. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/src/fractal_task_tools/_create_manifest.py +15 -1
  7. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12/src/fractal_task_tools.egg-info}/PKG-INFO +3 -2
  8. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/src/fractal_task_tools.egg-info/requires.txt +2 -1
  9. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/tests/test_create_manifest.py +21 -0
  10. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/LICENSE +0 -0
  11. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/README.md +0 -0
  12. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/setup.cfg +0 -0
  13. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/src/fractal_task_tools/_cli_tools.py +0 -0
  14. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/src/fractal_task_tools/_deepdiff.py +0 -0
  15. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/src/fractal_task_tools/_descriptions.py +0 -0
  16. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/src/fractal_task_tools/_package_name_tools.py +0 -0
  17. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/src/fractal_task_tools/_pydantic_generatejsonschema.py +0 -0
  18. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/src/fractal_task_tools/_signature_constraints.py +0 -0
  19. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/src/fractal_task_tools/_task_arguments.py +0 -0
  20. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/src/fractal_task_tools/_task_docs.py +0 -0
  21. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/src/fractal_task_tools/_titles.py +0 -0
  22. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/src/fractal_task_tools/task_models.py +0 -0
  23. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/src/fractal_task_tools/task_wrapper.py +0 -0
  24. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/src/fractal_task_tools.egg-info/SOURCES.txt +0 -0
  25. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/src/fractal_task_tools.egg-info/dependency_links.txt +0 -0
  26. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/src/fractal_task_tools.egg-info/entry_points.txt +0 -0
  27. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/src/fractal_task_tools.egg-info/top_level.txt +0 -0
  28. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/tests/test_cli.py +0 -0
  29. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/tests/test_create_schema_for_single_task.py +0 -0
  30. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/tests/test_deepdiff.py +0 -0
  31. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/tests/test_extract_function.py +0 -0
  32. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/tests/test_normalize_package_name.py +0 -0
  33. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/tests/test_task_models.py +0 -0
  34. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/tests/test_task_wrapper.py +0 -0
  35. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/tests/test_unit_lib_descriptions.py +0 -0
  36. {fractal_task_tools-0.0.10 → fractal_task_tools-0.0.12}/tests/test_validate_arguments.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fractal-task-tools
3
- Version: 0.0.10
3
+ Version: 0.0.12
4
4
  Summary: Shared tools for Fractal tasks
5
5
  Author-email: Tommaso Comparin <tommaso.comparin@exact-lab.it>
6
6
  License: BSD-3-Clause
@@ -10,8 +10,9 @@ Project-URL: changelog, https://github.com/fractal-analytics-platform/fractal-ta
10
10
  Requires-Python: <3.13,>=3.10
11
11
  Description-Content-Type: text/markdown
12
12
  License-File: LICENSE
13
- Requires-Dist: pydantic<=2.8.2,>=2.0.0
13
+ Requires-Dist: pydantic<=2.11.2,>=2.0.0
14
14
  Requires-Dist: docstring-parser<=0.16,>=0.15
15
+ Requires-Dist: packaging
15
16
  Provides-Extra: dev
16
17
  Requires-Dist: bumpver==2024.1130; extra == "dev"
17
18
  Requires-Dist: devtools==0.12.2; extra == "dev"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fractal-task-tools"
3
- version = "0.0.10"
3
+ version = "0.0.12"
4
4
  description = "Shared tools for Fractal tasks"
5
5
  authors = [
6
6
  {name="Tommaso Comparin", email="tommaso.comparin@exact-lab.it"},
@@ -9,8 +9,9 @@ readme = "README.md"
9
9
  license = {text ="BSD-3-Clause"}
10
10
  requires-python = ">=3.10,<3.13"
11
11
  dependencies = [
12
- "pydantic >=2.0.0,<=2.8.2",
12
+ "pydantic >=2.0.0,<=2.11.2",
13
13
  "docstring-parser >=0.15,<=0.16",
14
+ "packaging",
14
15
  ]
15
16
  [project.optional-dependencies]
16
17
  dev = [
@@ -43,7 +44,7 @@ build-backend = "setuptools.build_meta"
43
44
  fractal-manifest = "fractal_task_tools._cli:main"
44
45
 
45
46
  [tool.bumpver]
46
- current_version = "0.0.10"
47
+ current_version = "0.0.12"
47
48
  version_pattern = "MAJOR.MINOR.PATCH[PYTAGNUM]"
48
49
  commit_message = "bump version {old_version} -> {new_version}"
49
50
  commit = true
@@ -2,4 +2,4 @@ import logging
2
2
 
3
3
  logging.basicConfig(level=logging.INFO)
4
4
 
5
- __VERSION__ = "0.0.10"
5
+ __VERSION__ = "0.0.12"
@@ -6,10 +6,8 @@ from typing import Any
6
6
  from typing import Callable
7
7
  from typing import Optional
8
8
 
9
+ import pydantic
9
10
  from docstring_parser import parse as docparse
10
- from pydantic._internal import _generate_schema
11
- from pydantic._internal import _typing_extra
12
- from pydantic._internal._config import ConfigWrapper
13
11
 
14
12
  from ._descriptions import _get_class_attrs_descriptions
15
13
  from ._descriptions import _get_function_args_descriptions
@@ -64,16 +62,43 @@ def _remove_attributes_from_descriptions(old_schema: _Schema) -> _Schema:
64
62
 
65
63
 
66
64
  def _create_schema_for_function(function: Callable) -> _Schema:
67
- namespace = _typing_extra.add_module_globals(function, None)
68
- gen_core_schema = _generate_schema.GenerateSchema(
69
- ConfigWrapper(None), namespace
70
- )
71
- core_schema = gen_core_schema.generate_schema(function)
72
- clean_core_schema = gen_core_schema.clean_schema(core_schema)
65
+ from packaging.version import parse
66
+
67
+ if parse(pydantic.__version__) >= parse("2.11.0"):
68
+
69
+ from pydantic.experimental.arguments_schema import (
70
+ generate_arguments_schema,
71
+ ) # noqa
72
+
73
+ core_schema = generate_arguments_schema(
74
+ function,
75
+ schema_type="arguments",
76
+ )
77
+ elif parse(pydantic.__version__) >= parse("2.9.0"):
78
+
79
+ from pydantic._internal._config import ConfigWrapper # noqa
80
+ from pydantic._internal import _generate_schema # noqa
81
+
82
+ gen_core_schema = _generate_schema.GenerateSchema(
83
+ ConfigWrapper(None),
84
+ None,
85
+ )
86
+ core_schema = gen_core_schema.generate_schema(function)
87
+ core_schema = gen_core_schema.clean_schema(core_schema)
88
+ else:
89
+ from pydantic._internal._typing_extra import add_module_globals # noqa
90
+ from pydantic._internal import _generate_schema # noqa
91
+ from pydantic._internal._config import ConfigWrapper # noqa
92
+
93
+ namespace = add_module_globals(function, None)
94
+ gen_core_schema = _generate_schema.GenerateSchema(
95
+ ConfigWrapper(None), namespace
96
+ )
97
+ core_schema = gen_core_schema.generate_schema(function)
98
+ core_schema = gen_core_schema.clean_schema(core_schema)
99
+
73
100
  gen_json_schema = CustomGenerateJsonSchema()
74
- json_schema = gen_json_schema.generate(
75
- clean_core_schema, mode="validation"
76
- )
101
+ json_schema = gen_json_schema.generate(core_schema, mode="validation")
77
102
  return json_schema
78
103
 
79
104
 
@@ -47,6 +47,19 @@ for subparser in (create_manifest_parser, check_manifest_parser):
47
47
  default="dev.task_list",
48
48
  required=False,
49
49
  )
50
+
51
+ subparser.add_argument(
52
+ "--fractal-server-2-13",
53
+ action="store_true",
54
+ help=(
55
+ "If set, produce a manifest which is compatible with "
56
+ "fractal-server<2.14 (that is, exclude tasks' `type`s from "
57
+ "manifest and forbid converter types."
58
+ ),
59
+ default=False,
60
+ required=False,
61
+ )
62
+
50
63
  check_manifest_parser.add_argument(
51
64
  "--ignore-keys-order",
52
65
  type=bool,
@@ -78,6 +91,7 @@ def main():
78
91
  manifest = create_manifest(
79
92
  raw_package_name=args.package,
80
93
  task_list_path=args.task_list_path,
94
+ fractal_server_2_13=args.fractal_server_2_13,
81
95
  )
82
96
  write_manifest_to_file(
83
97
  raw_package_name=args.package,
@@ -88,6 +102,7 @@ def main():
88
102
  manifest = create_manifest(
89
103
  raw_package_name=args.package,
90
104
  task_list_path=args.task_list_path,
105
+ fractal_server_2_13=args.fractal_server_2_13,
91
106
  )
92
107
  check_manifest(
93
108
  raw_package_name=args.package,
@@ -21,6 +21,7 @@ def create_manifest(
21
21
  *,
22
22
  raw_package_name: str,
23
23
  task_list_path: str,
24
+ fractal_server_2_13: bool = False,
24
25
  ) -> dict[str, Any]:
25
26
  """
26
27
  Create the package manifest based on a `task_list.py` module
@@ -32,6 +33,10 @@ def create_manifest(
32
33
  task_list_path:
33
34
  Relative path to the `task_list.py` module, with respect to the
34
35
  package root (example `dev.task_list`).
36
+ fractal_server_2_13:
37
+ If set, produce a manifest which is compatible with
38
+ fractal-server<2.14 (that is, exclude tasks' `type`s from manifest
39
+ and forbid converter types."
35
40
 
36
41
  Returns:
37
42
  Task-package manifest.
@@ -98,7 +103,16 @@ def create_manifest(
98
103
  },
99
104
  exclude_unset=True,
100
105
  )
101
- task_dict["type"] = task_obj.type
106
+ if fractal_server_2_13 and task_obj.type in [
107
+ "converter_compound",
108
+ "converter_non_parallel",
109
+ ]:
110
+ raise ValueError(
111
+ f"Invalid task type {task_obj.type} "
112
+ f"(with {fractal_server_2_13=})."
113
+ )
114
+ if not fractal_server_2_13:
115
+ task_dict["type"] = task_obj.type
102
116
 
103
117
  # Copy some properties from `task_obj` to `task_dict`
104
118
  if task_obj.executable_non_parallel is not None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fractal-task-tools
3
- Version: 0.0.10
3
+ Version: 0.0.12
4
4
  Summary: Shared tools for Fractal tasks
5
5
  Author-email: Tommaso Comparin <tommaso.comparin@exact-lab.it>
6
6
  License: BSD-3-Clause
@@ -10,8 +10,9 @@ Project-URL: changelog, https://github.com/fractal-analytics-platform/fractal-ta
10
10
  Requires-Python: <3.13,>=3.10
11
11
  Description-Content-Type: text/markdown
12
12
  License-File: LICENSE
13
- Requires-Dist: pydantic<=2.8.2,>=2.0.0
13
+ Requires-Dist: pydantic<=2.11.2,>=2.0.0
14
14
  Requires-Dist: docstring-parser<=0.16,>=0.15
15
+ Requires-Dist: packaging
15
16
  Provides-Extra: dev
16
17
  Requires-Dist: bumpver==2024.1130; extra == "dev"
17
18
  Requires-Dist: devtools==0.12.2; extra == "dev"
@@ -1,5 +1,6 @@
1
- pydantic<=2.8.2,>=2.0.0
1
+ pydantic<=2.11.2,>=2.0.0
2
2
  docstring-parser<=0.16,>=0.15
3
+ packaging
3
4
 
4
5
  [dev]
5
6
  bumpver==2024.1130
@@ -24,11 +24,32 @@ def test_create_manifest(tmp_path: Path, caplog):
24
24
 
25
25
  import fake_tasks
26
26
 
27
+ # FAILURE: create legacy manifest with converter tasks
28
+ with pytest.raises(ValueError, match="Invalid task type"):
29
+ create_manifest(
30
+ raw_package_name="fake-tasks",
31
+ task_list_path="task_list_with_converter",
32
+ fractal_server_2_13=True,
33
+ )
34
+
35
+ # SUCCESS: create legacy manifest
27
36
  manifest = create_manifest(
28
37
  raw_package_name="fake-tasks",
29
38
  task_list_path="task_list",
39
+ fractal_server_2_13=True,
30
40
  )
41
+ for task in manifest["task_list"]:
42
+ assert "type" not in task.keys()
43
+
44
+ # SUCCESS: create non-legacy manifest
45
+ manifest = create_manifest(
46
+ raw_package_name="fake-tasks",
47
+ task_list_path="task_list",
48
+ )
49
+ for task in manifest["task_list"]:
50
+ assert "type" in task.keys()
31
51
  debug(manifest)
52
+
32
53
  write_manifest_to_file(
33
54
  raw_package_name="fake-tasks",
34
55
  manifest=manifest,