dbx-tools-node-runtime 0.9.131__tar.gz → 0.9.133__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.
@@ -0,0 +1,130 @@
1
+ Metadata-Version: 2.4
2
+ Name: dbx-tools-node-runtime
3
+ Version: 0.9.133
4
+ Summary: Shared PythonMonkey runtime and lazy Node.js bootstrap
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Requires-Dist: databricks-sdk>=0.40,<1
8
+ Requires-Python: >=3.10, <4
9
+ Project-URL: Source, https://github.com/reggie-db/dbx-tools/tree/main/packages/py/node-runtime
10
+ Description-Content-Type: text/markdown
11
+
12
+ # dbx-tools-node-runtime
13
+
14
+ Run dbx-tools Python packages that contain generated PythonMonkey bindings in
15
+ managed Python environments without a system Node.js or npm installation.
16
+
17
+ ## Install the runtime
18
+
19
+ ```python
20
+ %pip install dbx-tools-node-runtime
21
+ ```
22
+
23
+ Most users don't import this package directly. Packages with generated
24
+ dbx-tools Node bindings depend on it and initialize it when the first binding
25
+ loads.
26
+
27
+ On first use, the runtime installs PythonMonkey 1.3.2 into the active Python
28
+ environment. It uses an available npm executable. If npm is unavailable, it
29
+ installs `nodejs-wheel>=22.20,<23` and creates temporary Node and npm launchers
30
+ from that wheel.
31
+
32
+ An existing npm executable or installed `nodejs-wheel` package is reused
33
+ without an exact wheel-version check. The version range applies when this
34
+ package installs the wheel.
35
+
36
+ ## Prewarm the environment
37
+
38
+ Run the project script to install or verify PythonMonkey before an application
39
+ loads generated bindings:
40
+
41
+ ```bash
42
+ dbx-tools-node-runtime
43
+ ```
44
+
45
+ The command prints the resolved PythonMonkey package path. You can also run
46
+ a CommonJS file through PythonMonkey:
47
+
48
+ ```bash
49
+ dbx-tools-node-runtime ./hello.js
50
+ ```
51
+
52
+ If the environment has no pip, bootstrap uses CPython's bundled `ensurepip`
53
+ before it installs PythonMonkey.
54
+
55
+ ## Use generated bindings
56
+
57
+ Generated packages call the shared runtime through `load_bundle()`. You can
58
+ also load a generated CommonJS bundle directly:
59
+
60
+ ```python
61
+ from dbx_tools.node_runtime.runtime import load_bundle
62
+
63
+ bundle = load_bundle("./generated-runtime.cjs", bundle_id="example")
64
+ module = bundle.module("config")
65
+ ```
66
+
67
+ The runtime loads one process-wide compatibility registry and caches each
68
+ bundle by ID. Generated wrappers convert supported records, arrays,
69
+ dataclasses, promises, and JavaScript class instances between Python and
70
+ JavaScript.
71
+
72
+ ## Use Databricks authentication
73
+
74
+ The package also installs the Databricks SDK for Python. In notebooks and Jobs,
75
+ its shared runtime exposes the SDK's default `WorkspaceClient` authentication to
76
+ generated Node auth bindings. Empty auth options use that runtime credential
77
+ source automatically. Explicit profiles, hosts, and credentials continue
78
+ through the normal Node auth providers.
79
+
80
+ In a Databricks notebook or Lakeflow Job, you can omit a profile when the
81
+ default Python SDK credential source is correct for that runtime. Pass an
82
+ explicit profile when you need to select a local Databricks CLI profile.
83
+
84
+ ## Configure installation locks
85
+
86
+ Node-wheel and PythonMonkey installation use separate check-lock-check
87
+ sequences scoped to the active Python environment. Concurrent processes wait
88
+ for the lock, recheck the environment, and skip a second installation when the
89
+ first process completed it.
90
+
91
+ Lock files contain no runtime packages. Set
92
+ `DBX_TOOLS_NODE_RUNTIME_LOCK_DIRECTORY` only when the default per-user cache
93
+ directory is unavailable or isn't shared correctly by the processes that use
94
+ the same Python environment.
95
+
96
+ ## Understand runtime limits
97
+
98
+ - PythonMonkey must be version 1.3.2. Loading another PythonMonkey version in
99
+ the process raises an error.
100
+ - First use can install Python packages into the active environment. Prewarm
101
+ images or managed services that must not install packages during startup.
102
+ - The package provides compatibility only for Node built-ins imported by a
103
+ generated dbx-tools bundle.
104
+ - Bundles must use the same runtime ABI as the installed package.
105
+ - The runtime doesn't provide a general Node package manager or a replacement
106
+ for arbitrary Node applications.
107
+
108
+ ## Contribute runtime changes
109
+
110
+ `build-runtime.ts` bundles the bootstrap and shims into
111
+ `src/dbx_tools/node_runtime/runtime.js`. It adds a generated-file header, avoids
112
+ rewriting unchanged output, and leaves the committed artifact read-only. Edit
113
+ `build-runtime.ts` or `shims/`, then build or verify the artifact:
114
+
115
+ ```bash
116
+ bun packages/py/node-runtime/build-runtime.ts
117
+ bun packages/py/node-runtime/build-runtime.ts --check
118
+ ```
119
+
120
+ In this repository, use the root tasks:
121
+
122
+ ```bash
123
+ bun run python-node-runtime
124
+ bun run python-node-runtime:check
125
+ bun run python-node-runtime:watch
126
+ ```
127
+
128
+ `bun run sync --watch` supervises `python-node-runtime:watch` with the shared
129
+ Python binding, barrel, and Projen configuration watchers. Don't edit the
130
+ generated `runtime.js` file directly.
@@ -0,0 +1,119 @@
1
+ # dbx-tools-node-runtime
2
+
3
+ Run dbx-tools Python packages that contain generated PythonMonkey bindings in
4
+ managed Python environments without a system Node.js or npm installation.
5
+
6
+ ## Install the runtime
7
+
8
+ ```python
9
+ %pip install dbx-tools-node-runtime
10
+ ```
11
+
12
+ Most users don't import this package directly. Packages with generated
13
+ dbx-tools Node bindings depend on it and initialize it when the first binding
14
+ loads.
15
+
16
+ On first use, the runtime installs PythonMonkey 1.3.2 into the active Python
17
+ environment. It uses an available npm executable. If npm is unavailable, it
18
+ installs `nodejs-wheel>=22.20,<23` and creates temporary Node and npm launchers
19
+ from that wheel.
20
+
21
+ An existing npm executable or installed `nodejs-wheel` package is reused
22
+ without an exact wheel-version check. The version range applies when this
23
+ package installs the wheel.
24
+
25
+ ## Prewarm the environment
26
+
27
+ Run the project script to install or verify PythonMonkey before an application
28
+ loads generated bindings:
29
+
30
+ ```bash
31
+ dbx-tools-node-runtime
32
+ ```
33
+
34
+ The command prints the resolved PythonMonkey package path. You can also run
35
+ a CommonJS file through PythonMonkey:
36
+
37
+ ```bash
38
+ dbx-tools-node-runtime ./hello.js
39
+ ```
40
+
41
+ If the environment has no pip, bootstrap uses CPython's bundled `ensurepip`
42
+ before it installs PythonMonkey.
43
+
44
+ ## Use generated bindings
45
+
46
+ Generated packages call the shared runtime through `load_bundle()`. You can
47
+ also load a generated CommonJS bundle directly:
48
+
49
+ ```python
50
+ from dbx_tools.node_runtime.runtime import load_bundle
51
+
52
+ bundle = load_bundle("./generated-runtime.cjs", bundle_id="example")
53
+ module = bundle.module("config")
54
+ ```
55
+
56
+ The runtime loads one process-wide compatibility registry and caches each
57
+ bundle by ID. Generated wrappers convert supported records, arrays,
58
+ dataclasses, promises, and JavaScript class instances between Python and
59
+ JavaScript.
60
+
61
+ ## Use Databricks authentication
62
+
63
+ The package also installs the Databricks SDK for Python. In notebooks and Jobs,
64
+ its shared runtime exposes the SDK's default `WorkspaceClient` authentication to
65
+ generated Node auth bindings. Empty auth options use that runtime credential
66
+ source automatically. Explicit profiles, hosts, and credentials continue
67
+ through the normal Node auth providers.
68
+
69
+ In a Databricks notebook or Lakeflow Job, you can omit a profile when the
70
+ default Python SDK credential source is correct for that runtime. Pass an
71
+ explicit profile when you need to select a local Databricks CLI profile.
72
+
73
+ ## Configure installation locks
74
+
75
+ Node-wheel and PythonMonkey installation use separate check-lock-check
76
+ sequences scoped to the active Python environment. Concurrent processes wait
77
+ for the lock, recheck the environment, and skip a second installation when the
78
+ first process completed it.
79
+
80
+ Lock files contain no runtime packages. Set
81
+ `DBX_TOOLS_NODE_RUNTIME_LOCK_DIRECTORY` only when the default per-user cache
82
+ directory is unavailable or isn't shared correctly by the processes that use
83
+ the same Python environment.
84
+
85
+ ## Understand runtime limits
86
+
87
+ - PythonMonkey must be version 1.3.2. Loading another PythonMonkey version in
88
+ the process raises an error.
89
+ - First use can install Python packages into the active environment. Prewarm
90
+ images or managed services that must not install packages during startup.
91
+ - The package provides compatibility only for Node built-ins imported by a
92
+ generated dbx-tools bundle.
93
+ - Bundles must use the same runtime ABI as the installed package.
94
+ - The runtime doesn't provide a general Node package manager or a replacement
95
+ for arbitrary Node applications.
96
+
97
+ ## Contribute runtime changes
98
+
99
+ `build-runtime.ts` bundles the bootstrap and shims into
100
+ `src/dbx_tools/node_runtime/runtime.js`. It adds a generated-file header, avoids
101
+ rewriting unchanged output, and leaves the committed artifact read-only. Edit
102
+ `build-runtime.ts` or `shims/`, then build or verify the artifact:
103
+
104
+ ```bash
105
+ bun packages/py/node-runtime/build-runtime.ts
106
+ bun packages/py/node-runtime/build-runtime.ts --check
107
+ ```
108
+
109
+ In this repository, use the root tasks:
110
+
111
+ ```bash
112
+ bun run python-node-runtime
113
+ bun run python-node-runtime:check
114
+ bun run python-node-runtime:watch
115
+ ```
116
+
117
+ `bun run sync --watch` supervises `python-node-runtime:watch` with the shared
118
+ Python binding, barrel, and Projen configuration watchers. Don't edit the
119
+ generated `runtime.js` file directly.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dbx-tools-node-runtime"
3
- version = "0.9.131"
3
+ version = "0.9.133"
4
4
  description = "Shared PythonMonkey runtime and lazy Node.js bootstrap"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10,<4"
