kento-core 1.6.3.dev0__tar.gz → 1.7.0.dev0__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 (103) hide show
  1. {kento_core-1.6.3.dev0/src/kento_core.egg-info → kento_core-1.7.0.dev0}/PKG-INFO +3 -1
  2. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/README.md +12 -0
  3. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/pyproject.toml +7 -1
  4. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/__init__.py +38 -18
  5. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/_images.py +494 -179
  6. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/_instances.py +610 -290
  7. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/_references.py +407 -22
  8. kento_core-1.7.0.dev0/src/kento/_result.py +499 -0
  9. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/create.py +189 -25
  10. kento_core-1.7.0.dev0/src/kento/extract.py +192 -0
  11. kento_core-1.7.0.dev0/src/kento/fetch.py +378 -0
  12. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/pve.py +17 -2
  13. kento_core-1.7.0.dev0/src/kento/urlvm.py +96 -0
  14. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/vm.py +40 -5
  15. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/vm_hook.py +17 -5
  16. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0/src/kento_core.egg-info}/PKG-INFO +3 -1
  17. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento_core.egg-info/SOURCES.txt +9 -0
  18. kento_core-1.7.0.dev0/src/kento_core.egg-info/requires.txt +3 -0
  19. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_create.py +332 -1
  20. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_diagnose_module.py +41 -9
  21. kento_core-1.7.0.dev0/tests/test_extract.py +404 -0
  22. kento_core-1.7.0.dev0/tests/test_fetch.py +761 -0
  23. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_hold.py +40 -14
  24. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_image_ops.py +119 -80
  25. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_image_record.py +46 -31
  26. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_images_types.py +39 -17
  27. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_init.py +17 -17
  28. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_instances.py +629 -154
  29. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_pve.py +46 -0
  30. kento_core-1.7.0.dev0/tests/test_references.py +1174 -0
  31. kento_core-1.7.0.dev0/tests/test_result.py +590 -0
  32. kento_core-1.7.0.dev0/tests/test_urlvm.py +328 -0
  33. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_vm.py +158 -0
  34. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_vm_hook.py +23 -0
  35. kento_core-1.6.3.dev0/tests/test_references.py +0 -606
  36. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/LICENSE.md +0 -0
  37. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/setup.cfg +0 -0
  38. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/_diagnosis.py +0 -0
  39. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/_network.py +0 -0
  40. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/_platform.py +0 -0
  41. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/_storage.py +0 -0
  42. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/attach.py +0 -0
  43. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/cloudinit.py +0 -0
  44. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/defaults.py +0 -0
  45. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/destroy.py +0 -0
  46. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/diagnose.py +0 -0
  47. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/errors.py +0 -0
  48. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/exec_cmd.py +0 -0
  49. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/hook.py +0 -0
  50. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/hook.sh +0 -0
  51. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/images.py +0 -0
  52. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/info.py +0 -0
  53. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/inject.py +0 -0
  54. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/inject.sh +0 -0
  55. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/layers.py +0 -0
  56. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/list.py +0 -0
  57. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/locking.py +0 -0
  58. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/logs.py +0 -0
  59. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/lxc_hook.py +0 -0
  60. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/portfwd.py +0 -0
  61. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/reconcile.py +0 -0
  62. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/reset.py +0 -0
  63. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/set_cmd.py +0 -0
  64. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/start.py +0 -0
  65. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/stop.py +0 -0
  66. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/subprocess_util.py +0 -0
  67. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento/suspend.py +0 -0
  68. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento_core.egg-info/dependency_links.txt +0 -0
  69. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/src/kento_core.egg-info/top_level.txt +0 -0
  70. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_adopt.py +0 -0
  71. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_attach.py +0 -0
  72. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_cloudinit.py +0 -0
  73. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_create_locking.py +0 -0
  74. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_create_passthrough.py +0 -0
  75. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_defaults.py +0 -0
  76. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_destroy.py +0 -0
  77. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_diagnose.py +0 -0
  78. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_diagnosis.py +0 -0
  79. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_errors.py +0 -0
  80. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_exec.py +0 -0
  81. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_hook.py +0 -0
  82. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_image_hold.py +0 -0
  83. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_images.py +0 -0
  84. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_info.py +0 -0
  85. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_inject.py +0 -0
  86. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_layers.py +0 -0
  87. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_list.py +0 -0
  88. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_locking.py +0 -0
  89. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_logs.py +0 -0
  90. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_lxc_hook.py +0 -0
  91. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_network.py +0 -0
  92. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_platform.py +0 -0
  93. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_portfwd.py +0 -0
  94. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_reconcile.py +0 -0
  95. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_reset.py +0 -0
  96. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_run_or_die_integration.py +0 -0
  97. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_set.py +0 -0
  98. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_start.py +0 -0
  99. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_stop.py +0 -0
  100. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_storage.py +0 -0
  101. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_subprocess_util.py +0 -0
  102. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_suspend.py +0 -0
  103. {kento_core-1.6.3.dev0 → kento_core-1.7.0.dev0}/tests/test_validate_name.py +0 -0
