Add variant option (atomify wasm in the kernel) and ship python/ in the npm tarball#92
Merged
Conversation
The client (and the Python bindings) could only load the serial or the
KOKKOS wasm build; the full-package atomify build shipped under
./wasm-atomify but had no LammpsClient / lammps() entry point, so the
Pyodide kernel could not use it.
- client.ts: new `variant` option ("serial" | "kokkos" | "atomify")
selects the wasm module. An explicit variant takes precedence over the
`kokkos` flag; `kokkos: true` stays equivalent to variant "kokkos".
Since the atomify build is itself a KOKKOS/pthreads build, both
threaded variants start LAMMPS with `-k on t N [-sf kk]` (tunable via
the `kokkos` option) and require cross-origin isolation in browsers.
- worker path: `variant` is forwarded through LammpsWorkerClient, the
init protocol message, and the worker host.
- python/lammps/__init__.py: `lammps(variant=...)` mirrors the client
option; the COI check now covers every threaded variant and the shared
wasm-module cache is keyed per (client URL, variant). Reused sessions
now also get the client options, so threaded restarts keep their
Kokkos start args.
- types/client.d.ts: declare KokkosOptions, LammpsVariant, and the new
client options.
- tests: variant precedence + Kokkos start args in client.unit.spec.ts,
init forwarding in worker-host.spec.ts, and an end-to-end
variant:"atomify" test in atomify.spec.ts (runs under test:atomify).
- docs: README, python/README, NOTEBOOK_TUTORIALS notes on the new
option replacing the "no client entry point for atomify" caveat.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add python/lammps, python/pyproject.toml, and python/README.md to the package files so consumers (Atomify CI) can build the lammps-js wheel straight from node_modules/lammps.js/python without cloning this repo. The entries are listed individually so local build artifacts (python/build/, python/lammps_js.egg-info/) never leak into the tarball. Bump the wheel version 1.5.0 -> 1.5.1 to match the npm package version it is developed against. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Minor bump: adds the backward-compatible variant option (serial | kokkos | atomify) and ships python/ in the npm tarball so consumers can build the lammps-js wheel from the installed package. Triggers release.yml to publish 1.6.0 on merge to master. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two coupled changes that Atomify needs from lammps.js.
1.
variant: "serial" | "kokkos" | "atomify"client optionThe full-package atomify wasm build already ships in the npm tarball (
./wasm-atomify, built byPACKAGES=atomify python3 cpp/build.py), but neitherLammpsClientnor the Python bindings could load it — so the Pyodide kernel was stuck on the MOLECULE-only serial build.variantselects the wasm module (lammps.js,lammps-kokkos.js, orlammps-atomify.js). Precedence: an explicitvariantwins over thekokkosflag;kokkos: trueremains equivalent tovariant: "kokkos"(full back-compat). Since the atomify build is itself a KOKKOS/pthreads build, both threaded variants start LAMMPS with-k on t N [-sf kk](threads/suffix still tunable via thekokkosoption) and require a cross-origin isolated context in browsers.variantis forwarded throughLammpsWorkerClient, the worker init protocol message, and the worker host.await lammps(variant="atomify")mirrors the client option. The crossOriginIsolated check now covers every threaded variant, and the shared wasm-module cache is keyed per (client URL, variant) so serial/kokkos/atomify sessions don't collide. Reused sessions now also receive the client options, so threaded restarts keep their Kokkos start args.KokkosOptions,LammpsVariant, and the new options.2. Ship
python/in the npm tarball + version alignmentpython/lammps,python/pyproject.toml, andpython/README.mdare added to the packagefiles, so consumers can build thelammps-jswheel directly fromnode_modules/lammps.js/pythonwithout cloning this repo. The entries are listed individually so local build artifacts (python/build/,python/lammps_js.egg-info/) can never leak into the tarball. The wheel version is bumped 1.5.0 → 1.5.1 to match the npm package version exactly.Why Atomify needs this
Atomify's JupyterLite kernel runs the lammps.js Python bindings on top of the wasm engine. Its example library needs the full package set (MANYBODY, KSPACE, REAXFF, GRANULAR, …), which only the atomify build provides —
variant="atomify"lets the kernel run it. Shippingpython/in the tarball lets Atomify CI build the wheel fromnode_modulesinstead of vendoring it. After this merges and a release is cut, Atomify can drop its vendored-wheel version pin.Tests
test:kokkos/test:atomify).client.unit.spec.ts), init-message forwarding (worker-host.spec.ts), and an end-to-endvariant: "atomify"client test inatomify.spec.ts.npm pack --dry-runverified: the tarball gains exactlypython/lammps/__init__.py,python/pyproject.toml,python/README.md.🤖 Generated with Claude Code