splime 0.4.9__tar.gz → 0.4.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.
- {splime-0.4.9/src/splime.egg-info → splime-0.4.12}/PKG-INFO +35 -2
- {splime-0.4.9 → splime-0.4.12}/README.md +31 -1
- {splime-0.4.9 → splime-0.4.12}/pyproject.toml +4 -1
- {splime-0.4.9 → splime-0.4.12}/src/spl/_client.py +71 -14
- {splime-0.4.9 → splime-0.4.12}/src/spl/_process.py +7 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/adapters.py +5 -2
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/_common.py +1087 -73
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/_yaml.py +4 -4
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/entities/adapter.py +4 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/entities/distribution.py +32 -4
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/entities/function.py +23 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/entities/local_function.py +2 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/manifest.py +49 -2
- splime-0.4.12/src/spl/core/node_runtime.py +2019 -0
- splime-0.4.12/src/spl/core/resume.py +1490 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/runtime_port_adapters.py +1614 -94
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/canonical.py +1 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/metadata.py +11 -8
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/prepared_validation.py +1 -0
- splime-0.4.12/src/spl/daemon/spl_free_runner.py +2214 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/storage_base.py +1 -1
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/worker.py +25 -331
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon_client.py +3 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/embedded.py +1173 -261
- splime-0.4.12/src/spl/execution_results.py +472 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/official-registry.json +2 -2
- splime-0.4.12/src/spl/public_contract.py +371 -0
- splime-0.4.12/src/spl/public_dependencies.py +156 -0
- splime-0.4.12/src/spl/public_inprocess.py +338 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/runtime_environment.py +136 -27
- {splime-0.4.9 → splime-0.4.12/src/splime.egg-info}/PKG-INFO +35 -2
- {splime-0.4.9 → splime-0.4.12}/src/splime.egg-info/SOURCES.txt +4 -0
- {splime-0.4.9 → splime-0.4.12}/src/splime.egg-info/requires.txt +3 -0
- splime-0.4.9/src/spl/core/node_runtime.py +0 -904
- splime-0.4.9/src/spl/core/resume.py +0 -432
- splime-0.4.9/src/spl/daemon/spl_free_runner.py +0 -331
- {splime-0.4.9 → splime-0.4.12}/LICENSE +0 -0
- {splime-0.4.9 → splime-0.4.12}/NOTICE +0 -0
- {splime-0.4.9 → splime-0.4.12}/setup.cfg +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/__init__.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/_deprecate.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/_http.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/_owner_ref.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/_runtime_port_adapters_client.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/_timeout.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/_views.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/client.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/__init__.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/_graph.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/adapter_compat.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/common.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/entities/__init__.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/entities/artifact.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/entities/control.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/entities/misc.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/entities/module.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/entities/node.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/entities/node_function.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/entities/node_remote.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/entities/pipeline.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/entities/scalar.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/fingerprint.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/ir/__init__.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/ir/common.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/ir/parse.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/ir/unparse.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/ir/utils.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/json_contract.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/library_adapters.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/publications.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/redaction.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/source_analysis.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/core/source_preparation.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/__init__.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/__main__.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/ai_assistant.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/ai_preview.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/artifact_access.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/browser_adapter_run.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/callback_capability.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/cli.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/client.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/connected_ide.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/docker_environment.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/docker_pool.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/doctor.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/environment.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/environment_base.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/guarded_local_run.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/heartbeat_service.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/home_lock.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/ide_metadata.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/interpreter_visibility.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/library_adapters.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/lifecycle.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/lifecycle_startup.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/name_validation.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/publications.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/remote_client.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/repositories/__init__.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/repositories/env.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/repositories/library.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/repositories/library_adapter.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/repositories/object.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/repositories/run.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/repositories/server_connection.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/repositories/sync_event.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/routes/__init__.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/routes/_helpers.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/routes/adapter_runs.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/routes/ai_assistant.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/routes/ai_preview.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/routes/artifacts.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/routes/diagnostics.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/routes/envs.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/routes/guarded_runs.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/routes/libraries.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/routes/library_adapters.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/routes/lifecycle.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/routes/meta.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/routes/objects.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/routes/prepared_validation.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/routes/remote.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/routes/runs.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/routes/server_connections.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/routes/source_analysis.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/run_lifecycle.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/run_progress.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/runtime_adapter_registry.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/runtime_backend.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/runtime_config.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/runtime_dependencies.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/runtime_library_adapters.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/runtime_port_adapters.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/secret_store.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/server.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/server_connection.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/services/__init__.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/services/sync.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/signature.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/spl_free_generator.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/store.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/telemetry.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/daemon/worker_runtime_marker.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/official_registry.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/pipeline_widget.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/public.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/public_artifact_policy.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/py.typed +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/spl/server_client.py +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/splime.egg-info/dependency_links.txt +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/splime.egg-info/entry_points.txt +0 -0
- {splime-0.4.9 → splime-0.4.12}/src/splime.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: splime
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.12
|
|
4
4
|
Summary: Reuse Python functions across projects without rewriting or redeploying them.
|
|
5
5
|
Author-email: Yastrebov Kirill <yastrebovks@gmail.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -21,6 +21,7 @@ Requires-Python: >=3.13
|
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
License-File: LICENSE
|
|
23
23
|
License-File: NOTICE
|
|
24
|
+
Requires-Dist: packaging>=24
|
|
24
25
|
Requires-Dist: certifi==2026.6.17
|
|
25
26
|
Requires-Dist: cryptography==50.0.0
|
|
26
27
|
Requires-Dist: pyyaml==6.0.3
|
|
@@ -38,6 +39,8 @@ Requires-Dist: scikit-learn==1.9.0; extra == "dev"
|
|
|
38
39
|
Requires-Dist: xgboost-cpu==3.3.0; extra == "dev"
|
|
39
40
|
Requires-Dist: dominate==2.9.1; extra == "dev"
|
|
40
41
|
Provides-Extra: test
|
|
42
|
+
Requires-Dist: numpy==2.5.0; extra == "test"
|
|
43
|
+
Requires-Dist: pandas==2.2.3; extra == "test"
|
|
41
44
|
Requires-Dist: python-dotenv[cli]; extra == "test"
|
|
42
45
|
Requires-Dist: pyexpect; extra == "test"
|
|
43
46
|
Requires-Dist: mypy==2.1.0; extra == "test"
|
|
@@ -84,7 +87,7 @@ redeploying.
|
|
|
84
87
|
## Install
|
|
85
88
|
|
|
86
89
|
```bash
|
|
87
|
-
python3.13 -m pip install "splime==0.4.
|
|
90
|
+
python3.13 -m pip install "splime==0.4.12"
|
|
88
91
|
```
|
|
89
92
|
|
|
90
93
|
The distribution is named `splime`; the Python import package is `spl`.
|
|
@@ -119,6 +122,36 @@ print(result.output) # 42.0 (.output always yields the plain value;
|
|
|
119
122
|
That is the whole loop: define a function, `publish` it as a versioned node, then `call`
|
|
120
123
|
it by name and get back the value (plus logs and any artifacts).
|
|
121
124
|
|
|
125
|
+
## Values across per-node runtimes
|
|
126
|
+
|
|
127
|
+
Pipeline edge adapters now carry non-JSON Python values across `native`,
|
|
128
|
+
`venv-subprocess`, and per-node `docker` boundaries. Select an explicit format
|
|
129
|
+
where more than one representation is possible:
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
consumer = lift(use_array).bind(value=producer.as_format("npy"))
|
|
133
|
+
pipeline = consumer.render("array_pipeline").with_node_runtime("use_array", "venv-subprocess")
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
The producing side saves one canonical, checksummed artifact for each unique
|
|
137
|
+
save identity and the consuming side loads it in its own target environment.
|
|
138
|
+
A run-level adapter override takes precedence over `.as_format(...)`. Retained
|
|
139
|
+
runs record the exact save/load provenance and can resume from verified frozen
|
|
140
|
+
artifacts without rerunning the producer.
|
|
141
|
+
|
|
142
|
+
Plain JSON-compatible values keep the historical inline wire shape: no adapter
|
|
143
|
+
bundle, staging file, or artifact directory is created. Custom adapters must be
|
|
144
|
+
plain top-level save/load functions with statically recoverable source. Declare
|
|
145
|
+
every non-stdlib import as an exact distribution dependency so it is installed
|
|
146
|
+
and verified in each isolated target environment.
|
|
147
|
+
|
|
148
|
+
Artifact transport accepts stable regular files only and checks names, sizes,
|
|
149
|
+
SHA-256 digests, adapter identities, and format tags before loading. Current
|
|
150
|
+
limits are 256 MiB per input or output, 512 MiB aggregate inputs and outputs,
|
|
151
|
+
512 KiB for a custom adapter source bundle, and 1,024 adapter bindings. These
|
|
152
|
+
checks harden the transport boundary; they do not make trusted Python functions
|
|
153
|
+
safe to run as arbitrary untrusted code.
|
|
154
|
+
|
|
122
155
|
## Run it where the data lives
|
|
123
156
|
|
|
124
157
|
The same `call` becomes a remote run when you point it at a library, an owner, or a
|
|
@@ -28,7 +28,7 @@ redeploying.
|
|
|
28
28
|
## Install
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
-
python3.13 -m pip install "splime==0.4.
|
|
31
|
+
python3.13 -m pip install "splime==0.4.12"
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
The distribution is named `splime`; the Python import package is `spl`.
|
|
@@ -63,6 +63,36 @@ print(result.output) # 42.0 (.output always yields the plain value;
|
|
|
63
63
|
That is the whole loop: define a function, `publish` it as a versioned node, then `call`
|
|
64
64
|
it by name and get back the value (plus logs and any artifacts).
|
|
65
65
|
|
|
66
|
+
## Values across per-node runtimes
|
|
67
|
+
|
|
68
|
+
Pipeline edge adapters now carry non-JSON Python values across `native`,
|
|
69
|
+
`venv-subprocess`, and per-node `docker` boundaries. Select an explicit format
|
|
70
|
+
where more than one representation is possible:
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
consumer = lift(use_array).bind(value=producer.as_format("npy"))
|
|
74
|
+
pipeline = consumer.render("array_pipeline").with_node_runtime("use_array", "venv-subprocess")
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The producing side saves one canonical, checksummed artifact for each unique
|
|
78
|
+
save identity and the consuming side loads it in its own target environment.
|
|
79
|
+
A run-level adapter override takes precedence over `.as_format(...)`. Retained
|
|
80
|
+
runs record the exact save/load provenance and can resume from verified frozen
|
|
81
|
+
artifacts without rerunning the producer.
|
|
82
|
+
|
|
83
|
+
Plain JSON-compatible values keep the historical inline wire shape: no adapter
|
|
84
|
+
bundle, staging file, or artifact directory is created. Custom adapters must be
|
|
85
|
+
plain top-level save/load functions with statically recoverable source. Declare
|
|
86
|
+
every non-stdlib import as an exact distribution dependency so it is installed
|
|
87
|
+
and verified in each isolated target environment.
|
|
88
|
+
|
|
89
|
+
Artifact transport accepts stable regular files only and checks names, sizes,
|
|
90
|
+
SHA-256 digests, adapter identities, and format tags before loading. Current
|
|
91
|
+
limits are 256 MiB per input or output, 512 MiB aggregate inputs and outputs,
|
|
92
|
+
512 KiB for a custom adapter source bundle, and 1,024 adapter bindings. These
|
|
93
|
+
checks harden the transport boundary; they do not make trusted Python functions
|
|
94
|
+
safe to run as arbitrary untrusted code.
|
|
95
|
+
|
|
66
96
|
## Run it where the data lives
|
|
67
97
|
|
|
68
98
|
The same `call` becomes a remote run when you point it at a library, an owner, or a
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "splime"
|
|
7
|
-
version = "0.4.
|
|
7
|
+
version = "0.4.12"
|
|
8
8
|
|
|
9
9
|
description = "Reuse Python functions across projects without rewriting or redeploying them."
|
|
10
10
|
readme = "README.md"
|
|
@@ -18,6 +18,7 @@ authors = [
|
|
|
18
18
|
requires-python = ">= 3.13"
|
|
19
19
|
|
|
20
20
|
dependencies = [
|
|
21
|
+
"packaging>=24",
|
|
21
22
|
"certifi==2026.6.17",
|
|
22
23
|
"cryptography==50.0.0",
|
|
23
24
|
"pyyaml==6.0.3",
|
|
@@ -52,6 +53,8 @@ dev = [
|
|
|
52
53
|
"dominate==2.9.1"]
|
|
53
54
|
|
|
54
55
|
test = [
|
|
56
|
+
"numpy==2.5.0",
|
|
57
|
+
"pandas==2.2.3",
|
|
55
58
|
"python-dotenv[cli]",
|
|
56
59
|
"pyexpect",
|
|
57
60
|
"mypy==2.1.0",
|
|
@@ -19,6 +19,7 @@ dependencies imported yet.
|
|
|
19
19
|
from __future__ import annotations
|
|
20
20
|
|
|
21
21
|
import builtins
|
|
22
|
+
import enum
|
|
22
23
|
import hashlib
|
|
23
24
|
import os
|
|
24
25
|
import re
|
|
@@ -124,6 +125,13 @@ class _DiscardAdapterOutput:
|
|
|
124
125
|
_DISCARD_ADAPTER_OUTPUT = _DiscardAdapterOutput()
|
|
125
126
|
|
|
126
127
|
|
|
128
|
+
class _NativeResultState(enum.Enum):
|
|
129
|
+
ABSENT = "absent"
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
_NO_NATIVE_VALUE = _NativeResultState.ABSENT
|
|
133
|
+
|
|
134
|
+
|
|
127
135
|
def _preview(value: Any, *, limit: int = 80) -> str:
|
|
128
136
|
preview = repr(value)
|
|
129
137
|
if len(preview) <= limit:
|
|
@@ -131,6 +139,23 @@ def _preview(value: Any, *, limit: int = 80) -> str:
|
|
|
131
139
|
return f"{preview[: limit - 3]}..."
|
|
132
140
|
|
|
133
141
|
|
|
142
|
+
def _native_preview(value: Any) -> str:
|
|
143
|
+
"""Summarize an in-memory result without rendering or serializing it."""
|
|
144
|
+
if type(value) in {type(None), bool, int, float, str}:
|
|
145
|
+
return _preview(value)
|
|
146
|
+
typ = type(value)
|
|
147
|
+
type_name = typ.__qualname__ if typ.__module__ == "builtins" else f"{typ.__module__}.{typ.__qualname__}"
|
|
148
|
+
try:
|
|
149
|
+
shape = getattr(value, "shape", None)
|
|
150
|
+
except Exception:
|
|
151
|
+
shape = None
|
|
152
|
+
if type(shape) is tuple and all(type(item) is int for item in shape):
|
|
153
|
+
return f"<{type_name} shape={shape}>"
|
|
154
|
+
if type(value) in {dict, list, tuple, set, frozenset}:
|
|
155
|
+
return f"<{type_name} length={len(value)}>"
|
|
156
|
+
return f"<{type_name}>"
|
|
157
|
+
|
|
158
|
+
|
|
134
159
|
def _replace_result_path(result: Any, raw_path: Any, value: Any) -> Any:
|
|
135
160
|
"""Replace one closed result path without accepting arbitrary traversal."""
|
|
136
161
|
|
|
@@ -720,33 +745,50 @@ def _wrap_objects(
|
|
|
720
745
|
class RemoteResult:
|
|
721
746
|
"""Completed run result plus downloaded artifact locations.
|
|
722
747
|
|
|
723
|
-
``payload`` is the
|
|
724
|
-
return value under ``result
|
|
725
|
-
|
|
726
|
-
|
|
748
|
+
``payload`` is the host's JSON result document. Legacy/isolated execution
|
|
749
|
+
stores the return value under ``result``; current-process execution stores
|
|
750
|
+
only a JSON-safe descriptor there and keeps the actual object privately for
|
|
751
|
+
``value``/``output``. ``downloaded_artifacts`` is populated only when the
|
|
752
|
+
caller asks this client to download artifacts into a local directory.
|
|
727
753
|
"""
|
|
728
754
|
|
|
729
755
|
run: dict[str, Any]
|
|
730
756
|
payload: dict[str, Any]
|
|
731
757
|
mode: str = "local"
|
|
732
758
|
downloaded_artifacts: dict[str, Path] = field(default_factory=dict)
|
|
759
|
+
_native_value: Any = field(default=_NO_NATIVE_VALUE, repr=False, compare=False)
|
|
760
|
+
|
|
761
|
+
def __eq__(self, other: object) -> bool:
|
|
762
|
+
"""Legacy field equality; native wrappers compare by identity only."""
|
|
763
|
+
if type(other) is not type(self):
|
|
764
|
+
return NotImplemented
|
|
765
|
+
if self._native_value is not _NO_NATIVE_VALUE or other._native_value is not _NO_NATIVE_VALUE:
|
|
766
|
+
return self is other
|
|
767
|
+
return (self.run, self.payload, self.mode, self.downloaded_artifacts) == (
|
|
768
|
+
other.run,
|
|
769
|
+
other.payload,
|
|
770
|
+
other.mode,
|
|
771
|
+
other.downloaded_artifacts,
|
|
772
|
+
)
|
|
733
773
|
|
|
734
774
|
@property
|
|
735
775
|
def value(self) -> Any:
|
|
736
|
-
"""Return the user's
|
|
776
|
+
"""Return the user's result, including native current-process values."""
|
|
737
777
|
|
|
778
|
+
if self._native_value is not _NO_NATIVE_VALUE:
|
|
779
|
+
return self._native_value
|
|
738
780
|
return self.payload.get("result")
|
|
739
781
|
|
|
740
782
|
@property
|
|
741
783
|
def output(self) -> Any:
|
|
742
784
|
"""Return the user's unwrapped result value.
|
|
743
785
|
|
|
744
|
-
Rule: if
|
|
786
|
+
Rule: if the result is a dict and contains the key
|
|
745
787
|
``'default'`` -> return ``result['default']``; else if it has exactly
|
|
746
788
|
one key -> return that value; else return ``result`` as-is.
|
|
747
789
|
"""
|
|
748
790
|
|
|
749
|
-
result = self.
|
|
791
|
+
result = self.value
|
|
750
792
|
if isinstance(result, dict):
|
|
751
793
|
if DEFAULT_PORT in result:
|
|
752
794
|
return result[DEFAULT_PORT]
|
|
@@ -770,12 +812,15 @@ class RemoteResult:
|
|
|
770
812
|
return self.mode == "server"
|
|
771
813
|
|
|
772
814
|
def __repr__(self) -> str:
|
|
773
|
-
|
|
815
|
+
preview = _native_preview(self.value) if self._native_value is not _NO_NATIVE_VALUE else _preview(self.output)
|
|
816
|
+
return f"RemoteResult(mode={self.mode!r}, output={preview})"
|
|
774
817
|
|
|
775
818
|
def _repr_html_(self) -> str:
|
|
776
819
|
rows = {
|
|
777
820
|
"mode": self.mode,
|
|
778
|
-
"output":
|
|
821
|
+
"output": (
|
|
822
|
+
_native_preview(self.value) if self._native_value is not _NO_NATIVE_VALUE else _preview(self.output)
|
|
823
|
+
),
|
|
779
824
|
"artifacts": str(len(self.artifacts)),
|
|
780
825
|
}
|
|
781
826
|
body = "".join(
|
|
@@ -1562,11 +1607,14 @@ class _ObjectAdmin:
|
|
|
1562
1607
|
public: Any = UNSET,
|
|
1563
1608
|
expected_revision: int | None = None,
|
|
1564
1609
|
wait: bool = True,
|
|
1610
|
+
execution_profile: str | None = None,
|
|
1565
1611
|
) -> dict[str, Any]:
|
|
1566
1612
|
"""Update one revisioned profile and optionally activate/withdraw it."""
|
|
1567
1613
|
|
|
1568
1614
|
self._c._daemon.require_public_profile_capability(PUBLIC_OBJECT_PROFILE_CAPABILITY)
|
|
1569
1615
|
payload: dict[str, Any] = {"wait": wait}
|
|
1616
|
+
if execution_profile is not None:
|
|
1617
|
+
payload["execution_profile"] = execution_profile
|
|
1570
1618
|
if library is not None:
|
|
1571
1619
|
payload["library"] = library
|
|
1572
1620
|
if description is not UNSET:
|
|
@@ -1592,10 +1640,14 @@ class _ObjectAdmin:
|
|
|
1592
1640
|
name_or_id: str,
|
|
1593
1641
|
*,
|
|
1594
1642
|
library: str | None = None,
|
|
1643
|
+
execution_profile: str | None = None,
|
|
1595
1644
|
) -> dict[str, Any]:
|
|
1596
1645
|
"""Validate and materialize a candidate without activating it."""
|
|
1597
1646
|
|
|
1598
|
-
|
|
1647
|
+
options: dict[str, Any] = {"library": library}
|
|
1648
|
+
if execution_profile is not None:
|
|
1649
|
+
options["execution_profile"] = execution_profile
|
|
1650
|
+
return self._c._daemon.preflight_public_object(name_or_id, **options)
|
|
1599
1651
|
|
|
1600
1652
|
|
|
1601
1653
|
class SPLClient:
|
|
@@ -1651,6 +1703,10 @@ class SPLClient:
|
|
|
1651
1703
|
) -> "SPLClient":
|
|
1652
1704
|
"""Create a daemon-free client for verified public releases only.
|
|
1653
1705
|
|
|
1706
|
+
Signed current-process-v1 releases run in this interpreter using its
|
|
1707
|
+
packages; legacy releases retain isolated worker execution. Selection
|
|
1708
|
+
is authenticated at publication and cannot be overridden by a call.
|
|
1709
|
+
|
|
1654
1710
|
``run_receipts=False`` disables privacy-minimal best-effort public Run
|
|
1655
1711
|
counters. ``SPL_PUBLIC_RUN_RECEIPTS=0`` provides the same opt-out.
|
|
1656
1712
|
"""
|
|
@@ -3836,7 +3892,7 @@ class SPLClient:
|
|
|
3836
3892
|
f"feature_not_supported: {message}",
|
|
3837
3893
|
payload={"code": "feature_not_supported", "error": message},
|
|
3838
3894
|
)
|
|
3839
|
-
|
|
3895
|
+
embedded_result = self._embedded_backend.call(
|
|
3840
3896
|
name,
|
|
3841
3897
|
args=args,
|
|
3842
3898
|
kwargs=kwargs,
|
|
@@ -3845,10 +3901,11 @@ class SPLClient:
|
|
|
3845
3901
|
trust=trust,
|
|
3846
3902
|
)
|
|
3847
3903
|
return RemoteResult(
|
|
3848
|
-
run=
|
|
3849
|
-
payload=payload,
|
|
3904
|
+
run=embedded_result.run,
|
|
3905
|
+
payload=embedded_result.payload,
|
|
3850
3906
|
mode="embedded",
|
|
3851
|
-
downloaded_artifacts=
|
|
3907
|
+
downloaded_artifacts=embedded_result.downloaded_artifacts,
|
|
3908
|
+
_native_value=(embedded_result.native_value if embedded_result.has_native_value else _NO_NATIVE_VALUE),
|
|
3852
3909
|
)
|
|
3853
3910
|
|
|
3854
3911
|
if trust:
|
|
@@ -75,6 +75,13 @@ def run_process_tree(
|
|
|
75
75
|
output=stdout_text,
|
|
76
76
|
stderr=stderr_text,
|
|
77
77
|
) from exc
|
|
78
|
+
except BaseException:
|
|
79
|
+
if process_groups_supported:
|
|
80
|
+
_terminate_timed_out_process(process, grace_seconds=termination_grace_seconds)
|
|
81
|
+
else:
|
|
82
|
+
process.kill()
|
|
83
|
+
process.communicate()
|
|
84
|
+
raise
|
|
78
85
|
|
|
79
86
|
return subprocess.CompletedProcess(
|
|
80
87
|
list(command),
|
|
@@ -290,7 +290,8 @@ def _png_pillow_save(path: str, value: Any) -> None:
|
|
|
290
290
|
|
|
291
291
|
|
|
292
292
|
def _png_pillow_load(path: str) -> Any:
|
|
293
|
-
|
|
293
|
+
# Pillow may be absent, or installed with its own type information.
|
|
294
|
+
from PIL import Image # type: ignore[import-not-found, unused-ignore]
|
|
294
295
|
|
|
295
296
|
with Image.open(path) as source:
|
|
296
297
|
if source.format != "PNG":
|
|
@@ -388,7 +389,9 @@ def _distribution(package: str) -> DDistribution | None:
|
|
|
388
389
|
# version from the Object/Run environment during preflight.
|
|
389
390
|
del exc
|
|
390
391
|
return None
|
|
391
|
-
|
|
392
|
+
module = "PIL" if package == "Pillow" else package
|
|
393
|
+
modules = (module,) if module.isidentifier() else ()
|
|
394
|
+
return DDistribution(package=package, version=version, modules=modules)
|
|
392
395
|
|
|
393
396
|
|
|
394
397
|
def _available_distributions(*packages: str) -> tuple[DDistribution, ...]:
|