plesty-server 0.4.0.dev1__tar.gz → 0.4.2__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.
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/PKG-INFO +4 -4
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/cli/main.py +2 -32
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/model/catalogue.py +34 -1
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/presenter/bench.py +7 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/services/agent.py +76 -2
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/services/installer.py +83 -5
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/services/launch.py +30 -7
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/view/dialogs.py +118 -26
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/pyproject.toml +4 -4
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/LICENSE +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/LICENSES/LGPL-3.0-or-later.txt +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/README.md +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/__init__.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/__main__.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/assets/console.qss +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/assets/env.example +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/assets/fleet.example.yaml +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/assets/plesty-mark.svg +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/assets/report.css +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/assets/report.html +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/cli/__init__.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/config.yaml +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/host.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/model/__init__.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/model/agent.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/model/device.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/model/device_manager.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/model/envfile.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/model/errors.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/model/experiment.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/model/field_test.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/model/fleet.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/model/home.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/model/job.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/model/peer.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/model/ports.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/model/process.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/model/purge.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/model/traffic.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/presenter/__init__.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/reexec.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/services/__init__.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/services/catalogue.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/services/control.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/services/experiments.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/services/gitbin.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/services/jobs.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/services/nodes.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/services/problem_report.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/services/run_report.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/services/supervisor.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/view/__init__.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/view/app.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/view/control.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/view/window.py +0 -0
- {plesty_server-0.4.0.dev1 → plesty_server-0.4.2}/plesty/server/view/workers.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: plesty-server
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: The PLESTY bench application: installs, runs and field-tests device servers.
|
|
5
5
|
Project-URL: Homepage, https://gitlab.com/plesty/core/plesty-bench
|
|
6
6
|
Project-URL: Documentation, https://plesty.gitlab.io/core/plesty-bench/
|
|
@@ -11,12 +11,12 @@ License-File: LICENSE
|
|
|
11
11
|
License-File: LICENSES/LGPL-3.0-or-later.txt
|
|
12
12
|
Requires-Python: >=3.12
|
|
13
13
|
Requires-Dist: click>=8.1
|
|
14
|
-
Requires-Dist: plesty-bench==0.4.
|
|
15
|
-
Requires-Dist: plesty-lib[report]>=0.5.0
|
|
14
|
+
Requires-Dist: plesty-bench==0.4.2
|
|
15
|
+
Requires-Dist: plesty-lib[report]>=0.5.0
|
|
16
16
|
Requires-Dist: pyyaml>=6.0
|
|
17
17
|
Requires-Dist: pyzmq>=26
|
|
18
18
|
Provides-Extra: gui
|
|
19
|
-
Requires-Dist: plesty-lib[gui]>=0.5.0
|
|
19
|
+
Requires-Dist: plesty-lib[gui]>=0.5.0; extra == 'gui'
|
|
20
20
|
Requires-Dist: pyside6==6.11.2; extra == 'gui'
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
|
|
@@ -23,6 +23,7 @@ from pathlib import Path
|
|
|
23
23
|
|
|
24
24
|
import click
|
|
25
25
|
|
|
26
|
+
from plesty.bench.streams import printable_output
|
|
26
27
|
from plesty.server.model import (
|
|
27
28
|
DEFAULT_WORKERS,
|
|
28
29
|
FLEET_FILENAME,
|
|
@@ -1091,41 +1092,10 @@ def _echo_status(status: ProcessStatus) -> None:
|
|
|
1091
1092
|
|
|
1092
1093
|
def main() -> None:
|
|
1093
1094
|
"""Console-script entry point."""
|
|
1094
|
-
|
|
1095
|
+
printable_output()
|
|
1095
1096
|
app(prog_name="plesty-server")
|
|
1096
1097
|
|
|
1097
1098
|
|
|
1098
|
-
def _printable_output() -> None:
|
|
1099
|
-
"""Never let the console's codepage turn output into a crash.
|
|
1100
|
-
|
|
1101
|
-
A job log holds whatever the tools wrote — uv draws its resolution errors
|
|
1102
|
-
with box characters — and a Windows console is cp1252 by default, which
|
|
1103
|
-
cannot encode them. Echoing such a log raised UnicodeEncodeError and the
|
|
1104
|
-
operator got a traceback instead of the one-line error the log actually
|
|
1105
|
-
contained.
|
|
1106
|
-
|
|
1107
|
-
A console keeps its own encoding and loses what it cannot draw: a ``?`` is
|
|
1108
|
-
a fair price for the message surviving. Anything redirected is a file this
|
|
1109
|
-
bench owns — a job log, read back later and sent to whoever is helping —
|
|
1110
|
-
so it is written as UTF-8 and keeps every character.
|
|
1111
|
-
"""
|
|
1112
|
-
for stream in (sys.stdout, sys.stderr):
|
|
1113
|
-
reconfigure = getattr(stream, "reconfigure", None)
|
|
1114
|
-
if reconfigure is None:
|
|
1115
|
-
continue
|
|
1116
|
-
try:
|
|
1117
|
-
console = stream.isatty()
|
|
1118
|
-
except (ValueError, OSError): # pragma: no cover — a stream already closed
|
|
1119
|
-
continue
|
|
1120
|
-
try:
|
|
1121
|
-
if console:
|
|
1122
|
-
reconfigure(errors="replace")
|
|
1123
|
-
else:
|
|
1124
|
-
reconfigure(encoding="utf-8", errors="replace")
|
|
1125
|
-
except (ValueError, OSError): # pragma: no cover — a stream that refuses
|
|
1126
|
-
pass
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
1099
|
def gui_main() -> None:
|
|
1130
1100
|
"""GUI-script entry point (``plesty-server-gui``): the console window, no terminal.
|
|
1131
1101
|
|
|
@@ -13,6 +13,7 @@ presenter; this module only reads the JSON.
|
|
|
13
13
|
|
|
14
14
|
from __future__ import annotations
|
|
15
15
|
|
|
16
|
+
import re
|
|
16
17
|
from collections.abc import Mapping
|
|
17
18
|
from dataclasses import dataclass
|
|
18
19
|
from typing import Any
|
|
@@ -29,6 +30,19 @@ REQUIRED_STANDARD = "quantum"
|
|
|
29
30
|
#: something a bench stocks on its own.
|
|
30
31
|
INSTALLABLE_CATEGORIES = ("devices", "experiments")
|
|
31
32
|
|
|
33
|
+
#: The plesty-sdk whose gates include Experiment Manifest (e3): an experiment
|
|
34
|
+
#: whose check ran on it and passed answers ``--manifest``, which is what the
|
|
35
|
+
#: console configures a run from. Checked on anything older, or failing, the
|
|
36
|
+
#: module may not — and every hub experiment of the 0.4.0 bench's day did not,
|
|
37
|
+
#: so Configure failed on each one installed (plesty-bench#15).
|
|
38
|
+
MANIFEST_SDK = (0, 5, 0)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _release(version: str) -> tuple[int, ...]:
|
|
42
|
+
"""``0.5.0`` → ``(0, 5, 0)``; the release part only, empty when there is none."""
|
|
43
|
+
parts = re.match(r"(\d+(?:\.\d+)*)", version.strip())
|
|
44
|
+
return tuple(int(p) for p in parts.group(1).split(".")) if parts else ()
|
|
45
|
+
|
|
32
46
|
|
|
33
47
|
@dataclass(frozen=True)
|
|
34
48
|
class CatalogueEntry:
|
|
@@ -51,6 +65,7 @@ class CatalogueEntry:
|
|
|
51
65
|
gates_passed: Gates passed in it.
|
|
52
66
|
gates_failed: Gates failed in it.
|
|
53
67
|
field_tests: Number of published field-test reports.
|
|
68
|
+
sdk_version: The plesty-sdk that report was made with, or empty.
|
|
54
69
|
"""
|
|
55
70
|
|
|
56
71
|
name: str
|
|
@@ -69,6 +84,18 @@ class CatalogueEntry:
|
|
|
69
84
|
gates_passed: int = 0
|
|
70
85
|
gates_failed: int = 0
|
|
71
86
|
field_tests: int = 0
|
|
87
|
+
sdk_version: str = ""
|
|
88
|
+
|
|
89
|
+
@property
|
|
90
|
+
def publishes_manifest(self) -> bool:
|
|
91
|
+
"""Whether the module is shown to answer ``--manifest``; true of any non-experiment.
|
|
92
|
+
|
|
93
|
+
Shown by its published check: passed, on a plesty-sdk that has the
|
|
94
|
+
Experiment Manifest gate (:data:`MANIFEST_SDK`).
|
|
95
|
+
"""
|
|
96
|
+
if self.category != "experiments":
|
|
97
|
+
return True
|
|
98
|
+
return self.checked and self.gates_ok and _release(self.sdk_version) >= MANIFEST_SDK
|
|
72
99
|
|
|
73
100
|
@property
|
|
74
101
|
def installable(self) -> bool:
|
|
@@ -77,12 +104,15 @@ class CatalogueEntry:
|
|
|
77
104
|
The standard is the gate, not the category: what a bench installs it
|
|
78
105
|
also runs, and a module that has not met the standard has not shown
|
|
79
106
|
that it can be. A module the hub lists without one is not offered here
|
|
80
|
-
until its registry entry says it reached it.
|
|
107
|
+
until its registry entry says it reached it. An experiment must also
|
|
108
|
+
publish its manifest (:attr:`publishes_manifest`): one that does not
|
|
109
|
+
installs, and then cannot be configured.
|
|
81
110
|
"""
|
|
82
111
|
return (
|
|
83
112
|
self.category in INSTALLABLE_CATEGORIES
|
|
84
113
|
and self.standard == REQUIRED_STANDARD
|
|
85
114
|
and bool(self.repo_url)
|
|
115
|
+
and self.publishes_manifest
|
|
86
116
|
)
|
|
87
117
|
|
|
88
118
|
@property
|
|
@@ -114,6 +144,8 @@ class CatalogueEntry:
|
|
|
114
144
|
gates_raw = quality.get("gates")
|
|
115
145
|
gates: Mapping[str, Any] = gates_raw if isinstance(gates_raw, Mapping) else {}
|
|
116
146
|
field_tests = quality.get("field_tests")
|
|
147
|
+
tooling = quality.get("tooling")
|
|
148
|
+
sdk = tooling.get("plesty-sdk", "") if isinstance(tooling, Mapping) else ""
|
|
117
149
|
return cls(
|
|
118
150
|
name=str(raw.get("name", "")),
|
|
119
151
|
slug=str(raw.get("slug", "")),
|
|
@@ -131,6 +163,7 @@ class CatalogueEntry:
|
|
|
131
163
|
gates_passed=int(gates.get("passed", 0) or 0),
|
|
132
164
|
gates_failed=int(gates.get("failed", 0) or 0),
|
|
133
165
|
field_tests=len(field_tests) if isinstance(field_tests, list) else 0,
|
|
166
|
+
sdk_version=str(sdk or ""),
|
|
134
167
|
)
|
|
135
168
|
|
|
136
169
|
|
|
@@ -2167,6 +2167,13 @@ class Bench:
|
|
|
2167
2167
|
Raises:
|
|
2168
2168
|
BenchError: When the entry is not an installable device.
|
|
2169
2169
|
"""
|
|
2170
|
+
if not entry.publishes_manifest:
|
|
2171
|
+
raise BenchError(
|
|
2172
|
+
f"{entry.name} cannot be installed yet: it has not been updated for this "
|
|
2173
|
+
"version of PLESTY Bench, so its settings could not be edited in the "
|
|
2174
|
+
"Configure window. Ask its maintainer for a release that passes the current "
|
|
2175
|
+
"checks, or run a copy of it on this machine with Hub > Load from..."
|
|
2176
|
+
)
|
|
2170
2177
|
if not entry.installable:
|
|
2171
2178
|
raise BenchError(
|
|
2172
2179
|
f"{entry.name}: not installable — the bench takes device and experiment "
|
|
@@ -63,6 +63,81 @@ FETCH_LIMIT = 16 * 1024 * 1024
|
|
|
63
63
|
#: than anything else the agent answers.
|
|
64
64
|
DEVICE_TIMEOUT_MS = 15000
|
|
65
65
|
|
|
66
|
+
|
|
67
|
+
class _ThreadStream(io.TextIOBase):
|
|
68
|
+
"""``sys.stdout``/``sys.stderr`` that sends each thread's writes to its own buffer.
|
|
69
|
+
|
|
70
|
+
``exec`` captures what a command prints, and requests run on several worker
|
|
71
|
+
threads at once. ``contextlib.redirect_stdout`` swaps the stream for the
|
|
72
|
+
whole process, so two commands running together wrote into each other's
|
|
73
|
+
capture: a client's ``jobs cancel`` was answered with the ``[]`` of a
|
|
74
|
+
console's ``jobs list --json`` poll, and an ``install`` that was being
|
|
75
|
+
followed got an empty ``jobs log --json`` and died on it (#19). This
|
|
76
|
+
stands in for the stream once, and a thread that is capturing gets its
|
|
77
|
+
own buffer; every other thread writes through to the original stream.
|
|
78
|
+
"""
|
|
79
|
+
|
|
80
|
+
def __init__(self, original: Any) -> None:
|
|
81
|
+
super().__init__()
|
|
82
|
+
self.original = original
|
|
83
|
+
self.local = threading.local()
|
|
84
|
+
|
|
85
|
+
def writable(self) -> bool: # noqa: D102 — io protocol
|
|
86
|
+
return True
|
|
87
|
+
|
|
88
|
+
def _target(self) -> Any:
|
|
89
|
+
# The windowed console (pythonw) has no stream at all: None is discarded.
|
|
90
|
+
target = getattr(self.local, "buffer", None)
|
|
91
|
+
return target if target is not None else self.original
|
|
92
|
+
|
|
93
|
+
def write(self, text: str) -> int: # noqa: D102 — io protocol
|
|
94
|
+
target = self._target()
|
|
95
|
+
return len(text) if target is None else int(target.write(text))
|
|
96
|
+
|
|
97
|
+
def flush(self) -> None: # noqa: D102 — io protocol
|
|
98
|
+
target = self._target()
|
|
99
|
+
if target is not None:
|
|
100
|
+
target.flush()
|
|
101
|
+
|
|
102
|
+
def isatty(self) -> bool: # noqa: D102 — io protocol
|
|
103
|
+
return getattr(self.local, "buffer", None) is None and bool(
|
|
104
|
+
getattr(self.original, "isatty", lambda: False)()
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
@property
|
|
108
|
+
def encoding(self) -> str: # type: ignore[override] # noqa: D102 — io protocol
|
|
109
|
+
return str(getattr(self.original, "encoding", None) or "utf-8")
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
_STREAMS_LOCK = threading.Lock()
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def _thread_stream(name: str) -> _ThreadStream:
|
|
116
|
+
"""The process's ``sys.<name>`` as a :class:`_ThreadStream`, installed on first use."""
|
|
117
|
+
import sys
|
|
118
|
+
|
|
119
|
+
with _STREAMS_LOCK:
|
|
120
|
+
current = getattr(sys, name)
|
|
121
|
+
if not isinstance(current, _ThreadStream):
|
|
122
|
+
current = _ThreadStream(current)
|
|
123
|
+
setattr(sys, name, current)
|
|
124
|
+
return current
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
@contextlib.contextmanager
|
|
128
|
+
def _captured() -> Any:
|
|
129
|
+
"""Capture what this thread prints, and only this thread; yields ``(out, err)``."""
|
|
130
|
+
out, err = io.StringIO(), io.StringIO()
|
|
131
|
+
streams = (_thread_stream("stdout"), _thread_stream("stderr"))
|
|
132
|
+
for stream, buffer in zip(streams, (out, err), strict=True):
|
|
133
|
+
stream.local.buffer = buffer
|
|
134
|
+
try:
|
|
135
|
+
yield out, err
|
|
136
|
+
finally:
|
|
137
|
+
for stream in streams:
|
|
138
|
+
stream.local.buffer = None
|
|
139
|
+
|
|
140
|
+
|
|
66
141
|
#: Per-thread relay sockets. A ZMQ socket belongs to the thread that made it,
|
|
67
142
|
#: and the agent answers on a pool: a socket kept here is only ever used by the
|
|
68
143
|
#: worker that opened it, which is what makes reuse safe. The alternative — one
|
|
@@ -150,9 +225,8 @@ class Agent:
|
|
|
150
225
|
prefix = ["--home", str(self.home.root)]
|
|
151
226
|
if self.fleet_path is not None:
|
|
152
227
|
prefix += ["-f", str(self.fleet_path)]
|
|
153
|
-
out, err = io.StringIO(), io.StringIO()
|
|
154
228
|
code = 0
|
|
155
|
-
with
|
|
229
|
+
with _captured() as (out, err):
|
|
156
230
|
try:
|
|
157
231
|
app.main(args=[*prefix, *args], prog_name="plesty-server", standalone_mode=False)
|
|
158
232
|
except SystemExit as exc: # click.exceptions.Exit
|
|
@@ -29,6 +29,7 @@ import json
|
|
|
29
29
|
import os
|
|
30
30
|
import shutil
|
|
31
31
|
import subprocess
|
|
32
|
+
import sys
|
|
32
33
|
import time
|
|
33
34
|
import tomllib
|
|
34
35
|
from collections.abc import Callable
|
|
@@ -74,6 +75,19 @@ SYNC_ARGS = ["sync", "--no-dev"]
|
|
|
74
75
|
#: Minimum interpreter every PLESTY module requires (``requires-python``).
|
|
75
76
|
PYTHON_SPEC = ">=3.12"
|
|
76
77
|
|
|
78
|
+
#: The Python the console runs on, as ``major.minor``. A module's environment
|
|
79
|
+
#: is built on it, because the console imports an experiment's views into its
|
|
80
|
+
#: own process, and a module saying ``>=3.12`` otherwise got the newest Python
|
|
81
|
+
#: uv had: pol-pl on 3.14 against a console on 3.12, whose views could then only
|
|
82
|
+
#: open in a window of their own. Taken from the running interpreter, not
|
|
83
|
+
#: written down, so it follows whatever the console is installed on.
|
|
84
|
+
CONSOLE_PYTHON = f"{sys.version_info.major}.{sys.version_info.minor}"
|
|
85
|
+
|
|
86
|
+
#: What uv says when a module will not run on :data:`CONSOLE_PYTHON` — ``uv
|
|
87
|
+
#: sync`` and ``uv pip install`` word it differently. Such a module is built on
|
|
88
|
+
#: what it asks for instead, as before.
|
|
89
|
+
PYTHON_REFUSED_HINTS = ("incompatible with the project's python requirement", "does not satisfy")
|
|
90
|
+
|
|
77
91
|
#: Staging directory an unpinned install resolves in before it is moved.
|
|
78
92
|
STAGING_PREFIX = ".staging-"
|
|
79
93
|
|
|
@@ -84,6 +98,14 @@ PRERELEASE_HINT = "pre-release"
|
|
|
84
98
|
#: environment — no interpreter inside it.
|
|
85
99
|
BROKEN_VENV_HINT = "not a valid python environment"
|
|
86
100
|
|
|
101
|
+
#: What makes a directory a venv. A uv venv's ``python.exe`` is a trampoline
|
|
102
|
+
#: that reads this file to find its interpreter; without it, it starts the
|
|
103
|
+
#: *base* interpreter with no venv at all. uv then takes that interpreter for
|
|
104
|
+
#: the environment and installs into it, so a ``.venv`` an interrupted sync left
|
|
105
|
+
#: as ``Scripts\python.exe`` alone put an experiment, plesty-lib and everything
|
|
106
|
+
#: else into the shared uv Python, and every check still passed.
|
|
107
|
+
VENV_CONFIG = "pyvenv.cfg"
|
|
108
|
+
|
|
87
109
|
#: What uv says when it wrote a console-script trampoline and could not reopen
|
|
88
110
|
#: it to patch its resources — an on-access scanner holding the executable it
|
|
89
111
|
#: has just been handed. ``os error -2147024786`` is ``ERROR_OPEN_FAILED``.
|
|
@@ -445,6 +467,13 @@ class Installer:
|
|
|
445
467
|
)
|
|
446
468
|
self._git_call(["-C", str(root), "checkout", "--quiet", ref], f"check out {ref}")
|
|
447
469
|
python = venv_python(root / CHECKOUT_VENV)
|
|
470
|
+
if python.exists() and not (root / CHECKOUT_VENV / VENV_CONFIG).is_file():
|
|
471
|
+
# The developer's folder, so it is reported rather than removed.
|
|
472
|
+
raise InstallError(
|
|
473
|
+
f"{root / CHECKOUT_VENV} has no {VENV_CONFIG}, so it would run the shared "
|
|
474
|
+
"Python rather than an environment of its own: delete that folder, run "
|
|
475
|
+
"`uv sync` there, then load it again"
|
|
476
|
+
)
|
|
448
477
|
if not python.exists():
|
|
449
478
|
self._echo(f"{module.package}: no {CHECKOUT_VENV} in {root} — creating it")
|
|
450
479
|
self._uv_call(["sync", "--directory", str(root)], f"sync {root.name}")
|
|
@@ -613,14 +642,28 @@ class Installer:
|
|
|
613
642
|
if staging.exists():
|
|
614
643
|
remove_tree(staging)
|
|
615
644
|
python = venv_python(staging)
|
|
616
|
-
|
|
645
|
+
|
|
646
|
+
def build(interpreter: str) -> None:
|
|
617
647
|
self._uv_call(
|
|
618
|
-
["venv", "--relocatable", "--python",
|
|
648
|
+
["venv", "--relocatable", "--python", interpreter, str(staging)], "create venv"
|
|
619
649
|
)
|
|
620
650
|
self._uv_resolve(
|
|
621
651
|
["pip", "install", "--python", str(python), "--upgrade", spec.requirement],
|
|
622
652
|
f"install {spec.requirement}",
|
|
623
653
|
)
|
|
654
|
+
|
|
655
|
+
try:
|
|
656
|
+
try:
|
|
657
|
+
build(CONSOLE_PYTHON)
|
|
658
|
+
except InstallError as exc:
|
|
659
|
+
if not _python_refused(exc):
|
|
660
|
+
raise
|
|
661
|
+
self._echo(
|
|
662
|
+
f"{spec.package} does not run on Python {CONSOLE_PYTHON}, the console's — "
|
|
663
|
+
"building it on what it asks for; its views will open in a window of their own"
|
|
664
|
+
)
|
|
665
|
+
remove_tree(staging)
|
|
666
|
+
build(PYTHON_SPEC)
|
|
624
667
|
except InstallError:
|
|
625
668
|
# the fallback installs into the same tree; leave nothing half-built
|
|
626
669
|
if staging.exists():
|
|
@@ -748,15 +791,44 @@ class Installer:
|
|
|
748
791
|
Deleting it is safe: uv owns the directory and rebuilds it from the
|
|
749
792
|
lock. Only this failure is retried — any other sync error is the
|
|
750
793
|
module's own and is raised unchanged.
|
|
794
|
+
|
|
795
|
+
A ``.venv`` without :data:`VENV_CONFIG` is removed before the sync, and
|
|
796
|
+
one still without it afterwards fails the install: its interpreter is
|
|
797
|
+
the shared one, and an install that "succeeds" into it is worse than one
|
|
798
|
+
that stops.
|
|
751
799
|
"""
|
|
800
|
+
venv = checkout / CHECKOUT_VENV
|
|
801
|
+
if venv.is_dir() and not (venv / VENV_CONFIG).is_file():
|
|
802
|
+
self._echo(f"sync the checkout: its venv has no {VENV_CONFIG} — rebuilding it")
|
|
803
|
+
remove_tree(venv)
|
|
804
|
+
# On the console's Python (see CONSOLE_PYTHON); uv replaces a .venv built
|
|
805
|
+
# on another one, so an existing install moves onto it with its next sync.
|
|
806
|
+
args = SYNC_ARGS + ["--python", CONSOLE_PYTHON, "--directory", str(checkout)]
|
|
752
807
|
try:
|
|
753
|
-
|
|
808
|
+
try:
|
|
809
|
+
self._uv_resolve(args, "sync the checkout")
|
|
810
|
+
except InstallError as exc:
|
|
811
|
+
if not _python_refused(exc):
|
|
812
|
+
raise
|
|
813
|
+
self._echo(
|
|
814
|
+
f"{checkout.name}: the module does not run on Python {CONSOLE_PYTHON}, the "
|
|
815
|
+
"console's — building it on what it asks for; its views will open in a "
|
|
816
|
+
"window of their own"
|
|
817
|
+
)
|
|
818
|
+
args = SYNC_ARGS + ["--directory", str(checkout)]
|
|
819
|
+
self._uv_resolve(args, "sync the checkout")
|
|
754
820
|
except InstallError as exc:
|
|
755
821
|
if BROKEN_VENV_HINT not in str(exc).lower():
|
|
756
822
|
raise
|
|
757
823
|
self._echo("sync the checkout: its venv holds no interpreter — rebuilding it")
|
|
758
|
-
remove_tree(
|
|
759
|
-
self._uv_resolve(
|
|
824
|
+
remove_tree(venv)
|
|
825
|
+
self._uv_resolve(args, "sync the checkout")
|
|
826
|
+
if not (venv / VENV_CONFIG).is_file():
|
|
827
|
+
raise InstallError(
|
|
828
|
+
f"could not sync the checkout: {venv} has no {VENV_CONFIG} after uv sync, so "
|
|
829
|
+
"it would run the shared Python rather than an environment of its own. "
|
|
830
|
+
"Remove that folder and install again."
|
|
831
|
+
)
|
|
760
832
|
|
|
761
833
|
def _uv_resolve(self, args: list[str], what: str) -> subprocess.CompletedProcess[str]:
|
|
762
834
|
"""Run a resolving ``uv`` command, retrying once with pre-releases allowed.
|
|
@@ -823,6 +895,12 @@ def _print(line: str) -> None:
|
|
|
823
895
|
print(line, flush=True)
|
|
824
896
|
|
|
825
897
|
|
|
898
|
+
def _python_refused(exc: InstallError) -> bool:
|
|
899
|
+
"""Whether uv failed because the module will not run on the Python it was given."""
|
|
900
|
+
text = " ".join(str(exc).lower().split()) # uv wraps its explanation across lines
|
|
901
|
+
return any(hint in text for hint in PYTHON_REFUSED_HINTS)
|
|
902
|
+
|
|
903
|
+
|
|
826
904
|
def _canonical(name: str) -> str:
|
|
827
905
|
"""PEP 503 normalisation, enough to compare distribution names."""
|
|
828
906
|
return name.strip().lower().replace("_", "-").replace(".", "-")
|
|
@@ -24,6 +24,7 @@ import os
|
|
|
24
24
|
import shutil
|
|
25
25
|
import subprocess
|
|
26
26
|
import sys
|
|
27
|
+
import time
|
|
27
28
|
from collections.abc import Mapping, Sequence
|
|
28
29
|
from datetime import UTC, datetime
|
|
29
30
|
from pathlib import Path
|
|
@@ -168,15 +169,37 @@ def launch(
|
|
|
168
169
|
raise RuntimeError("launcher reported no pid") from exc
|
|
169
170
|
|
|
170
171
|
|
|
172
|
+
#: Tries, and the pause between them, for an exit file Windows will not open yet.
|
|
173
|
+
READ_EXIT_TRIES = 5
|
|
174
|
+
READ_EXIT_PAUSE_S = 0.02
|
|
175
|
+
|
|
176
|
+
|
|
171
177
|
def read_exit(exit_file: str | os.PathLike[str]) -> int | None:
|
|
172
|
-
"""The exit code recorded in *exit_file*, or ``None`` while it
|
|
178
|
+
"""The exit code recorded in *exit_file*, or ``None`` while it cannot be read yet.
|
|
179
|
+
|
|
180
|
+
The waiter writes the code to a temporary file and moves it into place
|
|
181
|
+
(:func:`_write_exit`). On Windows, opening the file while that move is
|
|
182
|
+
under way is refused with ``PermissionError`` — a supervisor checking a
|
|
183
|
+
stopping device at that moment raised it instead of answering (found on the
|
|
184
|
+
project's own Windows runner). The move takes milliseconds, so the read is
|
|
185
|
+
tried again briefly, and a file still refused is reported as not there yet:
|
|
186
|
+
every caller polls again.
|
|
187
|
+
"""
|
|
173
188
|
path = Path(exit_file)
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
189
|
+
for attempt in range(READ_EXIT_TRIES):
|
|
190
|
+
if not path.is_file():
|
|
191
|
+
return None
|
|
192
|
+
try:
|
|
193
|
+
text = path.read_text(encoding="utf-8")
|
|
194
|
+
except PermissionError:
|
|
195
|
+
if attempt + 1 < READ_EXIT_TRIES:
|
|
196
|
+
time.sleep(READ_EXIT_PAUSE_S)
|
|
197
|
+
continue
|
|
198
|
+
try:
|
|
199
|
+
return int(text.strip())
|
|
200
|
+
except ValueError:
|
|
201
|
+
return -1
|
|
202
|
+
return None
|
|
180
203
|
|
|
181
204
|
|
|
182
205
|
def _wait(spec: dict[str, Any]) -> int:
|
|
@@ -1285,14 +1285,17 @@ class CreateRunDialog(QDialog):
|
|
|
1285
1285
|
self.git.setText(installed.path)
|
|
1286
1286
|
self.ref.setText(installed.ref or "")
|
|
1287
1287
|
self.args.setText("")
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1288
|
+
self._offer_configs(_checkout_configs(installed.path))
|
|
1289
|
+
self.run_id.setText("")
|
|
1290
|
+
|
|
1291
|
+
def _offer_configs(self, configs: list[str]) -> None:
|
|
1292
|
+
"""List *configs*, proposing the default one when it is among them."""
|
|
1292
1293
|
self.config.clear()
|
|
1293
1294
|
self.config.addItems(configs)
|
|
1294
|
-
|
|
1295
|
-
|
|
1295
|
+
if EXPERIMENT_DEFAULT_CONFIG in configs or not configs:
|
|
1296
|
+
self.config.setCurrentText(EXPERIMENT_DEFAULT_CONFIG)
|
|
1297
|
+
else:
|
|
1298
|
+
self.config.setCurrentText(configs[0])
|
|
1296
1299
|
|
|
1297
1300
|
def _fill_from_declaration(self, name: str) -> None:
|
|
1298
1301
|
"""Fill the form from an experiment this bench already declares."""
|
|
@@ -1332,8 +1335,10 @@ class CreateRunDialog(QDialog):
|
|
|
1332
1335
|
self.git.setText(getattr(installed, "git", "") or "")
|
|
1333
1336
|
self.ref.setText(getattr(installed, "ref", "") or "")
|
|
1334
1337
|
self.args.setText("")
|
|
1335
|
-
|
|
1336
|
-
|
|
1338
|
+
# A Marketplace install from a repository is a checkout, and its config/
|
|
1339
|
+
# is what a run may be given -- config/demo.yaml beside the default one.
|
|
1340
|
+
# This used to offer the default alone, so the demo could not be chosen.
|
|
1341
|
+
self._offer_configs(_checkout_configs(getattr(installed, "path", "") or ""))
|
|
1337
1342
|
# Nothing is declared under this name yet, so there is no run to number
|
|
1338
1343
|
# against: the bench proposes the first one once the declaration exists.
|
|
1339
1344
|
self.run_id.setText("")
|
|
@@ -1585,8 +1590,10 @@ class YamlDialog(QDialog):
|
|
|
1585
1590
|
anyway, and the form could not show it.
|
|
1586
1591
|
"""
|
|
1587
1592
|
|
|
1588
|
-
def __init__(
|
|
1589
|
-
|
|
1593
|
+
def __init__(
|
|
1594
|
+
self, parent: QWidget | None, path: str, text: str, read_only: bool = False
|
|
1595
|
+
) -> None:
|
|
1596
|
+
"""Open *text*, the file at *path*, for editing — or only to read, with *read_only*."""
|
|
1590
1597
|
super().__init__(parent)
|
|
1591
1598
|
self.setWindowTitle(Path(path).name or "YAML")
|
|
1592
1599
|
self.setMinimumWidth(480)
|
|
@@ -1600,11 +1607,17 @@ class YamlDialog(QDialog):
|
|
|
1600
1607
|
self.editor.setMinimumHeight(360)
|
|
1601
1608
|
self.error = QLabel("")
|
|
1602
1609
|
self.error.setProperty("tone", "exited")
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1610
|
+
if read_only:
|
|
1611
|
+
# A started run's file: shown whole, changed by nothing.
|
|
1612
|
+
self.editor.setReadOnly(True)
|
|
1613
|
+
buttons = QDialogButtonBox(QDialogButtonBox.StandardButton.Close)
|
|
1614
|
+
buttons.rejected.connect(self.reject)
|
|
1615
|
+
else:
|
|
1616
|
+
buttons = QDialogButtonBox(
|
|
1617
|
+
QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel
|
|
1618
|
+
)
|
|
1619
|
+
buttons.accepted.connect(self._accept)
|
|
1620
|
+
buttons.rejected.connect(self.reject)
|
|
1608
1621
|
layout = _dialog_layout(self)
|
|
1609
1622
|
layout.addWidget(where)
|
|
1610
1623
|
layout.addWidget(self.editor, 1)
|
|
@@ -2144,9 +2157,12 @@ class ExperimentConfigDialog(QDialog):
|
|
|
2144
2157
|
settings_layout.addWidget(scroll, 1)
|
|
2145
2158
|
settings_layout.addLayout(file_row)
|
|
2146
2159
|
if self.frozen:
|
|
2160
|
+
# Read, not changed: the fields are locked one by one (see _build_form)
|
|
2161
|
+
# and the scroll area stays live. Disabling the whole area, as this did,
|
|
2162
|
+
# also stopped it scrolling, so what lay below the fold was out of reach.
|
|
2147
2163
|
self.config_choice.setEnabled(False)
|
|
2148
|
-
|
|
2149
|
-
self.yaml_button.
|
|
2164
|
+
self.yaml_button.setText("View YAML…")
|
|
2165
|
+
self.yaml_button.setToolTip("The run's configuration file itself, read-only")
|
|
2150
2166
|
|
|
2151
2167
|
self.tabs = QTabWidget()
|
|
2152
2168
|
self.tabs.addTab(settings_page, "Experiment Config")
|
|
@@ -2205,6 +2221,9 @@ class ExperimentConfigDialog(QDialog):
|
|
|
2205
2221
|
self.groups.addWidget(box)
|
|
2206
2222
|
self.groups.addStretch(1)
|
|
2207
2223
|
self._align()
|
|
2224
|
+
form_widget = self.groups.parentWidget()
|
|
2225
|
+
if self.frozen and form_widget is not None:
|
|
2226
|
+
_lock_fields(form_widget)
|
|
2208
2227
|
|
|
2209
2228
|
def _align(self) -> None:
|
|
2210
2229
|
"""One key column across every group of the form."""
|
|
@@ -2261,6 +2280,9 @@ class ExperimentConfigDialog(QDialog):
|
|
|
2261
2280
|
except ValueError as exc:
|
|
2262
2281
|
self.error.setText(str(exc))
|
|
2263
2282
|
return
|
|
2283
|
+
if self.frozen:
|
|
2284
|
+
YamlDialog(self, self.path, self.yaml, read_only=True).exec()
|
|
2285
|
+
return
|
|
2264
2286
|
editor = YamlDialog(self, self.path, text)
|
|
2265
2287
|
if editor.exec():
|
|
2266
2288
|
self.apply_yaml(editor.text())
|
|
@@ -2379,6 +2401,22 @@ def _unit_suffix(parameter: Any) -> str:
|
|
|
2379
2401
|
return f" ({parameter.unit})" if parameter.unit else ""
|
|
2380
2402
|
|
|
2381
2403
|
|
|
2404
|
+
def _lock_fields(parent: QWidget) -> None:
|
|
2405
|
+
"""Make every field under *parent* show its value and refuse a change.
|
|
2406
|
+
|
|
2407
|
+
Text and number fields go read-only, which keeps them selectable and
|
|
2408
|
+
readable; choices and buttons are disabled. The containers are left alone,
|
|
2409
|
+
so a form that scrolls keeps scrolling.
|
|
2410
|
+
"""
|
|
2411
|
+
from PySide6.QtWidgets import QAbstractButton, QAbstractSpinBox
|
|
2412
|
+
|
|
2413
|
+
for widget in parent.findChildren(QWidget):
|
|
2414
|
+
if isinstance(widget, (QLineEdit, QPlainTextEdit, QAbstractSpinBox)):
|
|
2415
|
+
widget.setReadOnly(True)
|
|
2416
|
+
elif isinstance(widget, (QComboBox, QAbstractButton)):
|
|
2417
|
+
widget.setEnabled(False)
|
|
2418
|
+
|
|
2419
|
+
|
|
2382
2420
|
def _clear(layout: QLayout) -> None:
|
|
2383
2421
|
"""Empty *layout*, so a form can be laid out again from new text."""
|
|
2384
2422
|
while layout.count():
|
|
@@ -2681,7 +2719,9 @@ def _editor_for(parameter: Any, value: Any) -> Any:
|
|
|
2681
2719
|
if parameter.dtype == "float":
|
|
2682
2720
|
real = QDoubleSpinBox()
|
|
2683
2721
|
_write_numbers_plainly(real)
|
|
2684
|
-
real.setDecimals(
|
|
2722
|
+
real.setDecimals(
|
|
2723
|
+
_decimals_for(value, parameter.default, parameter.minimum, parameter.maximum)
|
|
2724
|
+
)
|
|
2685
2725
|
real.setRange(float(low), float(high))
|
|
2686
2726
|
real.setValue(float(value) if value is not None else 0.0)
|
|
2687
2727
|
real.setSuffix(suffix)
|
|
@@ -2708,22 +2748,28 @@ def _write_numbers_plainly(editor: Any) -> None:
|
|
|
2708
2748
|
editor.setGroupSeparatorShown(False)
|
|
2709
2749
|
|
|
2710
2750
|
|
|
2711
|
-
def _decimals_for(value: Any, default: Any) -> int:
|
|
2751
|
+
def _decimals_for(value: Any, default: Any, *bounds: Any) -> int:
|
|
2712
2752
|
"""How many decimals a float parameter is worth showing.
|
|
2713
2753
|
|
|
2714
2754
|
A fixed four turned every angle into ``178.0000 deg``, which is precision
|
|
2715
2755
|
the experiment never claimed. What the module's own default is written to
|
|
2716
|
-
is the best evidence of what the quantity is measured in
|
|
2756
|
+
is the best evidence of what the quantity is measured in — and the declared
|
|
2757
|
+
bounds have to fit too: a spin box rounds its range to its decimals, so a
|
|
2758
|
+
minimum of 0.01 shown with one decimal became 0.0, and the form offered a
|
|
2759
|
+
step of 0° that pol-pl refuses.
|
|
2717
2760
|
|
|
2718
2761
|
Args:
|
|
2719
2762
|
value: The configured value.
|
|
2720
2763
|
default: What the module declares.
|
|
2764
|
+
bounds: The declared minimum and maximum, either ``None``.
|
|
2721
2765
|
|
|
2722
2766
|
Returns:
|
|
2723
2767
|
Between 1 and 6.
|
|
2724
2768
|
"""
|
|
2725
2769
|
shown = 1
|
|
2726
|
-
for candidate in (default, value):
|
|
2770
|
+
for candidate in (default, value, *bounds):
|
|
2771
|
+
if candidate is None:
|
|
2772
|
+
continue
|
|
2727
2773
|
try:
|
|
2728
2774
|
text = f"{float(candidate):.10f}".rstrip("0")
|
|
2729
2775
|
except (TypeError, ValueError):
|
|
@@ -2736,12 +2782,27 @@ def _value_of(parameter: Any, editor: Any) -> Any:
|
|
|
2736
2782
|
"""Read a parameter's value back out of its widget.
|
|
2737
2783
|
|
|
2738
2784
|
Raises:
|
|
2739
|
-
ValueError: When a document parameter holds text that is not YAML
|
|
2785
|
+
ValueError: When a document parameter holds text that is not YAML, or a
|
|
2786
|
+
number lies outside the bounds the module declares.
|
|
2740
2787
|
"""
|
|
2741
2788
|
from PySide6.QtWidgets import QCheckBox, QDoubleSpinBox, QLineEdit, QSpinBox
|
|
2742
2789
|
|
|
2743
2790
|
import yaml as _yaml
|
|
2744
2791
|
|
|
2792
|
+
if isinstance(editor, (QSpinBox, QDoubleSpinBox)):
|
|
2793
|
+
number: float = (
|
|
2794
|
+
int(editor.value()) if isinstance(editor, QSpinBox) else float(editor.value())
|
|
2795
|
+
)
|
|
2796
|
+
# The spin box's own range is the declared one, but rounded to what it
|
|
2797
|
+
# shows; the file must hold what the module accepts, so it is checked
|
|
2798
|
+
# against the declaration itself rather than trusted (pol-pl's 0.01°
|
|
2799
|
+
# minimum was saved as a step of 0.0).
|
|
2800
|
+
unit = f" {parameter.unit}" if parameter.unit else ""
|
|
2801
|
+
if parameter.minimum is not None and number < parameter.minimum:
|
|
2802
|
+
raise ValueError(f"{number:g}{unit} is below its minimum, {parameter.minimum:g}{unit}")
|
|
2803
|
+
if parameter.maximum is not None and number > parameter.maximum:
|
|
2804
|
+
raise ValueError(f"{number:g}{unit} is above its maximum, {parameter.maximum:g}{unit}")
|
|
2805
|
+
return number
|
|
2745
2806
|
if isinstance(editor, ListEditor):
|
|
2746
2807
|
return editor.value()
|
|
2747
2808
|
if parameter.is_document:
|
|
@@ -2756,10 +2817,6 @@ def _value_of(parameter: Any, editor: Any) -> Any:
|
|
|
2756
2817
|
return editor.currentData() if editor.currentData() is not None else editor.currentText()
|
|
2757
2818
|
if isinstance(editor, QCheckBox):
|
|
2758
2819
|
return editor.isChecked()
|
|
2759
|
-
if isinstance(editor, QSpinBox):
|
|
2760
|
-
return int(editor.value())
|
|
2761
|
-
if isinstance(editor, QDoubleSpinBox):
|
|
2762
|
-
return float(editor.value())
|
|
2763
2820
|
if isinstance(editor, QLineEdit):
|
|
2764
2821
|
return editor.text()
|
|
2765
2822
|
return None
|
|
@@ -3017,8 +3074,27 @@ class BenchesEditor(QWidget):
|
|
|
3017
3074
|
if rows and rows[0].row() >= self._first: # this bench is not removed from itself
|
|
3018
3075
|
self.table.removeRow(rows[0].row())
|
|
3019
3076
|
|
|
3077
|
+
def commit_edit(self) -> None:
|
|
3078
|
+
"""Take in a cell that is still being edited, as if Enter had been pressed.
|
|
3079
|
+
|
|
3080
|
+
Clicking Save does not end the edit on every platform — a button on
|
|
3081
|
+
macOS takes no focus, so the cell's editor never loses it — and the
|
|
3082
|
+
table then still holds the old text: Save wrote it, and the edit shown
|
|
3083
|
+
on screen was dropped (#17). Moving the current cell is what makes the
|
|
3084
|
+
view commit and close an open editor, so it is moved and put back.
|
|
3085
|
+
"""
|
|
3086
|
+
from PySide6.QtCore import QModelIndex
|
|
3087
|
+
from PySide6.QtWidgets import QAbstractItemView
|
|
3088
|
+
|
|
3089
|
+
if self.table.state() != QAbstractItemView.State.EditingState:
|
|
3090
|
+
return
|
|
3091
|
+
current = self.table.currentIndex()
|
|
3092
|
+
self.table.setCurrentIndex(QModelIndex())
|
|
3093
|
+
self.table.setCurrentIndex(current)
|
|
3094
|
+
|
|
3020
3095
|
def _rows(self) -> list[list[str]]:
|
|
3021
3096
|
"""What the list holds, cell by cell — without the fixed ``local`` row."""
|
|
3097
|
+
self.commit_edit()
|
|
3022
3098
|
rows = []
|
|
3023
3099
|
for row in range(self._first, self.table.rowCount()):
|
|
3024
3100
|
values = []
|
|
@@ -3036,6 +3112,7 @@ class BenchesEditor(QWidget):
|
|
|
3036
3112
|
"""Where the ``local`` machine sees the shared data disk, as its row now says."""
|
|
3037
3113
|
if not (self.local and self.shared):
|
|
3038
3114
|
return self._local_data
|
|
3115
|
+
self.commit_edit()
|
|
3039
3116
|
item = self.table.item(0, DATA_COLUMN)
|
|
3040
3117
|
return item.text().strip() if item is not None else ""
|
|
3041
3118
|
|
|
@@ -3551,3 +3628,18 @@ def _default_instance(package: str) -> str:
|
|
|
3551
3628
|
if stem.startswith(prefix):
|
|
3552
3629
|
stem = stem[len(prefix) :]
|
|
3553
3630
|
return stem.replace("_", "-")
|
|
3631
|
+
|
|
3632
|
+
|
|
3633
|
+
def _checkout_configs(path: str) -> list[str]:
|
|
3634
|
+
"""The ``config/*.yaml`` of the checkout at *path*, relative to it; none without one."""
|
|
3635
|
+
if not path:
|
|
3636
|
+
return []
|
|
3637
|
+
directory = Path(path) / "config"
|
|
3638
|
+
try:
|
|
3639
|
+
return sorted(
|
|
3640
|
+
f"config/{item.name}"
|
|
3641
|
+
for item in directory.iterdir()
|
|
3642
|
+
if item.is_file() and item.suffix in (".yaml", ".yml")
|
|
3643
|
+
)
|
|
3644
|
+
except OSError:
|
|
3645
|
+
return []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "plesty-server"
|
|
3
|
-
version = "0.4.
|
|
3
|
+
version = "0.4.2"
|
|
4
4
|
license = "LGPL-3.0-or-later"
|
|
5
5
|
license-files = ["LICENSE", "LICENSES/*"]
|
|
6
6
|
description = "The PLESTY bench application: installs, runs and field-tests device servers."
|
|
@@ -9,8 +9,8 @@ maintainers = [{ name = "Plesty Development Team", email = "plesty.dev@example.c
|
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.12"
|
|
11
11
|
dependencies = [
|
|
12
|
-
"plesty-bench==0.4.
|
|
13
|
-
"plesty-lib[report]>=0.5.0
|
|
12
|
+
"plesty-bench==0.4.2",
|
|
13
|
+
"plesty-lib[report]>=0.5.0",
|
|
14
14
|
"pyyaml>=6.0",
|
|
15
15
|
"pyzmq>=26",
|
|
16
16
|
"click>=8.1",
|
|
@@ -18,7 +18,7 @@ dependencies = [
|
|
|
18
18
|
|
|
19
19
|
[project.optional-dependencies]
|
|
20
20
|
gui = [
|
|
21
|
-
"plesty-lib[gui]>=0.5.0
|
|
21
|
+
"plesty-lib[gui]>=0.5.0",
|
|
22
22
|
"pyside6==6.11.2",
|
|
23
23
|
]
|
|
24
24
|
|
|
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
|
|
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
|