cox-protocol-package 1.0.0 → 1.0.2

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
@@ -151,7 +151,8 @@ Check the NPM package contents before publishing:
151
151
  ```bash
152
152
  npm pack --dry-run
153
153
  npm pack
154
- npm install -g ./cox-protocol-package-1.0.0.tgz
154
+ npm install -g ./cox-protocol-package-<version>.tgz
155
+ python3 -m pip install PyYAML jsonschema typer rich
155
156
  cox-protocol validate .
156
157
  ```
157
158
 
@@ -14,6 +14,40 @@ const pythonEnv = {
14
14
  PYTHONPATH: pythonPath,
15
15
  };
16
16
 
17
+ const versionCheck = spawnSync(
18
+ python,
19
+ [
20
+ "-c",
21
+ "import sys; print('.'.join(map(str, sys.version_info[:3]))); raise SystemExit(0 if sys.version_info >= (3, 9) else 1)",
22
+ ],
23
+ {
24
+ cwd: process.cwd(),
25
+ env: pythonEnv,
26
+ stdio: "pipe",
27
+ },
28
+ );
29
+
30
+ if (versionCheck.error) {
31
+ console.error(
32
+ `Unable to run the configured Python interpreter ${python}: ${versionCheck.error.message}`,
33
+ );
34
+ console.error(
35
+ "Install Python 3.9 or newer, or set COX_PYTHON to a working interpreter.",
36
+ );
37
+ process.exit(1);
38
+ }
39
+
40
+ if (versionCheck.status !== 0) {
41
+ const detectedVersion = versionCheck.stdout.toString().trim() || "unknown";
42
+ console.error(
43
+ `COX requires Python 3.9 or newer, but ${python} resolved to ${detectedVersion}.`,
44
+ );
45
+ console.error(
46
+ "Install Python 3.9+ or point COX_PYTHON at a supported interpreter.",
47
+ );
48
+ process.exit(versionCheck.status ?? 1);
49
+ }
50
+
17
51
  const dependencyCheck = spawnSync(
18
52
  python,
19
53
  ["-c", "import typer, yaml, jsonschema, rich"],
@@ -24,6 +58,16 @@ const dependencyCheck = spawnSync(
24
58
  },
25
59
  );
26
60
 
