httk.workflow.adapters¶
Versioned JSON remote-adapter bundles.
Attributes¶
Classes¶
Resolved remote bundle. |
Functions¶
|
Submit managers for a far-side workspace name using its probed root. |
|
Return the UUID and current root reported for a remote workspace name. |
|
Return the application settings a remote seeds a workspace with. |
|
Return the metadata file of one adapter bundle. |
|
Read the metadata of one adapter bundle. |
|
Validate static adapter metadata and the single dispatcher executable. |
|
Validate and return one remote name. |
|
Resolve project-local before global remote definitions. |
|
Return where one project keeps its remotes. |
|
List definitions with project entries shadowing global entries. |
|
Copy one maintained adapter template into user/project data. |
|
Partition |
|
Read remote credentials that never enter a project manifest. |
|
Merge settings into the manifest-excluded remote credentials. |
|
Return persisted remote settings with credentials merged back in. |
|
Map a recognizable legacy executable bundle to the versioned contract. |
|
Execute one JSON adapter operation without invoking a shell. |
Module Contents¶
- httk.workflow.adapters.ADAPTER_OPERATIONS = ('configure', 'install', 'invoke', 'push', 'pull', 'start-manager', 'status')[source]¶
- httk.workflow.adapters.REMOTE_WORKSPACE_INIT_COMMAND = ('httk', 'workflow', 'workspace', 'init')[source]¶
- httk.workflow.adapters.REMOTE_WORKSPACE_DELETE_COMMAND = ('httk', 'workflow', 'workspace', 'delete')[source]¶
- httk.workflow.adapters.REMOTE_WORKSPACE_FSCK_COMMAND = ('httk', 'workflow', 'workspace', 'fsck')[source]¶
- httk.workflow.adapters.REMOTE_WORKSPACE_GC_COMMAND = ('httk', 'workflow', 'workspace', 'gc')[source]¶
- httk.workflow.adapters.REMOTE_WORKSPACE_LIST_COMMAND = ('httk', 'workflow', 'workspace', 'list')[source]¶
- httk.workflow.adapters.REMOTE_WORKSPACE_MOVE_COMMAND = ('httk', 'workflow', 'workspace', 'move')[source]¶
- httk.workflow.adapters.REMOTE_RECEIVE_COMMAND = ('httk', 'workflow', 'transfer', 'receive')[source]¶
- httk.workflow.adapters.REMOTE_WORKSPACE_SETTINGS_COMMAND = ('httk', 'workflow', 'workspace', 'settings')[source]¶
- httk.workflow.adapters.REMOTE_WORKSPACE_WORKFLOW_PRELUDE_COMMAND = ('httk', 'workflow', 'workspace', 'workflow-prelude')[source]¶
- httk.workflow.adapters.submit_remote_managers(target, name, root, *, count, argv_tail, timeout, adapter=None)[source]¶
Submit managers for a far-side workspace name using its probed root.
- Parameters:
target (RemoteTarget) – The resolved remote adapter bundle.
name (str) – The remote workspace name.
root (str) – The remote workspace root.
count (int) – The number of managers to submit.
argv_tail (collections.abc.Sequence[str]) – Additional manager arguments.
timeout (float | None) – The adapter operation timeout.
adapter (collections.abc.Callable[Ellipsis, dict[str, Any]] | None) – The adapter callable, or
run_adapter()when omitted.
- Returns:
The adapter result document.
- Return type:
- httk.workflow.adapters.probe_remote_workspace(target, name, *, timeout, noun='workspace', adapter=None)[source]¶
Return the UUID and current root reported for a remote workspace name.
- Parameters:
target (RemoteTarget) – The resolved remote adapter bundle.
name (str) – The remote workspace name.
timeout (float | None) – The adapter operation timeout.
noun (str) – The noun used in diagnostic messages.
adapter (collections.abc.Callable[Ellipsis, dict[str, Any]] | None) – The adapter callable, or
run_adapter()when omitted.
- Returns:
The remote workspace identifier and root.
- Raises:
RuntimeError – If the remote status operation fails.
ValueError – If the remote returns an incompatible status document.
- Return type:
- httk.workflow.adapters.SEED_SETTING_MAP: collections.abc.Mapping[str, str][source]¶
- httk.workflow.adapters.seed_application_settings(bundle)[source]¶
Return the application settings a remote seeds a workspace with.
- class httk.workflow.adapters.RemoteTarget[source]¶
Resolved remote bundle.
- Parameters:
name – The remote name.
bundle – The resolved adapter bundle path.
project_local – Whether the bundle came from project data.
- bundle: pathlib.Path[source]¶
- httk.workflow.adapters.metadata_path(bundle)[source]¶
Return the metadata file of one adapter bundle.
- Parameters:
bundle (str | os.PathLike[str]) – The adapter bundle path.
- Returns:
The bundle metadata path.
- Return type:
- httk.workflow.adapters.read_metadata(bundle)[source]¶
Read the metadata of one adapter bundle.
- Parameters:
bundle (str | os.PathLike[str]) – The adapter bundle path.
- Returns:
The decoded metadata document.
- Raises:
ValueError – If the metadata cannot be read as an object.
- Return type:
- httk.workflow.adapters.validate_adapter_bundle(bundle)[source]¶
Validate static adapter metadata and the single dispatcher executable.
- Parameters:
bundle (str | os.PathLike[str]) – The adapter bundle path.
- Returns:
The validated metadata document.
- Raises:
ValueError – If metadata, the dispatcher, or a required binary is invalid or unavailable.
- Return type:
- httk.workflow.adapters.valid_remote_name(name)[source]¶
Validate and return one remote name.
- Parameters:
name (str) – The remote name to validate.
- Returns:
The validated remote name.
- Raises:
httk.workflow.errors.ResolutionMiss – If the name is not valid for remote resolution.
- Return type:
- httk.workflow.adapters.resolve_remote(value, *, project=None)[source]¶
Resolve project-local before global remote definitions.
- Parameters:
value (str) – The remote name to resolve.
project (str | os.PathLike[str] | None) – The project path, or the discovered project when omitted.
- Returns:
The resolved remote target.
- Raises:
httk.workflow.errors.ResolutionMiss – If the name is invalid or no bundle is found.
- Return type:
- httk.workflow.adapters.project_remote_roots(project_root)[source]¶
Return where one project keeps its remotes.
- Parameters:
project_root (pathlib.Path) – The project root.
- Returns:
The project remote roots in precedence order.
- Return type:
tuple[pathlib.Path, Ellipsis]
- httk.workflow.adapters.list_remotes(project=None)[source]¶
List definitions with project entries shadowing global entries.
- httk.workflow.adapters.add_remote(name, *, template, global_scope=False, project=None)[source]¶
Copy one maintained adapter template into user/project data.
- Parameters:
- Returns:
The newly created adapter bundle path.
- Raises:
ValueError – If the name, template, or scope is invalid.
FileExistsError – If the destination already exists.
- Return type:
- httk.workflow.adapters.split_settings(settings)[source]¶
Partition
--setvalues into persistable settings and credentials.
- httk.workflow.adapters.read_credentials(bundle)[source]¶
Read remote credentials that never enter a project manifest.
- Parameters:
bundle (str | os.PathLike[str]) – The adapter bundle path.
- Returns:
The stored credential document, or an empty mapping when absent.
- Raises:
ValueError – If the credentials file is not a JSON object.
- Return type:
- httk.workflow.adapters.store_credentials(bundle, settings)[source]¶
Merge settings into the manifest-excluded remote credentials.
- Parameters:
bundle (str | os.PathLike[str]) – The adapter bundle path.
settings (collections.abc.Mapping[str, str]) – Credential members to merge.
- Returns:
The credentials file path.
- Raises:
ValueError – If the existing credentials file is invalid.
- Return type:
- httk.workflow.adapters.remote_settings(bundle)[source]¶
Return persisted remote settings with credentials merged back in.
- Parameters:
bundle (str | os.PathLike[str]) – The adapter bundle path.
- Returns:
Persisted settings and manifest-excluded credentials.
- Raises:
ValueError – If adapter metadata or credentials are invalid.
- Return type:
- httk.workflow.adapters.import_v1_remote(source, *, name=None, global_scope=False, project=None)[source]¶
Map a recognizable legacy executable bundle to the versioned contract.
Legacy shell programs are never copied or executed. Only their simple assignment-only
configfiles are read, and the result uses a maintained v2 adapter implementation. What is read is an httk v1 computer definition, so the legacy names below are the names that tree really uses.- Parameters:
source (str | os.PathLike[str]) – The legacy executable bundle path.
name (str | None) – The imported remote name, or the source directory name when omitted.
global_scope (bool) – Whether to create the imported remote in global data.
project (str | os.PathLike[str] | None) – The project path for a project-local import.
- Returns:
The created versioned adapter bundle path.
- Raises:
ValueError – If the legacy bundle cannot be recognized or imported.
- Return type:
- httk.workflow.adapters.run_adapter(bundle, operation, request, *, timeout=None)[source]¶
Execute one JSON adapter operation without invoking a shell.
- Parameters:
bundle (str | os.PathLike[str]) – The adapter bundle path.
operation (str) – The adapter operation name.
request (collections.abc.Mapping[str, object]) – The operation request members.
timeout (float | None) – The operation timeout, or the bundle default when omitted.
- Returns:
The adapter result document.
- Raises:
TimeoutError – If the adapter exceeds its timeout.
ValueError – If the request or result violates the adapter protocol.
RuntimeError – If the adapter refuses or fails the operation.
- Return type: