monosmith-plugin-sdk 0.1.1__tar.gz → 0.3.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 monosmith-plugin-sdk might be problematic. Click here for more details.
- {monosmith_plugin_sdk-0.1.1/src/monosmith_plugin_sdk.egg-info → monosmith_plugin_sdk-0.3.0}/PKG-INFO +1 -1
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/pyproject.toml +1 -1
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/__init__.py +2 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/conformance/check_generation_use_case.py +4 -1
- monosmith_plugin_sdk-0.3.0/src/monosmith_plugin_sdk/conformance/check_kind_change_use_case.py +70 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/protocol/protocol_schema_contract.py +73 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/protocol/protocol_types_contract.py +62 -2
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/serve/__init__.py +2 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/serve/plugin_contract.py +8 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/serve/plugin_members_config.py +1 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0/src/monosmith_plugin_sdk.egg-info}/PKG-INFO +1 -1
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk.egg-info/SOURCES.txt +1 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/LICENSE +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/README.md +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/setup.cfg +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/build_dir/__init__.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/build_dir/build_dir_algorithm.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/cancellation/__init__.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/cancellation/cancel_token_model.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/cancellation/request_cancelled_error.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/ci/__init__.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/ci/ci_contribution_algorithm.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/codec/__init__.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/codec/encode_by_schema_algorithm.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/codec/encode_error.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/codec/encode_json_value_algorithm.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/codec/message_parse_error.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/codec/method_codec_algorithm.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/codec/normalize_by_schema_algorithm.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/codec/params_error.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/codec/received_message_contract.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/codec/schema_lookup_algorithm.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/codec/wire_message_mapper.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/concurrency/__init__.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/concurrency/concurrency_policy.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/conformance/__init__.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/conformance/check_plugin_use_case.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/conformance/check_scheduling_use_case.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/conformance/conformance_report_model.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/conformance/find_manifests_algorithm.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/conformance/go_list_mapper.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/framing/__init__.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/framing/frame_message_algorithm.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/framing/frame_reader_store.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/framing/framing_error.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/host/__init__.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/host/call_interrupted_error.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/host/connect_plugin_use_case.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/host/host_options_contract.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/host/plugin_client_client.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/host/start_plugin_use_case.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/jsondoc/__init__.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/jsondoc/indent_raw_json_algorithm.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/jsondoc/json_document_error.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/jsondoc/json_document_model.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/jsondoc/scan_json_object_algorithm.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/plugin_refs/__init__.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/plugin_refs/plugin_ref_policy.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/plugin_roles/__init__.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/plugin_roles/plugin_role_policy.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/projects/__init__.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/projects/audit_settings_policy.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/projects/manifest_match_algorithm.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/projects/project_kind_policy.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/projects/publishes_policy.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/projects/set_toolchain_algorithm.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/projects/stack_plugins_algorithm.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/protocol/__init__.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/protocol/rpc_error.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/py.typed +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/scaffold/__init__.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/scaffold/scaffold_data_mapper.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/scaffold/scaffold_project_use_case.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/serve/capabilities_of_algorithm.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/serve/claim_stdio_use_case.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/serve/dispatch_request_use_case.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/serve/frame_writer_store.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/serve/initialize_plugin_use_case.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/serve/protocol_streams_contract.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/serve/request_outcome_contract.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/serve/request_pool_store.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/serve/serve_use_case.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/tasks/__init__.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/tasks/contribute_tasks_algorithm.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/tasks/task_algorithm.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/templating/__init__.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/templating/file_exists_error.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/templating/parse_template_algorithm.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/templating/render_template_algorithm.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/templating/template_error.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/templating/template_functions_algorithm.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/templating/template_syntax_contract.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/templating/tokenize_action_algorithm.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/templating/write_templates_use_case.py +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk.egg-info/dependency_links.txt +0 -0
- {monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk.egg-info/top_level.txt +0 -0
{monosmith_plugin_sdk-0.1.1/src/monosmith_plugin_sdk.egg-info → monosmith_plugin_sdk-0.3.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: monosmith-plugin-sdk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: The Python SDK for writing smith plugins: the protocol's types, the serve loop, a test host, the conformance checks, templating and key-order-keeping JSON editing. No runtime dependencies.
|
|
5
5
|
Author: Eduardo Russo
|
|
6
6
|
License-Expression: MIT
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "monosmith-plugin-sdk"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.3.0"
|
|
8
8
|
description = "The Python SDK for writing smith plugins: the protocol's types, the serve loop, a test host, the conformance checks, templating and key-order-keeping JSON editing. No runtime dependencies."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
{monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/__init__.py
RENAMED
|
@@ -97,6 +97,7 @@ from .serve import (
|
|
|
97
97
|
Discoverer,
|
|
98
98
|
DoctorContributor,
|
|
99
99
|
Generator,
|
|
100
|
+
KindChanger,
|
|
100
101
|
LatestReader,
|
|
101
102
|
Plugin,
|
|
102
103
|
Publisher,
|
|
@@ -124,6 +125,7 @@ __all__ = [
|
|
|
124
125
|
"CIContributor",
|
|
125
126
|
"DoctorContributor",
|
|
126
127
|
"Remover",
|
|
128
|
+
"KindChanger",
|
|
127
129
|
"DependencyManager",
|
|
128
130
|
"DeclarationEditor",
|
|
129
131
|
"LatestReader",
|
|
@@ -11,6 +11,7 @@ from ..host import PluginClient
|
|
|
11
11
|
from ..plugin_roles import effective_roles
|
|
12
12
|
from ..projects import project_kind_directory
|
|
13
13
|
from ..protocol import GenerateParams, Project, ProjectKind
|
|
14
|
+
from .check_kind_change_use_case import check_kind_change
|
|
14
15
|
from .conformance_report_model import ConformanceReport
|
|
15
16
|
from .find_manifests_algorithm import find_manifests
|
|
16
17
|
from .go_list_mapper import go_list, go_quote
|
|
@@ -30,7 +31,7 @@ def check_generation(client: PluginClient, workspace: str | Path, report: Confor
|
|
|
30
31
|
|
|
31
32
|
For a language plugin, also that its own `discover` returns what it made, with the kind and the
|
|
32
33
|
stack it was asked for, tasks with commands, and that the dry runs of `version/write`, `remove`,
|
|
33
|
-
`publish` and `published` answer.
|
|
34
|
+
`publish` and `published` answer, and, for a plugin that changes kinds, what `project/kind` edits.
|
|
34
35
|
"""
|
|
35
36
|
language = "language" in effective_roles(client.info)
|
|
36
37
|
made: list[GenerateParams] = []
|
|
@@ -104,6 +105,8 @@ def check_generation(client: PluginClient, workspace: str | Path, report: Confor
|
|
|
104
105
|
f"would remove the {kind} (dry run)",
|
|
105
106
|
functools.partial(call, "remove", {"project": project, "dryRun": True}),
|
|
106
107
|
)
|
|
108
|
+
if client.supports("project/kind"):
|
|
109
|
+
check_kind_change(client, workspace, project, projects, report)
|
|
107
110
|
if kind == "package" and client.supports("publish"):
|
|
108
111
|
publish = functools.partial(client.call, timeout=300.0)
|
|
109
112
|
_attempt(
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""The check of a plugin that changes kinds."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import posixpath
|
|
6
|
+
from collections.abc import Sequence
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from ..host import PluginClient
|
|
10
|
+
from ..projects import project_kind_directory
|
|
11
|
+
from ..protocol import Project, ProjectKind
|
|
12
|
+
from .conformance_report_model import ConformanceReport
|
|
13
|
+
from .find_manifests_algorithm import find_manifests
|
|
14
|
+
from .go_list_mapper import go_list
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _kind_change_target(kind: ProjectKind) -> ProjectKind:
|
|
18
|
+
"""The kind a generated project is asked to become.
|
|
19
|
+
|
|
20
|
+
A lib is published as a package, an app becomes a lib, and a package goes back to a lib.
|
|
21
|
+
"""
|
|
22
|
+
if kind == "app":
|
|
23
|
+
return "lib"
|
|
24
|
+
return "package" if kind == "lib" else "lib"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _article(kind: ProjectKind) -> str:
|
|
28
|
+
return "an app" if kind == "app" else f"a {kind}"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _snapshot(workspace: str | Path, names: Sequence[str]) -> dict[str, str]:
|
|
32
|
+
"""The content of every manifest of the workspace, by path."""
|
|
33
|
+
paths = find_manifests(workspace, names)
|
|
34
|
+
return {path: Path(workspace, *path.split("/")).read_text(encoding="utf-8") for path in paths}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def check_kind_change(
|
|
38
|
+
client: PluginClient, workspace: str | Path, project: Project, projects: list[Project], report: ConformanceReport
|
|
39
|
+
) -> None:
|
|
40
|
+
"""Ask what making a generated project another kind edits.
|
|
41
|
+
|
|
42
|
+
The plugin must answer with a refusal or with edits to files that exist, and write nothing itself:
|
|
43
|
+
the host applies the edits.
|
|
44
|
+
"""
|
|
45
|
+
to = _kind_change_target(project["kind"])
|
|
46
|
+
new_root = f"{project_kind_directory(to)}/{posixpath.basename(project['root'])}"
|
|
47
|
+
check = f"answers what making the {project['kind']} {_article(to)} edits (dry run)"
|
|
48
|
+
names = client.info.get("manifests") or []
|
|
49
|
+
before = _snapshot(workspace, names)
|
|
50
|
+
try:
|
|
51
|
+
answer = client.call(
|
|
52
|
+
"project/kind",
|
|
53
|
+
{"project": project, "to": to, "newRoot": new_root, "projects": projects},
|
|
54
|
+
timeout=300.0,
|
|
55
|
+
)
|
|
56
|
+
except Exception as error:
|
|
57
|
+
report.add(check, False, str(error))
|
|
58
|
+
return
|
|
59
|
+
files = answer.get("files") or []
|
|
60
|
+
missing = [f["path"] for f in files if not Path(workspace, *f["path"].split("/")).exists()]
|
|
61
|
+
if not answer.get("refused") and not files:
|
|
62
|
+
report.add(check, False, "it answered with neither a refusal nor an edit: a changed kind is recorded in a file")
|
|
63
|
+
elif missing:
|
|
64
|
+
report.add(check, False, f"edits files that do not exist (paths are those before the move): {go_list(missing)}")
|
|
65
|
+
else:
|
|
66
|
+
report.add(
|
|
67
|
+
check,
|
|
68
|
+
before == _snapshot(workspace, names),
|
|
69
|
+
"it wrote to the workspace: it must only answer with the new content, and let the host write it",
|
|
70
|
+
)
|
|
@@ -143,6 +143,17 @@ _SCHEMA_JSON = r'''{
|
|
|
143
143
|
"capability": "remove",
|
|
144
144
|
"notification": false
|
|
145
145
|
},
|
|
146
|
+
"project/kind": {
|
|
147
|
+
"description": "Asks what changing a project between app, lib and package edits: its manifest, the workspace files and the dependents that name its kind or directory. The host applies the edits and moves the directory.",
|
|
148
|
+
"params": {
|
|
149
|
+
"$ref": "#/$defs/ChangeKindParams"
|
|
150
|
+
},
|
|
151
|
+
"result": {
|
|
152
|
+
"$ref": "#/$defs/ChangeKindResult"
|
|
153
|
+
},
|
|
154
|
+
"capability": "changeKind",
|
|
155
|
+
"notification": false
|
|
156
|
+
},
|
|
146
157
|
"published": {
|
|
147
158
|
"description": "Asks which version of a project its registry has, so a release can check its tags against it.",
|
|
148
159
|
"params": {
|
|
@@ -509,6 +520,10 @@ _SCHEMA_JSON = r'''{
|
|
|
509
520
|
"type": "boolean",
|
|
510
521
|
"description": "Remove cleans up a removed project's traces outside its directory."
|
|
511
522
|
},
|
|
523
|
+
"changeKind": {
|
|
524
|
+
"type": "boolean",
|
|
525
|
+
"description": "ChangeKind answers what changing a project's kind edits (smith kind)."
|
|
526
|
+
},
|
|
512
527
|
"published": {
|
|
513
528
|
"type": "boolean",
|
|
514
529
|
"description": "Published reports what a registry has of a project."
|
|
@@ -531,6 +546,60 @@ _SCHEMA_JSON = r'''{
|
|
|
531
546
|
}
|
|
532
547
|
}
|
|
533
548
|
},
|
|
549
|
+
"ChangeKindParams": {
|
|
550
|
+
"description": "ChangeKindParams asks a plugin what changing a project's kind edits. The plugin writes nothing: it answers with the files' new contents, and the host applies them, then moves the project's directory.",
|
|
551
|
+
"type": "object",
|
|
552
|
+
"properties": {
|
|
553
|
+
"project": {
|
|
554
|
+
"$ref": "#/$defs/Project",
|
|
555
|
+
"description": "Project is the project as it is now."
|
|
556
|
+
},
|
|
557
|
+
"to": {
|
|
558
|
+
"$ref": "#/$defs/ProjectKind",
|
|
559
|
+
"description": "To is the kind it becomes."
|
|
560
|
+
},
|
|
561
|
+
"newRoot": {
|
|
562
|
+
"type": "string",
|
|
563
|
+
"description": "NewRoot is the workspace-relative directory the host moves the project to afterwards; it equals Project.Root when the directory stays."
|
|
564
|
+
},
|
|
565
|
+
"projects": {
|
|
566
|
+
"type": "array",
|
|
567
|
+
"items": {
|
|
568
|
+
"$ref": "#/$defs/Project"
|
|
569
|
+
},
|
|
570
|
+
"description": "Projects are every project of the workspace, so the plugin can find the ones whose manifests and sources name this one."
|
|
571
|
+
}
|
|
572
|
+
},
|
|
573
|
+
"required": [
|
|
574
|
+
"project",
|
|
575
|
+
"to",
|
|
576
|
+
"newRoot"
|
|
577
|
+
]
|
|
578
|
+
},
|
|
579
|
+
"ChangeKindResult": {
|
|
580
|
+
"description": "ChangeKindResult is what the change edits. Every path in Files is the path the file has before the move.",
|
|
581
|
+
"type": "object",
|
|
582
|
+
"properties": {
|
|
583
|
+
"refused": {
|
|
584
|
+
"type": "string",
|
|
585
|
+
"description": "Refused says why this kind makes no sense for the project's language (\"a Bicep template is deployed, never published\"); the host stops and shows it. Empty when the change is fine."
|
|
586
|
+
},
|
|
587
|
+
"files": {
|
|
588
|
+
"type": "array",
|
|
589
|
+
"items": {
|
|
590
|
+
"$ref": "#/$defs/FileEdit"
|
|
591
|
+
},
|
|
592
|
+
"description": "Files are the edits: manifests, workspace files and dependents that name the project's kind or its directory."
|
|
593
|
+
},
|
|
594
|
+
"warnings": {
|
|
595
|
+
"type": "array",
|
|
596
|
+
"items": {
|
|
597
|
+
"type": "string"
|
|
598
|
+
},
|
|
599
|
+
"description": "Warnings name what the change loses or leaves for the user (a binary an app has and a lib does not, a lockfile to refresh)."
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
},
|
|
534
603
|
"ContributeParams": {
|
|
535
604
|
"description": "ContributeParams hands a plugin the projects it applies to: those whose stack includes it, or, for a workspace-wide convention, those of the languages it supports that smith.toml enables it for.",
|
|
536
605
|
"type": "object",
|
|
@@ -1353,6 +1422,10 @@ _SCHEMA_JSON = r'''{
|
|
|
1353
1422
|
"registries": {
|
|
1354
1423
|
"$ref": "#/$defs/Registries",
|
|
1355
1424
|
"description": "Registries are the private registries the project installs from and publishes to, from smith.toml [registries]; nil means the public ones. Set by the host."
|
|
1425
|
+
},
|
|
1426
|
+
"releaseAssets": {
|
|
1427
|
+
"$ref": "#/$defs/AssetSpec",
|
|
1428
|
+
"description": "ReleaseAssets is what an app's release builds, from smith.toml [projects.<project>.release]: the platforms and file names, so a plugin can check (doctor) and prepare (CI) for them. Nil for a project that has no release files. Set by the host."
|
|
1356
1429
|
}
|
|
1357
1430
|
},
|
|
1358
1431
|
"required": [
|
|
@@ -30,6 +30,8 @@ __all__ = [
|
|
|
30
30
|
"CIResult",
|
|
31
31
|
"CancelParams",
|
|
32
32
|
"Capabilities",
|
|
33
|
+
"ChangeKindParams",
|
|
34
|
+
"ChangeKindResult",
|
|
33
35
|
"ContributeParams",
|
|
34
36
|
"ContributeResult",
|
|
35
37
|
"Contribution",
|
|
@@ -149,11 +151,11 @@ class ErrorCodes:
|
|
|
149
151
|
ERROR_CODES = ErrorCodes()
|
|
150
152
|
|
|
151
153
|
|
|
152
|
-
MethodName = Literal["initialize", "shutdown", "cancel", "discover", "generate", "version/write", "publish", "ci", "doctor", "contribute", "remove", "published", "dependencies/install", "dependencies/uninstall", "dependencies/declared", "dependencies/rewrite", "dependencies/latest"]
|
|
154
|
+
MethodName = Literal["initialize", "shutdown", "cancel", "discover", "generate", "version/write", "publish", "ci", "doctor", "contribute", "remove", "project/kind", "published", "dependencies/install", "dependencies/uninstall", "dependencies/declared", "dependencies/rewrite", "dependencies/latest"]
|
|
153
155
|
"""Every method of the protocol, `initialize`, `shutdown` and the `cancel` notification too."""
|
|
154
156
|
|
|
155
157
|
|
|
156
|
-
CapabilityName = Literal["discover", "generate", "version", "publish", "ci", "doctor", "contribute", "remove", "published", "dependencies", "declarations", "latest", "cancel"]
|
|
158
|
+
CapabilityName = Literal["discover", "generate", "version", "publish", "ci", "doctor", "contribute", "remove", "changeKind", "published", "dependencies", "declarations", "latest", "cancel"]
|
|
157
159
|
"""The names of the capability flags: the optional methods a plugin implements."""
|
|
158
160
|
|
|
159
161
|
|
|
@@ -169,6 +171,7 @@ METHOD_CAPABILITIES: Final[dict[str, str | None]] = {
|
|
|
169
171
|
"doctor": "doctor",
|
|
170
172
|
"contribute": "contribute",
|
|
171
173
|
"remove": "remove",
|
|
174
|
+
"project/kind": "changeKind",
|
|
172
175
|
"published": "published",
|
|
173
176
|
"dependencies/install": "dependencies",
|
|
174
177
|
"dependencies/uninstall": "dependencies",
|
|
@@ -312,6 +315,8 @@ class Capabilities(TypedDict, total=False):
|
|
|
312
315
|
"""Contribute is a convention plugin's: it adds tasks to projects other plugins discovered."""
|
|
313
316
|
remove: bool
|
|
314
317
|
"""Remove cleans up a removed project's traces outside its directory."""
|
|
318
|
+
changeKind: bool
|
|
319
|
+
"""ChangeKind answers what changing a project's kind edits (smith kind)."""
|
|
315
320
|
published: bool
|
|
316
321
|
"""Published reports what a registry has of a project."""
|
|
317
322
|
dependencies: bool
|
|
@@ -328,6 +333,55 @@ class Capabilities(TypedDict, total=False):
|
|
|
328
333
|
"""
|
|
329
334
|
|
|
330
335
|
|
|
336
|
+
class _ChangeKindParamsRequired(TypedDict):
|
|
337
|
+
project: Project
|
|
338
|
+
"""Project is the project as it is now."""
|
|
339
|
+
to: ProjectKind
|
|
340
|
+
"""To is the kind it becomes."""
|
|
341
|
+
newRoot: str
|
|
342
|
+
"""
|
|
343
|
+
NewRoot is the workspace-relative directory the host moves the project to afterwards; it
|
|
344
|
+
equals Project.Root when the directory stays.
|
|
345
|
+
"""
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
class ChangeKindParams(_ChangeKindParamsRequired, total=False):
|
|
349
|
+
"""
|
|
350
|
+
ChangeKindParams asks a plugin what changing a project's kind edits. The plugin writes
|
|
351
|
+
nothing: it answers with the files' new contents, and the host applies them, then moves the
|
|
352
|
+
project's directory.
|
|
353
|
+
"""
|
|
354
|
+
|
|
355
|
+
projects: list[Project]
|
|
356
|
+
"""
|
|
357
|
+
Projects are every project of the workspace, so the plugin can find the ones whose manifests
|
|
358
|
+
and sources name this one.
|
|
359
|
+
"""
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
class ChangeKindResult(TypedDict, total=False):
|
|
363
|
+
"""
|
|
364
|
+
ChangeKindResult is what the change edits. Every path in Files is the path the file has
|
|
365
|
+
before the move.
|
|
366
|
+
"""
|
|
367
|
+
|
|
368
|
+
refused: str
|
|
369
|
+
"""
|
|
370
|
+
Refused says why this kind makes no sense for the project's language ("a Bicep template is
|
|
371
|
+
deployed, never published"); the host stops and shows it. Empty when the change is fine.
|
|
372
|
+
"""
|
|
373
|
+
files: list[FileEdit]
|
|
374
|
+
"""
|
|
375
|
+
Files are the edits: manifests, workspace files and dependents that name the project's kind
|
|
376
|
+
or its directory.
|
|
377
|
+
"""
|
|
378
|
+
warnings: list[str]
|
|
379
|
+
"""
|
|
380
|
+
Warnings name what the change loses or leaves for the user (a binary an app has and a lib
|
|
381
|
+
does not, a lockfile to refresh).
|
|
382
|
+
"""
|
|
383
|
+
|
|
384
|
+
|
|
331
385
|
class ContributeParams(TypedDict):
|
|
332
386
|
"""
|
|
333
387
|
ContributeParams hands a plugin the projects it applies to: those whose stack includes it,
|
|
@@ -890,6 +944,12 @@ class Project(_ProjectRequired, total=False):
|
|
|
890
944
|
Registries are the private registries the project installs from and publishes to, from
|
|
891
945
|
smith.toml [registries]; nil means the public ones. Set by the host.
|
|
892
946
|
"""
|
|
947
|
+
releaseAssets: AssetSpec
|
|
948
|
+
"""
|
|
949
|
+
ReleaseAssets is what an app's release builds, from smith.toml [projects.<project>.release]:
|
|
950
|
+
the platforms and file names, so a plugin can check (doctor) and prepare (CI) for them. Nil
|
|
951
|
+
for a project that has no release files. Set by the host.
|
|
952
|
+
"""
|
|
893
953
|
|
|
894
954
|
|
|
895
955
|
ProjectKind = Literal["app", "lib", "package"]
|
{monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/serve/__init__.py
RENAMED
|
@@ -9,6 +9,7 @@ from .plugin_contract import (
|
|
|
9
9
|
Discoverer,
|
|
10
10
|
DoctorContributor,
|
|
11
11
|
Generator,
|
|
12
|
+
KindChanger,
|
|
12
13
|
LatestReader,
|
|
13
14
|
Plugin,
|
|
14
15
|
Publisher,
|
|
@@ -31,6 +32,7 @@ __all__ = [
|
|
|
31
32
|
"Discoverer",
|
|
32
33
|
"DoctorContributor",
|
|
33
34
|
"Generator",
|
|
35
|
+
"KindChanger",
|
|
34
36
|
"LatestReader",
|
|
35
37
|
"Plugin",
|
|
36
38
|
"Publisher",
|
|
@@ -17,6 +17,8 @@ from typing import Protocol
|
|
|
17
17
|
|
|
18
18
|
from ..cancellation import CancelToken
|
|
19
19
|
from ..protocol import (
|
|
20
|
+
ChangeKindParams,
|
|
21
|
+
ChangeKindResult,
|
|
20
22
|
CIParams,
|
|
21
23
|
CIResult,
|
|
22
24
|
ContributeParams,
|
|
@@ -107,6 +109,12 @@ class Remover(Protocol):
|
|
|
107
109
|
def remove(self, params: RemoveParams, cancel: CancelToken) -> RemoveResult: ...
|
|
108
110
|
|
|
109
111
|
|
|
112
|
+
class KindChanger(Protocol):
|
|
113
|
+
"""`project/kind`: what changing a project between app, lib and package edits."""
|
|
114
|
+
|
|
115
|
+
def change_kind(self, params: ChangeKindParams, cancel: CancelToken) -> ChangeKindResult: ...
|
|
116
|
+
|
|
117
|
+
|
|
110
118
|
class DependencyManager(Protocol):
|
|
111
119
|
"""`dependencies/install` and `dependencies/uninstall`: both, or the capability is not advertised."""
|
|
112
120
|
|
|
@@ -22,6 +22,7 @@ PLUGIN_MEMBERS: dict[str, PluginMember] = {
|
|
|
22
22
|
"doctor": PluginMember("doctor", ("doctor",)),
|
|
23
23
|
"contribute": PluginMember("contribute", ("contribute",)),
|
|
24
24
|
"remove": PluginMember("remove", ("remove",)),
|
|
25
|
+
"project/kind": PluginMember("change_kind", ("change_kind",)),
|
|
25
26
|
"published": PluginMember("published", ("published",)),
|
|
26
27
|
"dependencies/install": PluginMember("install", ("install", "uninstall")),
|
|
27
28
|
"dependencies/uninstall": PluginMember("uninstall", ("install", "uninstall")),
|
{monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0/src/monosmith_plugin_sdk.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: monosmith-plugin-sdk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: The Python SDK for writing smith plugins: the protocol's types, the serve loop, a test host, the conformance checks, templating and key-order-keeping JSON editing. No runtime dependencies.
|
|
5
5
|
Author: Eduardo Russo
|
|
6
6
|
License-Expression: MIT
|
|
@@ -29,6 +29,7 @@ src/monosmith_plugin_sdk/concurrency/__init__.py
|
|
|
29
29
|
src/monosmith_plugin_sdk/concurrency/concurrency_policy.py
|
|
30
30
|
src/monosmith_plugin_sdk/conformance/__init__.py
|
|
31
31
|
src/monosmith_plugin_sdk/conformance/check_generation_use_case.py
|
|
32
|
+
src/monosmith_plugin_sdk/conformance/check_kind_change_use_case.py
|
|
32
33
|
src/monosmith_plugin_sdk/conformance/check_plugin_use_case.py
|
|
33
34
|
src/monosmith_plugin_sdk/conformance/check_scheduling_use_case.py
|
|
34
35
|
src/monosmith_plugin_sdk/conformance/conformance_report_model.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/ci/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/codec/__init__.py
RENAMED
|
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
|
{monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/host/__init__.py
RENAMED
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{monosmith_plugin_sdk-0.1.1 → monosmith_plugin_sdk-0.3.0}/src/monosmith_plugin_sdk/tasks/__init__.py
RENAMED
|
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
|