plesty-server 0.3.2__tar.gz → 0.3.4__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.
Files changed (48) hide show
  1. {plesty_server-0.3.2 → plesty_server-0.3.4}/PKG-INFO +2 -2
  2. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/services/installer.py +73 -4
  3. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/view/window.py +15 -2
  4. {plesty_server-0.3.2 → plesty_server-0.3.4}/pyproject.toml +2 -2
  5. {plesty_server-0.3.2 → plesty_server-0.3.4}/LICENSE +0 -0
  6. {plesty_server-0.3.2 → plesty_server-0.3.4}/LICENSES/LGPL-3.0-or-later.txt +0 -0
  7. {plesty_server-0.3.2 → plesty_server-0.3.4}/README.md +0 -0
  8. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/__init__.py +0 -0
  9. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/__main__.py +0 -0
  10. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/assets/console.qss +0 -0
  11. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/assets/env.example +0 -0
  12. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/assets/fleet.example.yaml +0 -0
  13. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/assets/plesty-mark.svg +0 -0
  14. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/cli/__init__.py +0 -0
  15. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/cli/main.py +0 -0
  16. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/config.yaml +0 -0
  17. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/host.py +0 -0
  18. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/model/__init__.py +0 -0
  19. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/model/agent.py +0 -0
  20. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/model/catalogue.py +0 -0
  21. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/model/device.py +0 -0
  22. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/model/device_manager.py +0 -0
  23. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/model/envfile.py +0 -0
  24. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/model/errors.py +0 -0
  25. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/model/field_test.py +0 -0
  26. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/model/fleet.py +0 -0
  27. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/model/home.py +0 -0
  28. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/model/job.py +0 -0
  29. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/model/ports.py +0 -0
  30. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/model/process.py +0 -0
  31. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/model/purge.py +0 -0
  32. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/model/traffic.py +0 -0
  33. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/presenter/__init__.py +0 -0
  34. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/presenter/bench.py +0 -0
  35. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/reexec.py +0 -0
  36. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/services/__init__.py +0 -0
  37. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/services/agent.py +0 -0
  38. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/services/catalogue.py +0 -0
  39. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/services/control.py +0 -0
  40. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/services/gitbin.py +0 -0
  41. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/services/jobs.py +0 -0
  42. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/services/launch.py +0 -0
  43. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/services/supervisor.py +0 -0
  44. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/view/__init__.py +0 -0
  45. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/view/app.py +0 -0
  46. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/view/control.py +0 -0
  47. {plesty_server-0.3.2 → plesty_server-0.3.4}/plesty/server/view/dialogs.py +0 -0
  48. {plesty_server-0.3.2 → plesty_server-0.3.4}/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.3.2
3
+ Version: 0.3.4
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,7 +11,7 @@ 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.3.2
14
+ Requires-Dist: plesty-bench==0.3.4
15
15
  Requires-Dist: plesty-lib>=0.4.0
16
16
  Requires-Dist: pyyaml>=6.0
17
17
  Requires-Dist: pyzmq>=26
@@ -68,6 +68,9 @@ CHECKOUT_VENV = ".venv"
68
68
  #: :data:`SCANNER_HINT`). What it costs is stated in :meth:`_sync_checkout`.
69
69
  SYNC_ARGS = ["sync", "--no-dev"]
70
70
 
71
+ #: The folder of a checkout a field test writes its reports into, and an update may clear.
72
+ REPORTS_DIR = "reports"
73
+
71
74
  #: Minimum interpreter every PLESTY module requires (``requires-python``).
72
75
  PYTHON_SPEC = ">=3.12"
73
76
 
@@ -461,10 +464,11 @@ class Installer:
461
464
  ["-C", str(checkout), "rev-parse", "--abbrev-ref", "HEAD"], "read branch", quiet=True
462
465
  ).stdout.strip()
463
466
  if branch and branch != "HEAD":
467
+ self._clear_bench_reports(checkout)
464
468
  self._git_call(
465
469
  ["-C", str(checkout), "pull", "--quiet", "--ff-only"], f"fast-forward {branch}"
466
470
  )
467
- self._sync_checkout(checkout)
471
+ self._sync_checkout(checkout, spec.package)
468
472
  python = venv_python(checkout / CHECKOUT_VENV)
