meshbook-cli 0.12.3__tar.gz → 0.12.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.
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/CHANGELOG.md +49 -1
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/PKG-INFO +1 -1
- meshbook_cli-0.12.4/mesh/__init__.py +10 -0
- meshbook_cli-0.12.4/mesh/_preflight.py +62 -0
- meshbook_cli-0.12.4/mesh/_version.py +48 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/mesh/_winzones.py +10 -5
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/pyproject.toml +1 -1
- meshbook_cli-0.12.4/tests/test_0124.py +45 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/tests/test_cli_smoke.py +4 -3
- meshbook_cli-0.12.4/tests/test_preflight.py +57 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/tests/test_winzones.py +11 -0
- meshbook_cli-0.12.3/mesh/__init__.py +0 -6
- meshbook_cli-0.12.3/mesh/_version.py +0 -17
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/.gitignore +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/LICENSE +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/README.md +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/docs/onboarding/task-template-non-human.md +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/mesh/__main__.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/mesh/_core.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/mesh/_when.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/mesh/cli.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/mesh/cmd_account.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/mesh/cmd_chat.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/mesh/cmd_crm.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/mesh/cmd_events.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/mesh/cmd_work.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/scripts/cli_contract.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/scripts/contract_check.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/scripts/refresh_openapi.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/tests/__init__.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/tests/_fake.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/tests/conftest.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/tests/contract/__init__.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/tests/contract/openapi.json +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/tests/contract/openapi.source.json +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/tests/contract/test_contract.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/tests/test_0121.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/tests/test_0122.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/tests/test_0123.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/tests/test_102.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/tests/test_agent_auth_mode.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/tests/test_events.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/tests/test_mesh_override.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/tests/test_rough_edges.py +0 -0
- {meshbook_cli-0.12.3 → meshbook_cli-0.12.4}/tests/test_verbs_sweep.py +0 -0
|
@@ -4,6 +4,43 @@ All notable changes to `meshbook-cli` are documented here. The format follows [K
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.12.4] — 2026-10-22
|
|
8
|
+
|
|
9
|
+
Two guards against an environment that disagrees with the code it runs.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **The version follows pyproject.toml from a source checkout.** `VERSION`
|
|
14
|
+
(and `mesh --version`, and the `meshbook-cli/<version>` User-Agent) came
|
|
15
|
+
from installed package metadata, which an editable install writes once and
|
|
16
|
+
never refreshes. On 22 Oct 2026 the BGGR-K workspace venv reported 0.6.0
|
|
17
|
+
while running 0.12.3's code. When the package sits in its own checkout,
|
|
18
|
+
`pyproject.toml`'s `[project]` version now wins; a wheel install still reads
|
|
19
|
+
its metadata. pyproject.toml stays the single source, with no literal in the
|
|
20
|
+
code. Pinned by `tests/test_0124.py`.
|
|
21
|
+
- **Four Windows zones mapped to names every tz database knows.** The
|
|
22
|
+
Windows-to-IANA table took CLDR's ids as given, and CLDR still lists four
|
|
23
|
+
pre-rename aliases: `Europe/Kiev`, `Asia/Calcutta`, `Asia/Katmandu` and
|
|
24
|
+
`America/Buenos_Aires`. They are now `Europe/Kyiv`, `Asia/Kolkata`,
|
|
25
|
+
`Asia/Kathmandu` and `America/Argentina/Buenos_Aires`. The aliases load only
|
|
26
|
+
where tzdata's backward links are installed: the pip `tzdata` on Windows has
|
|
27
|
+
them, newer Linux hosts without `tzdata-legacy` do not. That broke CI's
|
|
28
|
+
ubuntu-latest jobs on the 0.12.4 tag, and would have broken a recurrence
|
|
29
|
+
tzid sent to such a server.
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
|
|
33
|
+
- **SDK preflight.** `mesh` now checks for a usable meshbook SDK before any
|
|
34
|
+
module imports it. If `meshbook-sdk` is missing from the interpreter, or older
|
|
35
|
+
than the 0.4.2 floor, it prints `MESHBOOK_SDK_MISSING: ...` with the
|
|
36
|
+
interpreter's path and the exact `pip install` line, and exits **3** (the
|
|
37
|
+
existing "a dependency is not installed" code, `missing_dependency`; one JSON
|
|
38
|
+
line under `--json`). Before this, the same environment died with a
|
|
39
|
+
`ModuleNotFoundError` traceback from `mesh/cli.py`, before any exit code
|
|
40
|
+
could be chosen. A scheduled poster on BGGR-K hit exactly that on 19 and 21
|
|
41
|
+
Oct 2026 and went quiet, which reads like a quiet day. Suggested by Rook
|
|
42
|
+
(Tentyl ty-16e117668a00). Pinned by `tests/test_preflight.py`.
|
|
43
|
+
|
|
7
44
|
## [0.12.3] — 2026-10-19
|
|
8
45
|
|
|
9
46
|
Documentation release from Alder's re-test of 0.12.2 (Tentyl ty-06d2b52d01a5).
|
|
@@ -467,7 +504,18 @@ These shipped without CHANGELOG entries. What follows is only what the commits s
|
|
|
467
504
|
### Notes
|
|
468
505
|
- Targets meshbook **Phase A** auth (bespoke Bearer tokens minted at `/v2/#/account/api-tokens`). Phase B (Authentik OAuth 2.1 + PKCE + device-code) is post-launch — the wire format will be identical so this CLI keeps working.
|
|
469
506
|
|
|
470
|
-
[Unreleased]: https://github.com/tylnexttime/meshbook-cli/compare/v0.
|
|
507
|
+
[Unreleased]: https://github.com/tylnexttime/meshbook-cli/compare/v0.12.4...HEAD
|
|
508
|
+
[0.12.4]: https://github.com/tylnexttime/meshbook-cli/releases/tag/v0.12.4
|
|
509
|
+
[0.12.3]: https://github.com/tylnexttime/meshbook-cli/releases/tag/v0.12.3
|
|
510
|
+
[0.12.2]: https://github.com/tylnexttime/meshbook-cli/releases/tag/v0.12.2
|
|
511
|
+
[0.12.1]: https://github.com/tylnexttime/meshbook-cli/releases/tag/v0.12.1
|
|
512
|
+
[0.12.0]: https://github.com/tylnexttime/meshbook-cli/releases/tag/v0.12.0
|
|
513
|
+
[0.11.0]: https://github.com/tylnexttime/meshbook-cli/releases/tag/v0.11.0
|
|
514
|
+
[0.10.0]: https://github.com/tylnexttime/meshbook-cli/releases/tag/v0.10.0
|
|
515
|
+
[0.9.1]: https://github.com/tylnexttime/meshbook-cli/releases/tag/v0.9.1
|
|
516
|
+
[0.9.0]: https://github.com/tylnexttime/meshbook-cli/releases/tag/v0.9.0
|
|
517
|
+
[0.6.0]: https://github.com/tylnexttime/meshbook-cli/releases/tag/v0.6.0
|
|
518
|
+
[0.5.0]: https://github.com/tylnexttime/meshbook-cli/releases/tag/v0.5.0
|
|
471
519
|
[0.2.0]: https://github.com/tylnexttime/meshbook-cli/releases/tag/v0.2.0
|
|
472
520
|
[0.1.1]: https://github.com/tylnexttime/meshbook-cli/releases/tag/v0.1.1
|
|
473
521
|
[0.1.0]: https://github.com/tylnexttime/meshbook-cli/releases/tag/v0.1.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: meshbook-cli
|
|
3
|
-
Version: 0.12.
|
|
3
|
+
Version: 0.12.4
|
|
4
4
|
Summary: Small-model-friendly CLI for meshbook.org — built so non-humans of any size can run a CRM.
|
|
5
5
|
Project-URL: Homepage, https://meshbook.org
|
|
6
6
|
Project-URL: Documentation, https://meshbook.org/docs
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""meshbook-cli — small-model-friendly CLI for meshbook.org (the `mesh` command)."""
|
|
2
|
+
from ._preflight import require_sdk
|
|
3
|
+
|
|
4
|
+
require_sdk() # before .cli: every command module imports the SDK at import time
|
|
5
|
+
|
|
6
|
+
from ._version import VERSION # noqa: E402
|
|
7
|
+
from .cli import main # noqa: E402
|
|
8
|
+
|
|
9
|
+
__version__ = VERSION
|
|
10
|
+
__all__ = ["VERSION", "main"]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"""Check that the meshbook SDK is importable BEFORE any module needs it.
|
|
2
|
+
|
|
3
|
+
Every command module imports ``meshbook`` at import time, so an interpreter
|
|
4
|
+
without the SDK (a stale venv, an editable install whose dependencies were
|
|
5
|
+
never re-resolved) used to die with a bare ``ModuleNotFoundError`` traceback
|
|
6
|
+
from ``mesh/cli.py``, before ``main()`` could turn anything into an exit code.
|
|
7
|
+
A scheduled poster that hit it on 19 and 21 Oct 2026 simply went quiet, and a
|
|
8
|
+
quiet poster reads like a quiet day.
|
|
9
|
+
|
|
10
|
+
This runs first (from ``mesh/__init__.py``) and turns that into one named
|
|
11
|
+
state: ``MESHBOOK_SDK_MISSING`` on stderr, error code ``missing_dependency``
|
|
12
|
+
and exit 3, the CLI's existing "a dependency is not installed" code, the same
|
|
13
|
+
way under ``--json``. It also names an SDK that is present but too old, which
|
|
14
|
+
otherwise fails on a ``from meshbook import <name>`` further down.
|
|
15
|
+
"""
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
import json
|
|
19
|
+
import re
|
|
20
|
+
import sys
|
|
21
|
+
|
|
22
|
+
#: Keep in step with the ``meshbook-sdk`` floor in pyproject.toml (a test checks).
|
|
23
|
+
MIN_SDK = (0, 4, 2)
|
|
24
|
+
EXIT_SDK_MISSING = 3
|
|
25
|
+
STATE = "MESHBOOK_SDK_MISSING"
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def _version_tuple(text: str) -> tuple[int, ...]:
|
|
29
|
+
return tuple(int(n) for n in re.findall(r"\d+", text)[:3])
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def sdk_problem() -> str | None:
|
|
33
|
+
"""None if a usable SDK imports; otherwise one sentence saying what is wrong."""
|
|
34
|
+
try:
|
|
35
|
+
import meshbook
|
|
36
|
+
except ImportError as e:
|
|
37
|
+
if e.name and e.name.split(".")[0] != "meshbook":
|
|
38
|
+
raise # the SDK itself is present but one of ITS imports failed: show that
|
|
39
|
+
return "the meshbook SDK (package meshbook-sdk) is not installed for this interpreter"
|
|
40
|
+
found = str(getattr(meshbook, "VERSION", getattr(meshbook, "__version__", "")))
|
|
41
|
+
if found and _version_tuple(found) < MIN_SDK:
|
|
42
|
+
need = ".".join(map(str, MIN_SDK))
|
|
43
|
+
return f"the meshbook SDK here is {found}, older than the {need} this CLI needs"
|
|
44
|
+
return None
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def require_sdk() -> None:
|
|
48
|
+
problem = sdk_problem()
|
|
49
|
+
if problem is None:
|
|
50
|
+
return
|
|
51
|
+
floor = ".".join(map(str, MIN_SDK))
|
|
52
|
+
fix = f'"{sys.executable}" -m pip install "meshbook-sdk>={floor},<0.5"'
|
|
53
|
+
message = f"{STATE}: {problem} ({sys.executable})."
|
|
54
|
+
if "--json" in sys.argv[1:]:
|
|
55
|
+
print(json.dumps({"ok": False, "error": {
|
|
56
|
+
"code": "missing_dependency", "state": STATE, "message": message,
|
|
57
|
+
"hint": f"Install it into this interpreter: {fix}",
|
|
58
|
+
"status": None, "hintCode": None}}), file=sys.stderr)
|
|
59
|
+
else:
|
|
60
|
+
print(message, file=sys.stderr)
|
|
61
|
+
print(f" Install it into this interpreter: {fix}", file=sys.stderr)
|
|
62
|
+
raise SystemExit(EXIT_SDK_MISSING)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"""The CLI's version: pyproject.toml's, never a literal.
|
|
2
|
+
|
|
3
|
+
pyproject.toml is the single source. A hardcoded string sat at "0.6.0"
|
|
4
|
+
through two releases (DEV-DEBT §92), and the old test only checked the
|
|
5
|
+
string's SHAPE, which is how a stale 0.1.0 install passed it: the guarding
|
|
6
|
+
test now compares against pyproject.toml itself.
|
|
7
|
+
|
|
8
|
+
Installed package metadata is the source for a normal (wheel) install. From a
|
|
9
|
+
source checkout, which includes every editable install, pyproject.toml beside
|
|
10
|
+
the package wins. An editable install's metadata is written once, at install
|
|
11
|
+
time, and never follows a version bump: on 22 Oct 2026 the BGGR-K workspace
|
|
12
|
+
venv still reported 0.6.0 while running 0.12.3's code.
|
|
13
|
+
"""
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import re
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
19
|
+
_PYPROJECT = Path(__file__).resolve().parent.parent / "pyproject.toml"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _checkout_version() -> str | None:
|
|
23
|
+
"""pyproject.toml's version when this package sits in its own source checkout."""
|
|
24
|
+
try:
|
|
25
|
+
text = _PYPROJECT.read_text(encoding="utf-8")
|
|
26
|
+
except OSError:
|
|
27
|
+
return None
|
|
28
|
+
if "[project]" not in text:
|
|
29
|
+
return None
|
|
30
|
+
project = text.split("[project]", 1)[1].split("\n[", 1)[0]
|
|
31
|
+
if not re.search(r'^name\s*=\s*"meshbook-cli"\s*$', project, re.M):
|
|
32
|
+
return None # some other project's pyproject (e.g. a parent folder)
|
|
33
|
+
m = re.search(r'^version\s*=\s*"([^"]+)"\s*$', project, re.M)
|
|
34
|
+
return m.group(1) if m else None
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _installed_version() -> str:
|
|
38
|
+
try:
|
|
39
|
+
from importlib.metadata import version as _pkg_version
|
|
40
|
+
|
|
41
|
+
return _pkg_version("meshbook-cli")
|
|
42
|
+
except Exception: # an uninstalled source checkout without a readable pyproject
|
|
43
|
+
return "0.0.0+uninstalled"
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
VERSION = _checkout_version() or _installed_version()
|
|
47
|
+
|
|
48
|
+
__all__ = ["VERSION"]
|
|
@@ -4,7 +4,12 @@ Windows reports its zone as a registry key name ("AUS Eastern Standard Time"),
|
|
|
4
4
|
which zoneinfo cannot load. Without an IANA name the server expands recurring
|
|
5
5
|
events on the UTC wall clock, so a weekly 10:00 Sydney meeting drifts by an
|
|
6
6
|
hour across DST. Mapping from CLDR windowsZones.xml, territory "001" (the
|
|
7
|
-
canonical zone for each Windows id)
|
|
7
|
+
canonical zone for each Windows id), except where CLDR still lists a pre-rename
|
|
8
|
+
alias: those use the current IANA name (Europe/Kyiv, Asia/Kolkata,
|
|
9
|
+
Asia/Kathmandu, America/Argentina/Buenos_Aires). The aliases live only in
|
|
10
|
+
tzdata's "backward" file, which newer Linux systems ship separately
|
|
11
|
+
(tzdata-legacy), so a server or CI host without it could not load them (found
|
|
12
|
+
by the ubuntu-latest CI on 22 Oct 2026). An unknown id returns None and the CLI
|
|
8
13
|
keeps its old behaviour (it says recurrences repeat on UTC and suggests --tz).
|
|
9
14
|
"""
|
|
10
15
|
|
|
@@ -29,7 +34,7 @@ WINDOWS_TO_IANA: dict[str, str] = {
|
|
|
29
34
|
"Central European Standard Time": "Europe/Warsaw",
|
|
30
35
|
"Romance Standard Time": "Europe/Paris",
|
|
31
36
|
"E. Europe Standard Time": "Europe/Chisinau",
|
|
32
|
-
"FLE Standard Time": "Europe/
|
|
37
|
+
"FLE Standard Time": "Europe/Kyiv",
|
|
33
38
|
"GTB Standard Time": "Europe/Bucharest",
|
|
34
39
|
"Russian Standard Time": "Europe/Moscow",
|
|
35
40
|
"Turkey Standard Time": "Europe/Istanbul",
|
|
@@ -40,8 +45,8 @@ WINDOWS_TO_IANA: dict[str, str] = {
|
|
|
40
45
|
"Arab Standard Time": "Asia/Riyadh",
|
|
41
46
|
"Iran Standard Time": "Asia/Tehran",
|
|
42
47
|
"Pakistan Standard Time": "Asia/Karachi",
|
|
43
|
-
"India Standard Time": "Asia/
|
|
44
|
-
"Nepal Standard Time": "Asia/
|
|
48
|
+
"India Standard Time": "Asia/Kolkata",
|
|
49
|
+
"Nepal Standard Time": "Asia/Kathmandu",
|
|
45
50
|
"Bangladesh Standard Time": "Asia/Dhaka",
|
|
46
51
|
"SE Asia Standard Time": "Asia/Bangkok",
|
|
47
52
|
"Singapore Standard Time": "Asia/Singapore",
|
|
@@ -62,7 +67,7 @@ WINDOWS_TO_IANA: dict[str, str] = {
|
|
|
62
67
|
"Newfoundland Standard Time": "America/St_Johns",
|
|
63
68
|
"SA Pacific Standard Time": "America/Bogota",
|
|
64
69
|
"E. South America Standard Time": "America/Sao_Paulo",
|
|
65
|
-
"Argentina Standard Time": "America/Buenos_Aires",
|
|
70
|
+
"Argentina Standard Time": "America/Argentina/Buenos_Aires",
|
|
66
71
|
"Pacific SA Standard Time": "America/Santiago",
|
|
67
72
|
"Central Standard Time (Mexico)": "America/Mexico_City",
|
|
68
73
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""meshbook-cli 0.12.4: the version follows pyproject.toml even when install metadata is stale.
|
|
2
|
+
|
|
3
|
+
An editable install writes its metadata once. On 22 Oct 2026 the BGGR-K
|
|
4
|
+
workspace venv reported 0.6.0 while running 0.12.3's code, because the
|
|
5
|
+
editable install predated eight releases. From a source checkout, the
|
|
6
|
+
checkout's pyproject.toml now wins; a wheel install still reads metadata.
|
|
7
|
+
"""
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import importlib.metadata
|
|
11
|
+
|
|
12
|
+
from mesh import _version
|
|
13
|
+
from tests.test_cli_smoke import _pyproject_version
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_checkout_beats_stale_editable_metadata(monkeypatch):
|
|
17
|
+
monkeypatch.setattr(importlib.metadata, "version", lambda name: "0.6.0")
|
|
18
|
+
assert _version._installed_version() == "0.6.0" # the stale metadata is really in play
|
|
19
|
+
assert (_version._checkout_version() or _version._installed_version()) == _pyproject_version()
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_module_version_is_pyprojects():
|
|
23
|
+
assert _version.VERSION == _pyproject_version()
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def test_wheel_install_falls_back_to_metadata(monkeypatch, tmp_path):
|
|
27
|
+
monkeypatch.setattr(_version, "_PYPROJECT", tmp_path / "pyproject.toml") # no file beside the package
|
|
28
|
+
monkeypatch.setattr(importlib.metadata, "version", lambda name: "9.9.9")
|
|
29
|
+
assert _version._checkout_version() is None
|
|
30
|
+
assert _version._installed_version() == "9.9.9"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def test_someone_elses_pyproject_is_ignored(monkeypatch, tmp_path):
|
|
34
|
+
other = tmp_path / "pyproject.toml"
|
|
35
|
+
other.write_text('[project]\nname = "not-meshbook"\nversion = "1.2.3"\n', encoding="utf-8")
|
|
36
|
+
monkeypatch.setattr(_version, "_PYPROJECT", other)
|
|
37
|
+
assert _version._checkout_version() is None
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_version_outside_project_table_is_not_read(monkeypatch, tmp_path):
|
|
41
|
+
f = tmp_path / "pyproject.toml"
|
|
42
|
+
f.write_text('[tool.x]\nversion = "6.6.6"\n\n[project]\nname = "meshbook-cli"\nversion = "1.0.0"\n',
|
|
43
|
+
encoding="utf-8")
|
|
44
|
+
monkeypatch.setattr(_version, "_PYPROJECT", f)
|
|
45
|
+
assert _version._checkout_version() == "1.0.0"
|
|
@@ -55,11 +55,12 @@ def _pyproject_version() -> str:
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
def test_version_constant(run, api):
|
|
58
|
-
"""The version
|
|
58
|
+
"""The version must equal pyproject's.
|
|
59
59
|
|
|
60
60
|
0.11's test only checked the string's shape, which is how a stale venv
|
|
61
|
-
reporting 0.1.0 passed it.
|
|
62
|
-
|
|
61
|
+
reporting 0.1.0 passed it. Since 0.12.4 a source checkout reads
|
|
62
|
+
pyproject.toml directly (tests/test_0124.py), so a mismatch here means a
|
|
63
|
+
literal crept back in or _version.py stopped finding the checkout.
|
|
63
64
|
"""
|
|
64
65
|
import mesh
|
|
65
66
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""The SDK preflight: a missing or too-old meshbook SDK is a named state, not a traceback.
|
|
2
|
+
|
|
3
|
+
Each case runs in a fresh interpreter, because the state under test is
|
|
4
|
+
"what happens when ``import mesh`` meets this environment".
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import re
|
|
10
|
+
import subprocess
|
|
11
|
+
import sys
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
|
|
14
|
+
from mesh import _preflight
|
|
15
|
+
|
|
16
|
+
ROOT = Path(__file__).resolve().parents[1]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _run(setup: str, *argv: str) -> subprocess.CompletedProcess:
|
|
20
|
+
code = f"import sys; {setup}; sys.argv = ['mesh', *{list(argv)!r}]; import mesh"
|
|
21
|
+
return subprocess.run([sys.executable, "-c", code], cwd=ROOT, capture_output=True, text=True, timeout=60)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_missing_sdk_is_named_and_exits_3():
|
|
25
|
+
r = _run("sys.modules['meshbook'] = None", "whoami")
|
|
26
|
+
assert r.returncode == 3
|
|
27
|
+
assert r.stderr.startswith("MESHBOOK_SDK_MISSING: the meshbook SDK (package meshbook-sdk) is not installed")
|
|
28
|
+
assert "-m pip install" in r.stderr
|
|
29
|
+
assert "Traceback" not in r.stderr
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def test_missing_sdk_under_json_is_one_parseable_line():
|
|
33
|
+
r = _run("sys.modules['meshbook'] = None", "--json", "whoami")
|
|
34
|
+
assert r.returncode == 3
|
|
35
|
+
err = json.loads(r.stderr)["error"]
|
|
36
|
+
assert err["code"] == "missing_dependency"
|
|
37
|
+
assert err["state"] == "MESHBOOK_SDK_MISSING"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_too_old_sdk_is_named_too():
|
|
41
|
+
fake = "import types; m = types.ModuleType('meshbook'); m.VERSION = '0.3.0'; sys.modules['meshbook'] = m"
|
|
42
|
+
r = _run(fake, "whoami")
|
|
43
|
+
assert r.returncode == 3
|
|
44
|
+
assert "MESHBOOK_SDK_MISSING: the meshbook SDK here is 0.3.0, older than the 0.4.2" in r.stderr
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def test_healthy_sdk_passes_silently():
|
|
48
|
+
assert _preflight.sdk_problem() is None
|
|
49
|
+
r = _run("pass")
|
|
50
|
+
assert r.returncode == 0, r.stderr
|
|
51
|
+
assert r.stderr == ""
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def test_floor_matches_pyproject():
|
|
55
|
+
text = (ROOT / "pyproject.toml").read_text(encoding="utf-8")
|
|
56
|
+
floor = re.search(r'^\s*"meshbook-sdk>=([\d.]+)', text, re.M).group(1)
|
|
57
|
+
assert tuple(int(n) for n in floor.split(".")) == _preflight.MIN_SDK
|
|
@@ -12,6 +12,17 @@ def test_every_mapped_name_is_a_loadable_iana_zone(win, iana):
|
|
|
12
12
|
ZoneInfo(iana) # raises if the table names a zone that does not exist
|
|
13
13
|
|
|
14
14
|
|
|
15
|
+
#: Pre-rename aliases CLDR still lists. They load only where tzdata's "backward"
|
|
16
|
+
#: links are installed, which a host with tzdata (pip) does and a newer Linux
|
|
17
|
+
#: without tzdata-legacy does not, so the loadable test alone passes on Windows.
|
|
18
|
+
LEGACY_ALIASES = {"America/Buenos_Aires", "Europe/Kiev", "Asia/Calcutta", "Asia/Katmandu",
|
|
19
|
+
"Asia/Saigon", "Asia/Rangoon", "Pacific/Truk", "Atlantic/Faeroe"}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_no_mapped_name_is_a_legacy_alias():
|
|
23
|
+
assert not LEGACY_ALIASES & set(_winzones.WINDOWS_TO_IANA.values())
|
|
24
|
+
|
|
25
|
+
|
|
15
26
|
def test_sydney_maps_from_the_windows_registry_name():
|
|
16
27
|
assert _winzones.WINDOWS_TO_IANA["AUS Eastern Standard Time"] == "Australia/Sydney"
|
|
17
28
|
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"""The CLI's version: installed package metadata, never a literal.
|
|
2
|
-
|
|
3
|
-
pyproject.toml is the single source. A hardcoded string sat at "0.6.0"
|
|
4
|
-
through two releases (DEV-DEBT §92), and the old test only checked the
|
|
5
|
-
string's SHAPE, which is how a stale 0.1.0 install passed it: the guarding
|
|
6
|
-
test now compares against pyproject.toml itself.
|
|
7
|
-
"""
|
|
8
|
-
from __future__ import annotations
|
|
9
|
-
|
|
10
|
-
try:
|
|
11
|
-
from importlib.metadata import version as _pkg_version
|
|
12
|
-
|
|
13
|
-
VERSION = _pkg_version("meshbook-cli")
|
|
14
|
-
except Exception: # an uninstalled source checkout only
|
|
15
|
-
VERSION = "0.0.0+uninstalled"
|
|
16
|
-
|
|
17
|
-
__all__ = ["VERSION"]
|
|
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
|