@@ -2,7 +2,7 @@
2
2
 
3
3
  [project]
4
4
  name = "dbx-tools-node-runtime"
5
- version = "0.9.131"
5
+ version = "0.9.133"
6
6
  description = "Shared PythonMonkey runtime and lazy Node.js bootstrap"
7
7
  readme = "README.md"
8
8
  requires-python = ">=3.10,<4"
@@ -1,100 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: dbx-tools-node-runtime
3
- Version: 0.9.131
4
- Summary: Shared PythonMonkey runtime and lazy Node.js bootstrap
5
- License-Expression: Apache-2.0
6
- License-File: LICENSE
7
- Requires-Dist: databricks-sdk>=0.40,<1
8
- Requires-Python: >=3.10, <4
9
- Project-URL: Source, https://github.com/reggie-db/dbx-tools/tree/main/packages/py/node-runtime
10
- Description-Content-Type: text/markdown
11
-
12
- # `dbx-tools-node-runtime`
13
-
14
- Run PythonMonkey-based packages in managed Python environments that do not
15
- provide system Node.js or npm.
16
-
17
- ## Quick Start
18
-
19
- ```python
20
- %pip install dbx-tools-node-runtime
21
- ```
22
-
23
- On first use, the package installs the locked PythonMonkey runtime into the
24
- active Python environment. It reuses npm when available; otherwise it installs
25
- `nodejs-wheel>=22.20,<23` and uses the packaged Node and npm executables.
26
-
27
- An existing npm executable or installed `nodejs-wheel` package is reused without
28
- enforcing an exact Node wheel version. The range applies only when the runtime
29
- must install `nodejs-wheel` itself.
30
-
31
- Both installations use a check-lock-check sequence scoped to the active Python
32
- environment. Concurrent processes wait for the same install, then recheck the
33
- environment instead of installing a second copy. The lock files contain no
34
- runtime packages. Set `DBX_TOOLS_NODE_RUNTIME_LOCK_DIRECTORY` only when the
35
- default per-user lock directory is unsuitable.
36
-
37
- ## Runtime Installation
38
-
39
- Install the package normally:
40
-
41
- ```python
42
- %pip install dbx-tools-node-runtime
43
- ```
44
-
45
- If the active environment was created without pip, the first runtime
46
- installation uses CPython's bundled `ensurepip` before installing PythonMonkey.
47
-
48
- Prewarm the runtime explicitly when desired:
49
-
50
- ```sh
51
- dbx-tools-node-runtime
52
- ```
53
-
54
- The same project script can execute a CommonJS file through the lazy runtime:
55
-
56
- ```sh
57
- dbx-tools-node-runtime ./hello.js
58
- ```
59
-
60
- Otherwise the first generated binding load performs the same initialization
61
- through `ensure_pythonmonkey()`. Generated dbx-tools bindings use
62
- PythonMonkey's standard `pythonmonkey.require` loader after installation.
63
-
64
- The package also installs the Databricks SDK for Python. In notebooks and Jobs,
65
- its shared runtime exposes the SDK's default `WorkspaceClient` authentication to
66
- generated Node auth bindings. Empty auth options use that runtime credential
67
- source automatically. Explicit profiles, hosts, and credentials continue
68
- through the normal Node auth providers.
69
-
70
- The shared PythonMonkey host lives under `shims/`. A shim path
71
- encodes its specifier: `___` becomes `:`, `__` becomes `/`, and every other
72
- character stays as written (`node___fs__promises.ts` becomes `node:fs/promises`).
73
- Files whose derived name has no scheme, including `bootstrap.ts`, are support
74
- modules rather than runtime registry entries. Duplicate derived specifiers or
75
- registry aliases fail the build.
76
-
77
- ## Build and watch
78
-
79
- `build-runtime.ts` bundles the bootstrap and shims into
80
- `src/dbx_tools/node_runtime/runtime.js`. It adds a generated-file header, avoids
81
- rewriting unchanged output, and leaves the committed artifact read-only. Build
82
- or verify it directly with:
83
-
84
- ```sh
85
- bun packages/py/node-runtime/build-runtime.ts
86
- bun packages/py/node-runtime/build-runtime.ts --check
87
- ```
88
-
89
- In a `@dbx-tools/projen` Python workspace, mark this package with
90
- `nodeRuntime: true`. Projen then exposes repository-wide tasks rather than
91
- package-specific tasks:
92
-
93
- ```sh
94
- bun run python-node-runtime
95
- bun run python-node-runtime:check
96
- bun run python-node-runtime:watch
97
- ```
98
-
99
- `bun run sync --watch` supervises `python-node-runtime:watch` with the shared
100
- Python binding, barrel, and Projen configuration watchers.
@@ -1,89 +0,0 @@
1
- # `dbx-tools-node-runtime`
2
-
3
- Run PythonMonkey-based packages in managed Python environments that do not
4
- provide system Node.js or npm.
5
-
6
- ## Quick Start
7
-
8
- ```python
9
- %pip install dbx-tools-node-runtime
10
- ```
11
-
12
- On first use, the package installs the locked PythonMonkey runtime into the
13
- active Python environment. It reuses npm when available; otherwise it installs
14
- `nodejs-wheel>=22.20,<23` and uses the packaged Node and npm executables.
15
-
16
- An existing npm executable or installed `nodejs-wheel` package is reused without
17
- enforcing an exact Node wheel version. The range applies only when the runtime
18
- must install `nodejs-wheel` itself.
19
-
20
- Both installations use a check-lock-check sequence scoped to the active Python
21
- environment. Concurrent processes wait for the same install, then recheck the
22
- environment instead of installing a second copy. The lock files contain no
23
- runtime packages. Set `DBX_TOOLS_NODE_RUNTIME_LOCK_DIRECTORY` only when the
24
- default per-user lock directory is unsuitable.
25
-
26
- ## Runtime Installation
27
-
28
- Install the package normally:
29
-
30
- ```python
31
- %pip install dbx-tools-node-runtime
32
- ```
33
-
34
- If the active environment was created without pip, the first runtime
35
- installation uses CPython's bundled `ensurepip` before installing PythonMonkey.
36
-
37
- Prewarm the runtime explicitly when desired:
38
-
39
- ```sh
40
- dbx-tools-node-runtime
41
- ```
42
-
43
- The same project script can execute a CommonJS file through the lazy runtime:
44
-
45
- ```sh
46
- dbx-tools-node-runtime ./hello.js
47
- ```
48
-
49
- Otherwise the first generated binding load performs the same initialization
50
- through `ensure_pythonmonkey()`. Generated dbx-tools bindings use
51
- PythonMonkey's standard `pythonmonkey.require` loader after installation.
52
-
53
- The package also installs the Databricks SDK for Python. In notebooks and Jobs,
54
- its shared runtime exposes the SDK's default `WorkspaceClient` authentication to
55
- generated Node auth bindings. Empty auth options use that runtime credential
56
- source automatically. Explicit profiles, hosts, and credentials continue
57
- through the normal Node auth providers.
58
-
59
- The shared PythonMonkey host lives under `shims/`. A shim path
60
- encodes its specifier: `___` becomes `:`, `__` becomes `/`, and every other
61
- character stays as written (`node___fs__promises.ts` becomes `node:fs/promises`).
62
- Files whose derived name has no scheme, including `bootstrap.ts`, are support
63
- modules rather than runtime registry entries. Duplicate derived specifiers or
64
- registry aliases fail the build.
65
-
66
- ## Build and watch
67
-
68
- `build-runtime.ts` bundles the bootstrap and shims into
69
- `src/dbx_tools/node_runtime/runtime.js`. It adds a generated-file header, avoids
70
- rewriting unchanged output, and leaves the committed artifact read-only. Build
71
- or verify it directly with:
72
-
73
- ```sh
74
- bun packages/py/node-runtime/build-runtime.ts
75
- bun packages/py/node-runtime/build-runtime.ts --check
76
- ```
77
-
78
- In a `@dbx-tools/projen` Python workspace, mark this package with
79
- `nodeRuntime: true`. Projen then exposes repository-wide tasks rather than
80
- package-specific tasks:
81
-
82
- ```sh
83
- bun run python-node-runtime
84
- bun run python-node-runtime:check
85
- bun run python-node-runtime:watch
86
- ```
87
-
88
- `bun run sync --watch` supervises `python-node-runtime:watch` with the shared
89
- Python binding, barrel, and Projen configuration watchers.