469
473
  commit = self._git_call(
470
474
  ["-C", str(checkout), "rev-parse", "--short", "HEAD"], "read commit", quiet=True
@@ -516,9 +520,73 @@ class Installer:
516
520
  time.sleep(wait)
517
521
  return self._call([self.uv, *args], what, quiet=quiet)
518
522
 
519
- def _sync_checkout(self, checkout: Path) -> None:
523
+ def _clear_bench_reports(self, checkout: Path) -> None:
524
+ """Move the bench's own ``reports/`` files out of the way of the commits a pull brings.
525
+
526
+ A field test writes its report into the checkout, and the procedure
527
+ then commits that same file to the module. The next pull refused to
528
+ overwrite the bench's copy — untracked, or changed by a later run — so
529
+ the device kept its old code until someone deleted the file by hand on
530
+ the bench PC (#37). A copy identical to the incoming one is dropped;
531
+ any other is kept beside it as ``<name>.bench-<time><suffix>``, said
532
+ in the log, so no result of a run is lost.
533
+
534
+ Only ``reports/`` is touched — the folder the bench writes. Anything
535
+ else in the way is the developer's and still stops the pull.
536
+ """
537
+ where = ["-C", str(checkout)]
538
+ try:
539
+ incoming = self._git_call(
540
+ [*where, "diff", "--name-only", "HEAD", "@{u}", "--", REPORTS_DIR],
541
+ "list the incoming reports",
542
+ quiet=True,
543
+ ).stdout.split()
544
+ except InstallError:
545
+ return # no upstream: the pull says why
546
+ if not incoming:
547
+ return
548
+ untracked = self._git_call(
549
+ [*where, "ls-files", "--others", "--exclude-standard", "--", REPORTS_DIR],
550
+ "list the bench's reports",
551
+ quiet=True,
552
+ ).stdout.split()
553
+ changed = self._git_call(
554
+ [*where, "diff", "--name-only", "--", REPORTS_DIR],
555
+ "list the bench's reports",
556
+ quiet=True,
557
+ ).stdout.split()
558
+ stamp = time.strftime("%Y%m%d-%H%M%S")
559
+ for name in sorted(set(incoming) & (set(untracked) | set(changed))):
560
+ local = checkout / name
561
+ ours = self._git_call(
562
+ [*where, "hash-object", "--", name], "read a report", quiet=True
563
+ ).stdout.strip()
564
+ try:
565
+ theirs = self._git_call(
566
+ [*where, "rev-parse", f"@{{u}}:{name}"], "read a report", quiet=True
567
+ ).stdout.strip()
568
+ except InstallError:
569
+ theirs = "" # deleted upstream
570
+ if ours != theirs:
571
+ kept = local.with_name(f"{local.stem}.bench-{stamp}{local.suffix}")
572
+ shutil.copy2(local, kept)
573
+ self._echo(
574
+ f"{name}: the update brings its own — the bench's copy is kept as {kept.name}"
575
+ )
576
+ if name in untracked:
577
+ local.unlink()
578
+ else:
579
+ self._git_call([*where, "checkout", "--", name], f"restore {name}", quiet=True)
580
+
581
+ def _sync_checkout(self, checkout: Path, package: str) -> None:
520
582
  """``uv sync --no-dev`` *checkout*, rebuilding its ``.venv`` if that stops it.
521
583
 
584
+ The module itself is rebuilt every time (``--reinstall-package``). It
585
+ is installed editable, so its code follows the pull anyway, but uv
586
+ keeps the version metadata of the first build: after an update the
587
+ bench, ``list`` and a field-test report all named the commit it was
588
+ first installed from (#36).
589
+
522
590
  The environment holds what the device needs to run and nothing else.
523
591
  ``tests/field_test.py`` is unaffected — it imports ``plesty.lib`` and
524
592
  the module, never pytest. What no longer works in a fresh checkout is
@@ -540,14 +608,15 @@ class Installer:
540
608
  lock. Only this failure is retried — any other sync error is the
541
609
  module's own and is raised unchanged.
542
610
  """
611
+ args = SYNC_ARGS + ["--reinstall-package", package, "--directory", str(checkout)]
543
612
  try:
544
- self._uv_resolve(SYNC_ARGS + ["--directory", str(checkout)], "sync the checkout")
613
+ self._uv_resolve(args, "sync the checkout")
545
614
  except InstallError as exc:
546
615
  if BROKEN_VENV_HINT not in str(exc).lower():
547
616
  raise
548
617
  self._echo("sync the checkout: its venv holds no interpreter — rebuilding it")
549
618
  remove_tree(checkout / CHECKOUT_VENV)
550
- self._uv_resolve(SYNC_ARGS + ["--directory", str(checkout)], "sync the checkout")
619
+ self._uv_resolve(args, "sync the checkout")
551
620
 
552
621
  def _uv_resolve(self, args: list[str], what: str) -> subprocess.CompletedProcess[str]:
553
622
  """Run a resolving ``uv`` command, retrying once with pre-releases allowed.
@@ -367,8 +367,21 @@ class MainWindow(QMainWindow):
367
367
  self.worker.run(lambda: self.bench.devices(probe=True), on_done=self._show_devices)
368
368
 
369
369
  def _show_devices(self, views: list[DeviceView]) -> None:
370
- keep = self._pending_select or self.selected
371
- self._pending_select = None
370
+ # A pending selection is spent only on a repaint that can honour it.
371
+ # The refresh timer fires every REFRESH_MS and the pool runs four
372
+ # tasks at once, so a refresh started before a rename can land after
373
+ # it, carrying devices read under the old name. That repaint used to
374
+ # take the pending name, find no row for it, select nothing, and
375
+ # clear it -- and the repaint that did carry the new row then fell
376
+ # back to self.selected, which is still the old name. The rename
377
+ # worked and the highlight jumped back to a device that no longer
378
+ # existed. Held instead until the row is there.
379
+ pending = self._pending_select
380
+ if pending is not None and any(view.name == pending for view in views):
381
+ self._pending_select = None
382
+ keep: str | None = pending
383
+ else:
384
+ keep = self.selected
372
385
  self._views = views
373
386
  self._painting = True
374
387
  self.table.setRowCount(len(views))
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "plesty-server"
3
- version = "0.3.2"
3
+ version = "0.3.4"
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,7 +9,7 @@ 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.3.2",
12
+ "plesty-bench==0.3.4",
13
13
  "plesty-lib>=0.4.0",
14
14
  "pyyaml>=6.0",
15
15
  "pyzmq>=26",
File without changes
File without changes