@@ -1,8 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kento-core
3
- Version: 1.6.3.dev0
3
+ Version: 1.7.0.dev0
4
4
  Summary: Kento core library — compose OCI images into LXC/VM system containers (importable engine)
5
5
  License-Expression: GPL-3.0-only
6
6
  Requires-Python: >=3.11
7
7
  License-File: LICENSE.md
8
+ Provides-Extra: docs
9
+ Requires-Dist: pdoc>=14; extra == "docs"
8
10
  Dynamic: license-file
@@ -396,8 +396,20 @@ and its writable layer. Errors if the instance is running unless
396
396
  └── rootfs/ # Overlayfs mount point
397
397
  ```
398
398
 
399
+ ## Environment overrides
400
+
401
+ - `KENTO_STATE_DIR` — base directory for the writable overlay layer (sidesteps
402
+ overlay-on-overlay when the default location sits on an overlayfs).
403
+ - `KENTO_URL_MAX_BYTES` — size cap for a URL fetch (VM URL-source rootfs /
404
+ kernel / initramfs). Default **2 GiB**; a fetch exceeding the cap fails.
405
+ - `KENTO_APPARMOR_PROFILE` — override the emitted plain-LXC AppArmor profile
406
+ (default `generated`).
407
+
399
408
  ## Documentation
400
409
 
410
+ - [Library Guide](docs/library-guide.md) — using `kento-core` as an importable
411
+ Python library (`import kento`): the typed object model, `Result` handling,
412
+ and URL-VM from code. Start here if you are a library consumer.
401
413
  - [Getting Started](docs/getting-started.md) — install, first instance walkthrough
402
414
  - [Modes](docs/modes.md) — lxc vs pve-lxc vs vm vs pve-vm, auto-detection, defaults
403
415
  - [VM Mode](docs/vm-mode.md) — image requirements, SSH access, port forwarding
@@ -4,13 +4,19 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "kento-core"
7
- version = "1.6.3.dev0"
7
+ version = "1.7.0.dev0"
8
8
  description = "Kento core library — compose OCI images into LXC/VM system containers (importable engine)"
9
9
  requires-python = ">=3.11"
10
10
  license = "GPL-3.0-only"
11
11
 
12
12
  # NO [project.scripts] — the console entry point lives in kento-cli (separate repo).
13
13
 
14
+ # Optional dependency groups. `docs` supplies the API-reference generator
15
+ # (pdoc renders the public docstrings to HTML). Install + generate with:
16
+ # pip install -e '.[docs]' then make docs
17
+ [project.optional-dependencies]
18
+ docs = ["pdoc>=14"]
19
+
14
20
  [tool.setuptools.packages.find]
15
21
  where = ["src"]
16
22
 
@@ -21,6 +21,7 @@ from kento.errors import ( # noqa: F401 (public re-export)
21
21
  )
22
22
  from kento._references import ( # noqa: F401 (public re-export)
23
23
  MalformedReference, Endpoint, Digest, SourceReference, OciReference,
24
+ UrlReference,
24
25
  )
25
26
  from kento._network import ( # noqa: F401 (public re-export)
26
27
  NetworkMode, ForwardProtocol, NetworkConnection,
@@ -38,11 +39,15 @@ from kento._storage import ( # noqa: F401 (public re-export)
38
39
  )
39
40
  from kento._images import ( # noqa: F401 (public re-export)
40
41
  DiskFormat, Layer, Hold, ManagedStatus, ImageRecord, Image, LayeredImage,
41
- OciImage, VolumeImage, CompositeImage,
42
+ OciImage, LocalDirectoryImage, VolumeImage, CompositeImage,
42
43
  )
43
44
  from kento._instances import ( # noqa: F401 (public re-export)
44
45
  Instance, SystemContainer, VirtualMachine,
45
46
  )
47
+ from kento._result import ( # noqa: F401 (public re-export)
48
+ Result, Ok, Warning, Error, Condition, Severity, ConditionKind,
49
+ ResultError,
50
+ )
46
51
 
47
52
  # Curated public surface. The source-reference value types are re-exported
48
53
  # flat (canonical paths kento.OciReference etc.); the `_references` module is
@@ -55,7 +60,7 @@ __all__ = [
55
60
  "StopTimeout", "SubprocessError",
56
61
  # source-reference value types (Block 01 — kento._references)
57
62
  "MalformedReference", "Endpoint", "Digest", "SourceReference",
58
- "OciReference",
63
+ "OciReference", "UrlReference",
59
64
  # network value types (Block 02 — kento._network)
60
65
  "NetworkMode", "ForwardProtocol", "NetworkConnection",
61
66
  "HostBinding", "GuestTarget", "ForwardAddressNotImplemented",
@@ -68,16 +73,19 @@ __all__ = [
68
73
  # root-storage value type (Block 03 — kento._storage)
69
74
  "StorageMode",
70
75
  # image family value types (Block 05 / SD1 — kento._images)
71
- "DiskFormat", "Layer", "Image", "LayeredImage", "OciImage", "VolumeImage",
72
- "CompositeImage",
76
+ "DiskFormat", "Layer", "Image", "LayeredImage", "OciImage",
77
+ "LocalDirectoryImage", "VolumeImage", "CompositeImage",
73
78
  # hold pin value type (storage-depth SD2 — kento._images)
74
79
  "Hold",
75
80
  # typed managed-image ledger (storage-depth SD3, JC1 — kento._images)
76
81
  "ManagedStatus", "ImageRecord",
77
82
  # instance family handles (Block 08 — kento._instances)
78
83
  "Instance", "SystemContainer", "VirtualMachine",
84
+ # Result value family (Block R1 — kento._result)
85
+ "Result", "Ok", "Warning", "Error", "Condition", "Severity",
86
+ "ConditionKind", "ResultError",
79
87
  # module-level helpers (defined in this module)
80
- "validate_name", "detect_bridge", "resolve_network", "read_mode",
88
+ "validate_name", "detect_bridge", "read_mode",
81
89
  "require_root", "detect_mode", "upper_base", "sanitize_image_name",
82
90
  "next_instance_name", "pve_config_exists", "is_running",
83
91
  "resolve_container", "resolve_in_namespace", "resolve_any",
@@ -143,8 +151,8 @@ def detect_bridge() -> str | None:
143
151
  return None
144
152
 
145
153
 
146
- def resolve_network(net_type: str | None, bridge_name: str | None,
147
- mode: str, port: str | None = None) -> dict:
154
+ def _resolve_network(net_type: str | None, bridge_name: str | None,
155
+ mode: str, port: str | None = None) -> dict:
148
156
  """Resolve network configuration for container/VM creation.
149
157
 
150
158
  Returns dict with keys: type, bridge, port
@@ -564,7 +572,7 @@ def check_name_conflict(name: str, target_namespace: str) -> bool:
564
572
  from kento import diagnose as _diagnose_submodule # noqa: E402,F401 (cache it FIRST)
565
573
 
566
574
 
567
- def diagnose(name: str | None = None) -> "Diagnosis": # noqa: F821 (Diagnosis re-exported above)
575
+ def diagnose(name: str | None = None) -> Result["Diagnosis"]: # noqa: F821 (Diagnosis re-exported above)
568
576
  """Run the host-wide (or named) diagnostic scan (§11.8 D3 b).
569
577
 
570
578
  Runs the existing ``kento.diagnose.run_diagnostics(name)`` and projects ALL
@@ -576,14 +584,13 @@ def diagnose(name: str | None = None) -> "Diagnosis": # noqa: F821 (Diagnosis
576
584
  INSTANCE / IMAGE / HOST), read-only / silent (it REPORTS, never reaps).
577
585
  This is what ``kento diagnose`` (no instance argument) maps to.
578
586
  * ``name=<str>`` — the same scan narrowed by ``run_diagnostics`` to the HOST
579
- checks plus the ONE resolved instance's checks (raising
580
- :class:`InstanceNotFoundError` on a miss, propagated unchanged). The
581
- findings are projected UNFILTERED, preserving today's named-``diagnose``
582
- wire (host findings + that instance's findings). This is DELIBERATELY
583
- different from ``instance.diagnose()`` (M11), which filters to the
584
- INSTANCE domain + itself and drops the host findings; the module-level
585
- function is the legacy named-wire preserver, the handle method is the
586
- narrowed per-instance view.
587
+ checks plus the ONE resolved instance's checks. The findings are projected
588
+ UNFILTERED, preserving today's named-``diagnose`` wire (host findings +
589
+ that instance's findings). This is DELIBERATELY different from
590
+ ``instance.diagnose()`` (M11), which filters to the INSTANCE domain +
591
+ itself and drops the host findings; the module-level function is the
592
+ legacy named-wire preserver, the handle method is the narrowed
593
+ per-instance view.
587
594
 
588
595
  The module-level companion to ``instance.diagnose()`` (one instance's
589
596
  INSTANCE findings) and ``image.diagnose()`` (the IMAGE domain); it mirrors
@@ -591,11 +598,24 @@ def diagnose(name: str | None = None) -> "Diagnosis": # noqa: F821 (Diagnosis
591
598
 
592
599
  Performs I/O (the scan) via an explicit module-level call (§2 principle 2);
593
600
  the returned ``Diagnosis`` is an inert value type.
601
+
602
+ Public Result boundary (Result-propagation sweep, Block S6): the normal scan
603
+ returns ``Ok(Diagnosis)``. The DEGRADED findings are part of a SUCCESSFUL
604
+ scan — a no-root / unreadable check degrades to an ``info``/``error`` FINDING
605
+ *inside* the report, never an ``Error`` of the Result (the scan still
606
+ succeeded in producing a report). The ONE predictable failure is a named
607
+ scoped miss: ``run_diagnostics(name)`` raises ``InstanceNotFoundError`` for
608
+ an unknown ``name``, caught here -> ``Error(INSTANCE_NOT_FOUND)``. A
609
+ non-``KentoError`` is a panic and propagates.
594
610
  """
595
611
  from kento._diagnosis import diagnosis_from_report
612
+ from kento._result import _error_from
596
613
 
597
- report = _diagnose_submodule.run_diagnostics(name)
598
- return diagnosis_from_report(report)
614
+ try:
615
+ report = _diagnose_submodule.run_diagnostics(name)
616
+ return Ok(value=diagnosis_from_report(report))
617
+ except KentoError as exc:
618
+ return _error_from(exc)
599
619
 
600
620
 
601
621
  def version() -> str: