@grifhinz/logics-manager 2.3.0 → 2.3.1

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.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![CI](https://github.com/AlexAgo83/logics-manager/actions/workflows/ci.yml/badge.svg)](https://github.com/AlexAgo83/logics-manager/actions/workflows/ci.yml)
4
4
  [![License](https://img.shields.io/github/license/AlexAgo83/logics-manager)](LICENSE)
5
- ![Version](https://img.shields.io/badge/version-v2.3.0-4C8BF5)
5
+ ![Version](https://img.shields.io/badge/version-v2.3.1-4C8BF5)
6
6
  ![VS Code](https://img.shields.io/badge/VS%20Code-1.86.0-007ACC?logo=visualstudiocode&logoColor=white)
7
7
  ![TypeScript](https://img.shields.io/badge/TypeScript-5.3.3-3178C6?logo=typescript&logoColor=white)
8
8
  ![Vitest](https://img.shields.io/badge/Vitest-2.1.8-6E9F18?logo=vitest&logoColor=white)
@@ -58,6 +58,15 @@ python3.11 -m pip install .
58
58
  logics-manager --help
59
59
  ```
60
60
 
61
+ On Debian, Ubuntu, or WSL environments where Python is externally managed, use `pipx` instead of installing into the system Python:
62
+
63
+ ```bash
64
+ sudo apt update
65
+ sudo apt install pipx python3-venv
66
+ pipx ensurepath
67
+ pipx install logics-manager
68
+ ```
69
+
61
70
  Or install the npm package:
62
71
 
63
72
  ```bash
@@ -197,6 +206,32 @@ To update the installed CLI later:
197
206
  logics-manager self-update
198
207
  ```
199
208
 
209
+ If `self-update` reports an externally managed Python environment, migrate the Python install through `pipx`:
210
+
211
+ ```bash
212
+ sudo apt update
213
+ sudo apt install pipx python3-venv
214
+ pipx ensurepath
215
+ pipx install --force logics-manager
216
+ ```
217
+
218
+ For npm installs, update with:
219
+
220
+ ```bash
221
+ npm install -g @grifhinz/logics-manager@latest
222
+ ```
223
+
224
+ If npm reports a successful update but `logics-manager --version` still shows an older version, another installation is earlier on `PATH`. Diagnose it with:
225
+
226
+ ```bash
227
+ command -v -a logics-manager
228
+ npm prefix -g
229
+ npm list -g @grifhinz/logics-manager --depth=0
230
+ "$(npm prefix -g)/bin/logics-manager" --version
231
+ ```
232
+
233
+ If the direct npm binary shows the expected version, remove the older Python install or move the npm global `bin` directory earlier on `PATH`.
234
+
200
235
  ## VS Code Extension
201
236
 
202
237
  The VS Code extension is the human cockpit around the same runtime. It helps you:
package/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.3.1
@@ -1,9 +1,11 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import argparse
4
+ import json
4
5
  from importlib import metadata
5
6
  import subprocess
6
7
  import sys
8
+ import sysconfig
7
9
  from shutil import which
8
10
  from pathlib import Path
9
11
 
@@ -133,6 +135,48 @@ def get_cli_version() -> str:
133
135
  return "0.0.0"
134
136
 
135
137
 
138
+ def _is_running_inside_venv() -> bool:
139
+ return sys.prefix != getattr(sys, "base_prefix", sys.prefix)
140
+
141
+
142
+ def _is_externally_managed_python() -> bool:
143
+ if _is_running_inside_venv():
144
+ return False
145
+ stdlib = sysconfig.get_path("stdlib")
146
+ return bool(stdlib and (Path(stdlib) / "EXTERNALLY-MANAGED").exists())
147
+
148
+
149
+ def _is_running_from_npm_package() -> bool:
150
+ package_json = Path(__file__).resolve().parents[1] / "package.json"
151
+ try:
152
+ payload = json.loads(package_json.read_text(encoding="utf-8"))
153
+ except (OSError, json.JSONDecodeError):
154
+ return False
155
+ return payload.get("name") == DEFAULT_SELF_UPDATE_PACKAGE
156
+
157
+
158
+ def _print_externally_managed_update_guidance(package_name: str) -> None:
159
+ print(
160
+ "\n".join(
161
+ [
162
+ "This Python installation is externally managed, so pip cannot safely update logics-manager in the system environment.",
163
+ "",
164
+ "Recommended fix:",
165
+ " sudo apt update",
166
+ " sudo apt install pipx python3-venv",
167
+ " pipx ensurepath",
168
+ f" pipx install --force {package_name}",
169
+ "",
170
+ "If you installed the npm package instead, run:",
171
+ f" npm install -g {DEFAULT_SELF_UPDATE_PACKAGE}@latest",
172
+ "",
173
+ "Advanced override, at your own risk:",
174
+ f" logics-manager self-update --manager pip --break-system-packages",
175
+ ]
176
+ )
177
+ )
178
+
179
+
136
180
  def _is_json_mode(argv: list[str]) -> bool:
137
181
  return "--json" in argv or any(argv[index] == "--format" and index + 1 < len(argv) and argv[index + 1] == "json" for index in range(len(argv)))
138
182
 
@@ -208,20 +252,29 @@ def main(argv: list[str] | None = None) -> int:
208
252
  parser.add_argument("--manager", choices=("auto", "pip", "npm"), default="auto")
209
253
  parser.add_argument("--package", default=DEFAULT_SELF_UPDATE_PACKAGE)
210
254
  parser.add_argument("--python-package", default=DEFAULT_SELF_UPDATE_PY_PACKAGE)
255
+ parser.add_argument("--break-system-packages", action="store_true")
211
256
  parser.add_argument("--dry-run", action="store_true")
212
257
  parsed = parser.parse_args(rest)
213
258
 
214
259
  manager = parsed.manager
215
260
  if manager == "auto":
216
- try:
217
- metadata.version(parsed.python_package)
218
- except metadata.PackageNotFoundError:
219
- manager = "npm" if which("npm") else "pip"
261
+ if _is_running_from_npm_package() and which("npm"):
262
+ manager = "npm"
220
263
  else:
221
- manager = "pip"
264
+ try:
265
+ metadata.version(parsed.python_package)
266
+ except metadata.PackageNotFoundError:
267
+ manager = "npm" if which("npm") else "pip"
268
+ else:
269
+ manager = "pip"
222
270
 
223
271
  if manager == "pip":
272
+ if _is_externally_managed_python() and not parsed.break_system_packages:
273
+ _print_externally_managed_update_guidance(parsed.python_package)
274
+ return 1
224
275
  command = [sys.executable, "-m", "pip", "install", "--upgrade", parsed.python_package]
276
+ if parsed.break_system_packages:
277
+ command.append("--break-system-packages")
225
278
  else:
226
279
  npm = which("npm")
227
280
  if not npm:
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@grifhinz/logics-manager",
3
3
  "displayName": "Logics Orchestrator",
4
4
  "description": "Visual orchestration for Logics workflows inside VS Code.",
5
- "version": "2.3.0",
5
+ "version": "2.3.1",
6
6
  "publisher": "cdx-logics",
7
7
  "icon": "clients/shared-web/media/icon.png",
8
8
  "repository": {
package/pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "logics-manager"
7
- version = "2.3.0"
7
+ version = "2.3.1"
8
8
  description = "Canonical Logics CLI"
9
9
  requires-python = ">=3.10"
10
10