61
+ if (dependencyCheck.error) {
62
+ console.error(
63
+ `Unable to run the configured Python interpreter ${python}: ${dependencyCheck.error.message}`,
64
+ );
65
+ console.error(
66
+ "Install Python 3.9+ or point COX_PYTHON at a working interpreter.",
67
+ );
68
+ process.exit(1);
69
+ }
70
+
27
71
  if (dependencyCheck.status !== 0) {
28
72
  console.error(
29
73
  `Python dependencies for COX are missing in ${python}.`,
@@ -4,7 +4,7 @@ This package ships an NPM command named `cox-protocol`. The command delegates to
4
4
 
5
5
  If the target machine has multiple Python installations, set `COX_PYTHON` to the interpreter that has the COX dependencies installed.
6
6
 
7
- > Note: This NPM package installs the `cox-protocol` command wrapper and the COX package files. The target machine must also have Python 3.10+ and the required Python packages:
7
+ > Note: This NPM package installs the `cox-protocol` command wrapper and the COX package files. The target machine must also have Python 3.9+ and the required Python packages:
8
8
  >
9
9
  > ```bash
10
10
  > python3 -m pip install PyYAML jsonschema typer rich
@@ -19,7 +19,7 @@ If the target machine has multiple Python installations, set `COX_PYTHON` to the
19
19
  ## Prerequisites
20
20
 
21
21
  - Node.js 18 or newer
22
- - Python 3.10 or newer
22
+ - Python 3.9 or newer
23
23
  - `pip` available for the Python interpreter you want COX to use
24
24
  - An npm account with two-factor authentication or an appropriate granular publishing token
25
25
 
@@ -32,11 +32,11 @@ The publish metadata should include:
32
32
  ```json
33
33
  {
34
34
  "name": "cox-protocol-package",
35
- "version": "1.0.0",
35
+ "version": "1.0.1",
36
36
  "description": "NPM wrapper and distribution package for the COX protocol CLI.",
37
37
  "license": "MIT",
38
38
  "bin": {
39
- "cox-protocol": "./bin/cox-protocol.js"
39
+ "cox-protocol": "bin/cox-protocol.js"
40
40
  },
41
41
  "files": [
42
42
  "bin",
@@ -79,7 +79,7 @@ npm view cox-protocol-package
79
79
 
80
80
  If npm returns package info, the name is already taken. If it returns a 404, the name can be used.
81
81
 
82
- As of the last local check for this package, both `cox-protocol-package` and `cox-protocol` returned no package version from `npm view`, so either name appeared available. Recheck immediately before publishing because npm names can be claimed at any time.
82
+ For this repository, `cox-protocol-package` is already in use. That is expected once the package has been published. For updates, keep the name and publish a new version.
83
83
 
84
84
  A shorter public name may be better if it is available:
85
85
 
@@ -124,7 +124,7 @@ Then create and inspect the actual tarball:
124
124
 
125
125
  ```bash
126
126
  npm pack
127
- tar -tzf cox-protocol-package-1.0.0.tgz
127
+ tar -tzf cox-protocol-package-<version>.tgz
128
128
  ```
129
129
 
130
130
  Confirm the tarball includes:
@@ -150,7 +150,7 @@ Confirm it does not include:
150
150
  From another temporary folder:
151
151
 
152
152
  ```bash
153
- npm install -g /path/to/cox-protocol-package-1.0.0.tgz
153
+ npm install -g /path/to/cox-protocol-package-<version>.tgz
154
154
  python3 -m pip install PyYAML jsonschema typer rich
155
155
  cox-protocol --help
156
156
  ```
@@ -223,10 +223,10 @@ On the development machine, create the tarball:
223
223
  npm pack
224
224
  ```
225
225
 
226
- Copy `cox-protocol-package-1.0.0.tgz` to the other device, then install it there:
226
+ Copy `cox-protocol-package-<version>.tgz` to the other device, then install it there:
227
227
 
228
228
  ```bash
229
- npm install -g ./cox-protocol-package-1.0.0.tgz
229
+ npm install -g ./cox-protocol-package-<version>.tgz
230
230
  python3 -m pip install PyYAML jsonschema typer rich
231
231
  ```
232
232
 
@@ -284,7 +284,7 @@ npm login
284
284
  npm whoami
285
285
  npm pack --dry-run
286
286
  npm pack
287
- npm install -g ./cox-protocol-package-1.0.0.tgz
287
+ npm install -g ./cox-protocol-package-<version>.tgz
288
288
  python3 -m pip install PyYAML jsonschema typer rich
289
289
  cox-protocol --help
290
290
  npm publish
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "cox-protocol-package",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "NPM wrapper and distribution package for the COX protocol CLI.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "bin": {
8
- "cox-protocol": "./bin/cox-protocol.js"
8
+ "cox-protocol": "bin/cox-protocol.js"
9
9
  },
10
10
  "files": [
11
11
  "bin",
package/pyproject.toml CHANGED
@@ -4,10 +4,10 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "cox-protocol-package"
7
- version = "1.0.0"
7
+ version = "1.0.1"
8
8
  description = "Validator and compiler for COX design-spec documents"
9
9
  readme = "README.md"
10
- requires-python = ">=3.10"
10
+ requires-python = ">=3.9"
11
11
  license = { file = "LICENSE" }
12
12
  authors = [
13
13
  { name = "Charbel Malo" },
@@ -26,6 +26,7 @@ classifiers = [
26
26
  "Intended Audience :: Developers",
27
27
  "License :: OSI Approved :: MIT License",
28
28
  "Programming Language :: Python :: 3",
29
+ "Programming Language :: Python :: 3.9",
29
30
  "Programming Language :: Python :: 3.10",
30
31
  "Programming Language :: Python :: 3.11",
31
32
  "Programming Language :: Python :: 3.12",
package/tools/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  __all__ = ["__version__"]
2
2
 
3
- __version__ = "1.0.0"
3
+ __version__ = "1.0.1"
package/tools/cox_lib.py CHANGED
@@ -10,6 +10,8 @@ from typing import Any, Sequence
10
10
  import yaml # type: ignore[import-untyped]
11
11
  from jsonschema import Draft202012Validator # type: ignore[import-untyped]
12
12
 
13
+ from . import __version__
14
+
13
15
 
14
16
  SCHEMA_FILENAMES = {
15
17
  "cox.manifest.v1": "cox.manifest.v1.schema.json",
@@ -26,7 +28,7 @@ class CoxError(RuntimeError):
26
28
  """Raised when COX validation or compilation fails."""
27
29
 
28
30
 
29
- @dataclass(slots=True)
31
+ @dataclass
30
32
  class ValidationSummary:
31
33
  project_root: Path
32
34
  manifest_path: Path
@@ -516,7 +518,7 @@ def compile_project(
516
518
  )
517
519
 
518
520
  manifest_payload = {
519
- "compiledWith": "cox 1.0.0",
521
+ "compiledWith": f"cox {__version__}",
520
522
  "mimeType": "application/vnd.cox+yaml",
521
523
  "targets": compile_targets,
522
524
  "manifest": summary.documents[summary.manifest_path],
@@ -6,6 +6,7 @@ import zipfile
6
6
  from pathlib import Path
7
7
  from typing import TYPE_CHECKING, Any, Iterable
8
8
 
9
+ from . import __version__
9
10
  from .cox_lib import relative_path
10
11
 
11
12
 
@@ -162,7 +163,7 @@ def emit_package_archive(
162
163
  )
163
164
 
164
165
  package_manifest = {
165
- "generatedWith": "cox 1.0.0",
166
+ "generatedWith": f"cox {__version__}",
166
167
  "deterministic": True,
167
168
  "archiveRoot": archive_root,
168
169
  "projectName": summary.documents[summary.manifest_path].get(
@@ -5,6 +5,7 @@ import os
5
5
  from pathlib import Path
6
6
  from typing import TYPE_CHECKING, Any
7
7
 
8
+ from . import __version__
8
9
 
9
10
  if TYPE_CHECKING:
10
11
  from .cox_lib import ValidationSummary
@@ -257,7 +258,7 @@ def emit_react_stubs(
257
258
  write_text(react_root / "index.ts", "\n".join(barrel_lines) + "\n")
258
259
 
259
260
  manifest_payload = {
260
- "generatedWith": "cox 1.0.0",
261
+ "generatedWith": f"cox {__version__}",
261
262
  "target": "react",
262
263
  "components": sorted(
263
264
  component_records.values(),