brainx-skill 1.0.2 → 1.0.6
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/LICENSE +1 -1
- package/README.md +24 -56
- package/{lib → installation/lib}/installer.js +4 -4
- package/manifest.json +3 -1
- package/package.json +19 -9
- package/skills/brainstate/SKILL.md +399 -0
- package/skills/brainstate/agents/openai.yaml +4 -0
- package/skills/brainstate/references/brainstate/brainstate-control-flow-patterns.md +483 -0
- package/skills/brainstate/references/brainstate/brainstate-transformed-diagnostics.md +176 -0
- package/skills/brainstate/references/brainstate/parameter-constraints-regularization.md +199 -0
- package/skills/brainstate/references/brainstate/parameter-transforms-regularizers-catalog.md +166 -0
- package/skills/brainstate/references/brainstate/randomness-and-reproducibility.md +210 -0
- package/skills/brainstate/references/brainstate/transformation-grad-expansion.md +450 -0
- package/skills/brainstate/references/brainstate/transformation-jit-expansion.md +157 -0
- package/skills/brainstate/references/brainstate/transformation-vmap-expansion.md +286 -0
- package/skills/brainstate/references/braintools-optimizer-reference.md +133 -0
- package/skills/brainstate/references/collective_model_operations.md +195 -0
- package/skills/brainstate/references/extension_mechanisms.md +282 -0
- package/skills/brainstate/references/libraries/prebuilt-activation-library.md +106 -0
- package/skills/brainstate/references/libraries/prebuilt-layer-library.md +217 -0
- package/skills/brainstate/references/libraries/solver-library-with-effects.md +85 -0
- package/skills/brainstate/references/model-interop-and-migration.md +295 -0
- package/skills/brainstate/references/simulation-environment.md +117 -0
- package/skills/brainstate/references/size-inference-variations.md +268 -0
- package/skills/brainstate/references/state-graph-operations.md +218 -0
- package/skills/brainstate/references/state_collections_and_utilities.md +224 -0
- package/skills/brainstate/scripts/integrator_rnn.py +359 -0
- package/skills/brainstate/scripts/lif_neuron_model.py +52 -0
- package/skills/brainstate/scripts/modern_cnn.py +73 -0
- package/skills/brainstate/scripts/resnet.py +130 -0
- package/skills/brainunit/SKILL.md +287 -0
- package/skills/brainunit/references/array-creation.md +158 -0
- package/skills/brainunit/references/array-mechanics/functional-structural-api.md +90 -0
- package/skills/brainunit/references/array-mechanics.md +165 -0
- package/skills/brainunit/references/math-function-library.md +433 -0
- package/skills/brainunit/references/physical-constant-library.md +58 -0
- package/skills/brainunit/references/prefix-library.md +116 -0
- package/skills/brainunit/references/quantity-inspection-and-conversion.md +104 -0
- package/skills/brainunit/references/typing-and-runtime-validation.md +203 -0
- package/skills/brainunit/references/unit-structure-and-definition.md +140 -0
- package/skills/brainx-install/SKILL.md +21 -13
- package/skills/brainx-install/references/compatibility-and-release-matching.md +12 -10
- package/skills/brainx-install/references/uninstall-and-cleanup.md +186 -0
- /package/{bin → installation/bin}/brainx.js +0 -0
- /package/{lib → installation/lib}/adapter-transaction.js +0 -0
- /package/{lib → installation/lib}/bundle.js +0 -0
- /package/{lib → installation/lib}/cli.js +0 -0
- /package/{lib → installation/lib}/constants.js +0 -0
- /package/{lib → installation/lib}/hash.js +0 -0
- /package/{lib → installation/lib}/paths.js +0 -0
- /package/{lib → installation/lib}/prompts.js +0 -0
- /package/{lib → installation/lib}/receipt.js +0 -0
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: brainx-install
|
|
3
|
-
description:
|
|
3
|
+
description: "Manage BrainX Python package installation and package state: install, set up, upgrade, downgrade, pin, migrate, uninstall, or clean up BrainX; select CPU, CUDA 12, CUDA 13, or TPU package extras; and reconcile BrainX release, dependency, and virtual-environment compatibility. Use only for requests about installing or removing packages, package versions, dependency constraints, pip or virtual-environment setup, or device-specific package builds. Do not use for BrainX modeling, simulation, APIs, coding, application debugging, performance, or other general BrainX questions."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# BrainX Install
|
|
7
7
|
|
|
8
8
|
## Objective
|
|
9
9
|
|
|
10
|
-
Install
|
|
10
|
+
Install or remove BrainX in one confirmed Python virtual environment, verify, then report the result. For installation, treat each published BrainX release as an indivisible compatibility set; never assemble independently selected subpackage versions.
|
|
11
|
+
|
|
12
|
+
## Request Routing
|
|
13
|
+
|
|
14
|
+
For an uninstall, removal, or BrainX package-cleanup request, open [references/uninstall-and-cleanup.md](references/uninstall-and-cleanup.md) and stop here. Follow that reference in full; do not apply the installation workflow's device or release selection.
|
|
15
|
+
|
|
16
|
+
For installation, upgrade, downgrade, migration, device-target, or compatibility requests, continue with the workflow below.
|
|
11
17
|
|
|
12
18
|
## Core Rules
|
|
13
19
|
|
|
14
20
|
1. BrainX package must use a Python interpreter at version `>=3.11`.
|
|
15
|
-
2. For a clean environment with no requested version, prefer to use the unpinned BrainX install matching the confirmed device.
|
|
21
|
+
2. For a clean environment with no requested version, prefer to use the unpinned BrainX install matching the confirmed device, but resolve and name the current latest Python-compatible BrainX date-style release before confirmation. Critically, if a BrainX component already exists in the environment, or a requested version is specified, you must open [compatibility-and-release-matching.md](references/compatibility-and-release-matching.md), use it as the primary release source, and select one non-separated release. Never mix component versions from different rows.
|
|
16
22
|
3. Require the user to explicitly choose `cpu`, `cuda12`, `cuda13`, or `tpu`. Detection is evidence, not consent.
|
|
17
23
|
4. Before any mutation, must present the complete specification to the user clearly, show the run location, interpreter, venv path, device extra, release, complete component set, existing packages, expected results, and exact commands.
|
|
18
24
|
5. Create or modify nothing until the user confirms that complete specification.
|
|
@@ -47,7 +53,8 @@ Collect enough evidence to identify:
|
|
|
47
53
|
- visible NVIDIA or TPU hardware and the driver, toolkit, container, or runtime evidence needed to distinguish `cuda12`, `cuda13`, and `tpu`;
|
|
48
54
|
- the active Python executable and version, environment-manager state, pip version, and viable candidate interpreters;
|
|
49
55
|
- existing `.venv`, `.venv-brainx`, or user-designated target environments without creating or activating them;
|
|
50
|
-
- installed versions of BrainX, BrainUnit, BrainState, BrainEvent, BrainTools, BrainTrace or BrainScale, BrainCell, BrainPy, BrainPy-State, BrainMass, PINNx, JAX, JAXlib, and Optax in every environment relevant to the request
|
|
56
|
+
- installed versions of BrainX, BrainUnit, BrainState, BrainEvent, BrainTools, BrainTrace or BrainScale, BrainCell, BrainPy, BrainPy-State, BrainMass, PINNx, JAX, JAXlib, and Optax in every environment relevant to the request;
|
|
57
|
+
- for a clean unpinned install, the exact latest BrainX release compatible with the proposed interpreter, resolved from read-only official package-index metadata.
|
|
51
58
|
|
|
52
59
|
Prefer package metadata and platform-native tools over imports or newly installed helpers. Record missing evidence explicitly as `unknown`, `not_detected`, or a command error rather than guessing. Organize the result in whatever concise structured form best fits the task.
|
|
53
60
|
|
|
@@ -70,9 +77,9 @@ Replace the example values with the user's actual target. If evidence is uncerta
|
|
|
70
77
|
|
|
71
78
|
## 3. Select One Release
|
|
72
79
|
|
|
73
|
-
When no BrainX meta-package or ecosystem component is installed and the user has not requested a specific version, do not open the compatibility reference.
|
|
80
|
+
First case, When no BrainX meta-package or ecosystem component is installed and the user has not requested a specific version, do not open the compatibility reference. Use read-only official package-index metadata with the proposed interpreter to identify the exact latest Python-compatible BrainX release, then report it in the form `latest (vYYYY.M.D)`. For example, report `latest (v2026.7.9)` when `2026.7.9` is the verified current release.
|
|
74
81
|
|
|
75
|
-
|
|
82
|
+
Critically, for the second case, when BrainX packages are already installed or the user requests a specific pinned version, you must open [compatibility-and-release-matching.md](references/compatibility-and-release-matching.md) before selecting a release, then apply the matching procedure below.
|
|
76
83
|
|
|
77
84
|
- With one exact component match, choose the newest row containing that exact version.
|
|
78
85
|
- When one BrainX ecosystem component is installed and its version does not appear in any compatibility matrix row, compare it with the versions declared for that same component across all rows. Choose the BrainX release containing the closest semantic version, favor the newer BrainX release if two rows are equally close, propose installing that entire BrainX release rather than the component alone, and disclose the component version change.
|
|
@@ -82,15 +89,13 @@ When BrainX packages are already installed or the user requests a specific pinne
|
|
|
82
89
|
|
|
83
90
|
## 4. Choose the Venv
|
|
84
91
|
|
|
85
|
-
|
|
92
|
+
Prefer reusing an existing relevant Python virtual environment whose interpreter is Python `>=3.11`. This includes environments managed by `venv`, Conda, or another environment manager; inspect the environment before proposing reuse.
|
|
86
93
|
|
|
87
|
-
-
|
|
88
|
-
- If `.venv` exists and its interpreter is Python `>=3.11`, inspect it and propose reuse.
|
|
89
|
-
- If `.venv` exists but is unsuitable, propose `<run-location>/.venv-brainx`.
|
|
94
|
+
- If no suitable existing environment is available, propose creating a fresh virtual environment.
|
|
90
95
|
- Never delete, rebuild, overwrite, or silently repurpose an existing environment.
|
|
91
96
|
- Never install into the global interpreter or an unrelated environment.
|
|
92
97
|
|
|
93
|
-
Resolve the exact interpreter inside the proposed
|
|
98
|
+
Resolve the exact interpreter inside the proposed environment using the conventions of the confirmed platform and environment manager. Do not rely on shell activation or assume that a bare `python` or `pip` command targets the intended environment.
|
|
94
99
|
|
|
95
100
|
## 5. Present the Complete Specification
|
|
96
101
|
|
|
@@ -113,6 +118,7 @@ Device target
|
|
|
113
118
|
|
|
114
119
|
BrainX target package state
|
|
115
120
|
- Current BrainX ecosystem packages and versions:
|
|
121
|
+
- Target BrainX release: latest or selected, with the explicit date-style release (`vYYYY.M.D`)
|
|
116
122
|
- Expected final package set after installation, using exact pins or declared constraints
|
|
117
123
|
|
|
118
124
|
Planned changes
|
|
@@ -121,7 +127,7 @@ Planned changes
|
|
|
121
127
|
Please confirm the entire setup or correct it.
|
|
122
128
|
```
|
|
123
129
|
|
|
124
|
-
For an existing-package or pinned-version workflow, list the BrainX meta-package and every component declared by the selected compatibility row under `Expected final package set`, using the exact target version or constraint. For a clean unpinned install,
|
|
130
|
+
For an existing-package or pinned-version workflow, list the BrainX meta-package and every component declared by the selected compatibility row under `Expected final package set`, using the exact target version or constraint. For a clean unpinned install, name the device-specific meta-package and verified release explicitly under `Target BrainX release` and `Expected final package set`, for example `BrainX[cpu]: latest (v2026.7.9)`.
|
|
125
131
|
|
|
126
132
|
End by asking the user to confirm the entire setup or correct it, and state explicitly that no environment will be created or modified before confirmation.
|
|
127
133
|
|
|
@@ -217,6 +223,8 @@ When an exact release is requested, preserve the confirmed hardware extra while
|
|
|
217
223
|
|
|
218
224
|
## Reference Routing
|
|
219
225
|
|
|
220
|
-
Open [references/
|
|
226
|
+
Open [references/uninstall-and-cleanup.md](references/uninstall-and-cleanup.md) for any request to uninstall, remove, or clean up BrainX packages. Use its exact package scopes and mandatory uninstall specification; do not use the compatibility matrix to narrow the cleanup set.
|
|
227
|
+
|
|
228
|
+
Open [references/compatibility-and-release-matching.md](references/compatibility-and-release-matching.md) when the target environment already contains BrainX or BrainX ecosystem packages, or when the user requests a specific pinned BrainX version. This reference is mandatory for that second case and must be read before release selection. Use its matrix to match existing packages, reconcile version drift, evaluate pinned-version compatibility, and select one coherent BrainX release with its declared component versions.
|
|
221
229
|
|
|
222
230
|
Do not open this reference for a clean installation when no BrainX packages are present and no specific version is requested; use the unpinned quick-install path instead.
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
This reference records the package versions explicitly declared by each BrainX release.
|
|
4
4
|
|
|
5
|
+
Use this matrix for the second release-selection case: the target environment already contains a BrainX ecosystem package, or the user requests a specific pinned BrainX version. In that case, read this matrix before selecting a release and treat each row as one indivisible compatibility set.
|
|
6
|
+
|
|
5
7
|
## How to read this table
|
|
6
8
|
|
|
7
9
|
* `—` means the package or dependency was **not explicitly listed** in that release. It does not prove that the package was unsupported or unavailable.
|
|
@@ -17,19 +19,19 @@ This reference records the package versions explicitly declared by each BrainX r
|
|
|
17
19
|
| `v2026.7.9` | `>=0.8.0, <=0.10.2` | `0.5.1` | `0.5.2` | `0.1.2` | `0.3.0` | BrainTrace `0.2.4` | `0.1.0` | `2.8.1` | `0.1.0` | `0.1.1` | **Not bundled** | `>=0.2.8` |
|
|
18
20
|
| `v2026.6.29` | `>=0.8.0, <=0.10.2` | `0.5.1` | `0.5.2` | `0.1.1` | `0.3.0` | BrainTrace `0.2.2` | `0.1.0` | `2.8.0` | `0.1.0` | `0.1.1` | **Removed** | — |
|
|
19
21
|
| `v2026.6.19` | `>=0.8.0, <=0.10.2` | `0.5.1` | `0.5.1` | `0.1.1` | `0.3.0` | BrainTrace `0.2.1` | `0.1.0` | `2.8.0` | `0.1.0` | `0.1.1` | `0.0.3` | — |
|
|
20
|
-
| `v2026.6.18` |
|
|
21
|
-
| `v2026.6.14` |
|
|
22
|
-
| `v2026.6.11` |
|
|
22
|
+
| `v2026.6.18` | `>=0.7.1, <=0.10.1` | `0.4.0` | `0.5.0` | `0.1.0` | `0.1.10` | BrainTrace `0.2.0` | `0.0.8` | `2.7.8` | `0.1.0` | `0.0.5` | `0.0.3` | — |
|
|
23
|
+
| `v2026.6.14` | `>=0.7.1, <=0.10.1` | `0.4.0` | `0.5.0` | `0.1.0` | `0.1.10` | BrainTrace `0.2.0` | `0.0.8` | `2.7.8` | `0.0.4` | `0.0.5` | `0.0.3` | — |
|
|
24
|
+
| `v2026.6.11` | `>=0.7.1, <=0.10.1` | `0.4.0` | `0.4.2` | `0.1.0` | `0.1.10` | BrainTrace `0.2.0` | `0.0.8` | `2.7.8` | `0.0.4` | `0.0.5` | `0.0.3` | — |
|
|
23
25
|
| `v2026.6.8` | `>=0.6.0, <=0.10.1` | `0.3.2` | `0.4.0` | `0.1.0` | `0.1.9` | BrainTrace `0.2.0` | `0.0.8` | `2.7.8` | `0.0.4` | `0.0.5` | `0.0.3` | — |
|
|
24
26
|
| `v2026.3.12` | `>=0.6.0, <=0.9.1` | `0.2.0` | `0.3.0` | `0.0.7` | `0.1.8` | BrainTrace `0.1.2` | `0.0.8` | `2.7.7` | `0.0.4` | `0.0.5` | `0.0.3` | — |
|
|
25
27
|
| `v2026.1.31` | `>=0.6.0, <0.9.0` | `0.1.4` | `0.2.10` | `0.0.5` | `0.1.8` | BrainTrace `0.1.2` | `0.0.7` | `2.7.6` | `0.0.3` | `0.0.5` | `0.0.3` | — |
|
|
26
|
-
| `v2026.1.22` | `>=0.6.0`
|
|
27
|
-
| `v2026.1.21` | `>=0.6.0`
|
|
28
|
-
| `v2026.1.19` | `>=0.6.0`
|
|
29
|
-
| `v2026.1.16` | `>=0.6.0`
|
|
30
|
-
| `v2025.12.26` | `>=0.6.0`
|
|
31
|
-
| `v2025.12.25` | `>=0.6.0`
|
|
32
|
-
| `v2025.12.2` | `>=0.6.0`
|
|
28
|
+
| `v2026.1.22` | `>=0.6.0, <=0.9.0` | `0.1.3` | `0.2.9` | `0.0.5` | `0.1.8` | BrainTrace `0.1.2` | `0.0.7` | `2.7.6` | `0.0.3` | `0.0.5` | `0.0.3` | — |
|
|
29
|
+
| `v2026.1.21` | `>=0.6.0, <=0.9.0` | `0.1.3` | `0.2.9` | `0.0.5` | `0.1.7` | BrainTrace `0.1.2` | `0.0.7` | `2.7.6` | `0.0.3` | `0.0.5` | `0.0.3` | — |
|
|
30
|
+
| `v2026.1.19` | `>=0.6.0, <=0.8.2` | `0.1.3` | `0.2.9` | `0.0.5` | `0.1.7` | BrainTrace `0.1.2` | `0.0.7` | `2.7.5` | `0.0.3` | `0.0.5` | `0.0.3` | — |
|
|
31
|
+
| `v2026.1.16` | `>=0.6.0, <=0.8.2` | `0.1.3` | `0.2.9` | `0.0.5` | `0.1.7` | BrainTrace `0.1.2` | `0.0.6` | `2.7.5` | `0.0.2` | `0.0.4` | `0.0.3` | — |
|
|
32
|
+
| `v2025.12.26` | `>=0.6.0, <=0.8.2` | `0.1.3` | `0.2.8` | `0.0.5` | `0.1.6` | BrainTrace `0.1.2` | `0.0.6` | `2.7.5` | `0.0.2` | `0.0.4` | `0.0.3` | — |
|
|
33
|
+
| `v2025.12.25` | `>=0.6.0, <=0.8.2` | `0.1.3` | `0.2.8` | `0.0.5` | `0.1.6` | BrainTrace `0.1.2` | `0.0.6` | — | `0.0.1` | `0.0.4` | `0.0.3` | — |
|
|
34
|
+
| `v2025.12.2` | `>=0.6.0, <=0.8.1` | `0.1.2` | `0.2.6` | `0.0.4` | `0.1.4` | BrainTrace `0.1.1` | `0.0.6` | `2.7.2` | — | `0.0.4` | `0.0.3` | — |
|
|
33
35
|
| `v2025.10.13` | `>=0.6.0, <0.8.0` | `0.1.1` | `0.2.3` | `0.0.4` | `0.1.3` | BrainScale `0.1.0` | `0.0.6` | `2.7.1` | — | `0.0.4` | — | — |
|
|
34
36
|
| `v2025.9.15` | `>=0.4.35, <0.8.0` | `0.1.1` | `0.1.10` | `0.0.4` | `0.0.11` | BrainScale `0.0.10` | `0.0.4` | — | — | `0.0.3` | — | — |
|
|
35
37
|
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# BrainX Uninstall and Cleanup
|
|
2
|
+
|
|
3
|
+
Use this reference to remove BrainX from one confirmed Python environment while keeping the environment and shared dependencies. Follow this workflow instead of the installation workflow.
|
|
4
|
+
|
|
5
|
+
## Scope
|
|
6
|
+
|
|
7
|
+
The BrainX removal list includes the current ecosystem and packages bundled by historical BrainX releases:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
BrainX
|
|
11
|
+
brainunit
|
|
12
|
+
brainstate
|
|
13
|
+
brainpy
|
|
14
|
+
brainpy-state
|
|
15
|
+
brainevent
|
|
16
|
+
braincell
|
|
17
|
+
braintrace
|
|
18
|
+
brainscale
|
|
19
|
+
brainmass
|
|
20
|
+
braintools
|
|
21
|
+
pinnx
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The optional JAX removal list contains only these JAX runtime and accelerator-plugin distributions:
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
jax
|
|
28
|
+
jaxlib
|
|
29
|
+
jax-cuda12-plugin
|
|
30
|
+
jax-cuda12-pjrt
|
|
31
|
+
jax-cuda13-plugin
|
|
32
|
+
jax-cuda13-pjrt
|
|
33
|
+
libtpu
|
|
34
|
+
libtpu-nightly
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Treat distribution names case-insensitively and normalize `.`, `_`, and `-` as equivalent when comparing installed metadata. For example, the `brainpy-state` distribution may appear in requirement metadata as `brainpy.state` or `brainpy_state`.
|
|
38
|
+
|
|
39
|
+
Do not automatically remove packages merely because BrainX or JAX depends on them. Preserve `saiunit`, NumPy, Optax, Matplotlib, Msgpack, SciPy, ML Dtypes, Opt Einsum, NVIDIA runtime wheels, CUDA drivers and toolkits, and all other shared dependencies. Also preserve the virtual environment, source checkouts, caches, datasets, lockfiles, manifests, and this agent skill.
|
|
40
|
+
|
|
41
|
+
## Core Rules
|
|
42
|
+
|
|
43
|
+
1. Operate on only one Python environment at a time: identify its exact path, verify that it is a virtual environment or non-base Conda environment rather than a global interpreter, and obtain the user's confirmation before uninstalling anything.
|
|
44
|
+
2. Run every pip command through that environment's exact Python executable, for example `"<venv>/bin/python" -m pip`; do not rely on shell activation or use a bare `python` or `pip`, because those commands may target a different environment.
|
|
45
|
+
3. Inspect first and include only distributions proven local to the confirmed virtual environment in the proposed uninstall commands.
|
|
46
|
+
4. Ask explicitly whether JAX cleanup is included. Installed JAX packages or accelerator hardware are evidence, not consent.
|
|
47
|
+
5. Before any mutation, present the complete uninstall specification in this reference and obtain explicit confirmation of the environment, exact package lists, and expected final state.
|
|
48
|
+
6. If the environment or proposed scope changes, discard the earlier confirmation, present a corrected specification, and ask again.
|
|
49
|
+
7. Never delete an environment, use `--break-system-packages`, invoke an automatic orphan remover, modify dependency files, or expand the package set without approval.
|
|
50
|
+
|
|
51
|
+
## Workflow
|
|
52
|
+
|
|
53
|
+
Follow this order without skipping the confirmation gate:
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
read-only environment inspection
|
|
57
|
+
-> installed-target and reverse-dependency inventory
|
|
58
|
+
-> explicit JAX cleanup choice
|
|
59
|
+
-> complete uninstall specification
|
|
60
|
+
-> explicit user confirmation
|
|
61
|
+
-> BrainX uninstall
|
|
62
|
+
-> optional JAX uninstall
|
|
63
|
+
-> metadata and pip-check verification
|
|
64
|
+
-> final report
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## 1. Inspect One Environment
|
|
68
|
+
|
|
69
|
+
Record the intended run location and identify the exact environment before inspecting packages. Confirm:
|
|
70
|
+
|
|
71
|
+
- the exact Python executable and version;
|
|
72
|
+
- the virtual-environment or Conda-environment path and environment manager;
|
|
73
|
+
- evidence that the interpreter is not global and not the Conda base environment;
|
|
74
|
+
- the pip version associated with that interpreter;
|
|
75
|
+
- installed names and versions from both package lists above;
|
|
76
|
+
- the environment's existing `pip check` result;
|
|
77
|
+
- remaining installed packages that declare a proposed removal target as a requirement.
|
|
78
|
+
|
|
79
|
+
Prefer distribution metadata over imports. Use the exact interpreter for read-only inspection:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
"<exact-python>" -m pip list --format=json
|
|
83
|
+
"<exact-python>" -m pip check
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The placeholder is illustrative. Replace it with the platform-appropriate exact interpreter path. Use `importlib.metadata` or another read-only metadata method to inspect declared requirements and find reverse dependencies. Classify each target before planning removal:
|
|
87
|
+
|
|
88
|
+
- **Local to venv:** its package location is under the virtual environment's `site-packages`; it is eligible for uninstall.
|
|
89
|
+
- **Visible from external Python:** it is exposed through `--system-site-packages` or another external path; preserve it.
|
|
90
|
+
- **Global interpreter:** `sys.prefix == sys.base_prefix`; stop and do not uninstall.
|
|
91
|
+
|
|
92
|
+
Only the first case may enter the uninstall specification. If the user asks to uninstall a package visible from external Python or from a global interpreter, explicitly warn that this would modify an external or shared Python environment and stop without uninstalling it. Do not import target packages, upgrade pip, or install a helper merely to inspect the environment.
|
|
93
|
+
|
|
94
|
+
Evaluate reverse dependencies against the final proposed scope. Ignore requirements from distributions that are themselves being removed, but list every remaining distribution that requires a planned BrainX or JAX target. Do not automatically add those dependents to the uninstall command. If the target environment cannot be proven non-global, stop and request a virtual or Conda environment instead.
|
|
95
|
+
|
|
96
|
+
## 2. Confirm Optional JAX Cleanup
|
|
97
|
+
|
|
98
|
+
Ask the user to choose explicitly between:
|
|
99
|
+
|
|
100
|
+
- removing installed BrainX targets while preserving all JAX distributions; or
|
|
101
|
+
- removing installed BrainX targets and the installed distributions in the optional JAX universe.
|
|
102
|
+
|
|
103
|
+
Do not infer the choice from a CPU, CUDA, or TPU installation. Explain that pip does not record reliable ownership provenance, so removing JAX can affect unrelated software in the same environment.
|
|
104
|
+
|
|
105
|
+
If no BrainX target is installed, report that fact. Do not mutate the environment unless the user separately opts into removing installed JAX targets and confirms the resulting specification.
|
|
106
|
+
|
|
107
|
+
## 3. Present the Complete Specification
|
|
108
|
+
|
|
109
|
+
Before any uninstall command, show this structure with concrete values:
|
|
110
|
+
|
|
111
|
+
```text
|
|
112
|
+
Confirming the uninstall:
|
|
113
|
+
|
|
114
|
+
Python environment
|
|
115
|
+
- Run location:
|
|
116
|
+
- Exact Python executable:
|
|
117
|
+
- Python version:
|
|
118
|
+
- Virtual-environment path:
|
|
119
|
+
- Environment manager:
|
|
120
|
+
|
|
121
|
+
Current package state
|
|
122
|
+
- Non-target packages that depend on removal targets:
|
|
123
|
+
- Existing package-integrity issues:
|
|
124
|
+
|
|
125
|
+
Uninstall scope
|
|
126
|
+
- Exact BrainX distributions to remove:
|
|
127
|
+
- Optional JAX removal: included or excluded
|
|
128
|
+
- Exact JAX distributions to remove:
|
|
129
|
+
- Packages and resources explicitly preserved:
|
|
130
|
+
|
|
131
|
+
Planned changes
|
|
132
|
+
- Expected final package state:
|
|
133
|
+
|
|
134
|
+
Please confirm the entire uninstall specification.
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Under each exact removal field, list one installed distribution per line as `name==version`. Write `none` when a removal list, reverse-dependency list, or integrity-issue list is empty. The BrainX field may contain only installed packages from the BrainX removal list. The JAX field may contain only installed packages from the optional JAX removal list and must be `none` when optional JAX removal is excluded. The expected final state must say that the listed BrainX packages will be absent, whether JAX will be removed or preserved, and that the confirmed environment and shared dependencies will remain.
|
|
138
|
+
|
|
139
|
+
A prior general request to uninstall BrainX is not confirmation of this environment-specific specification. Do not mutate anything until the user explicitly confirms the complete, unchanged specification.
|
|
140
|
+
|
|
141
|
+
If any non-target package depends on a planned removal target, explain that the remaining package may be broken after cleanup and require explicit confirmation with that risk visible. Do not silently uninstall, repair, or reinstall the dependent package.
|
|
142
|
+
|
|
143
|
+
## 4. Execute the Confirmed Uninstall
|
|
144
|
+
|
|
145
|
+
When the confirmed BrainX field is not `none`, build its command from that exact list and run it with the confirmed interpreter. The command shape is:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
"<exact-python>" -m pip uninstall -y <installed-brainx-targets-only>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
When optional JAX cleanup was confirmed and its exact list is not `none`, build its command from that list. Run it after the BrainX command succeeds, or run it directly when the BrainX field is `none`:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
"<exact-python>" -m pip uninstall -y <installed-jax-targets-only>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Before execution, ensure each command contains exactly the names in its confirmed list. If a list or command would change, present a corrected specification and obtain new confirmation. Do not run an empty command, add an absent package, invoke `pip-autoremove`, delete site-packages entries manually, remove NVIDIA or system accelerator software, or delete the environment.
|
|
158
|
+
|
|
159
|
+
If either command fails, stop further mutation, record its exit status and relevant output, and re-inventory both removal lists. Pip uninstalls are not atomic, so report the packages successfully removed and the packages still present rather than assuming rollback.
|
|
160
|
+
|
|
161
|
+
## 5. Verify
|
|
162
|
+
|
|
163
|
+
Using the same exact interpreter:
|
|
164
|
+
|
|
165
|
+
1. Re-read installed distribution metadata for both removal lists.
|
|
166
|
+
2. Confirm every distribution in the approved uninstall commands is absent.
|
|
167
|
+
3. Confirm preserved candidates were not added to or removed from the approved scope.
|
|
168
|
+
4. Run `"<exact-python>" -m pip check` and compare its result with the pre-uninstall baseline.
|
|
169
|
+
|
|
170
|
+
Do not verify removal by importing the removed packages. Metadata absence is the authority. Report `PASS` only when every approved target is absent. Report `FAIL` if a command failed or any approved target remains. Always report new, unchanged, or resolved `pip check` issues separately; a user-approved broken reverse dependency does not count as a remaining uninstall target, but it must remain visible in the result.
|
|
171
|
+
|
|
172
|
+
## 6. Report
|
|
173
|
+
|
|
174
|
+
Report:
|
|
175
|
+
|
|
176
|
+
- run location, exact interpreter, and environment path;
|
|
177
|
+
- BrainX packages removed, with their former versions;
|
|
178
|
+
- whether JAX cleanup was excluded or the JAX packages removed;
|
|
179
|
+
- packages requested but already absent;
|
|
180
|
+
- preserved packages and resources;
|
|
181
|
+
- uninstall commands and exit statuses;
|
|
182
|
+
- verification results and the before/after `pip check` comparison;
|
|
183
|
+
- remaining BrainX or approved JAX targets, if any;
|
|
184
|
+
- final status: `PASS` or `FAIL`, with the reason.
|
|
185
|
+
|
|
186
|
+
For a no-op, state that no approved target was installed and no mutation occurred. Do not claim that shared dependencies are unused or safe to remove merely because the BrainX targets are gone.
|
|
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
|