celldega 0.1.3

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/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "celldega",
3
+ "version": "0.1.3",
4
+ "type": "module",
5
+ "scripts": {
6
+ "dev": "npm run build -- --sourcemap=inline --watch",
7
+ "build": "node build.js"
8
+ },
9
+ "dependencies": {
10
+ "deck.gl": "^9.0.5",
11
+ "apache-arrow": "15.0.2",
12
+ "math.gl": "2.3.3",
13
+ "@loaders.gl/core": "4.1.1"
14
+ },
15
+ "devDependencies": {
16
+ "esbuild": "^0.20.0"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/yourusername/your-repo.git"
21
+ },
22
+ "main": "src/static/widget.js"
23
+ }
package/pyproject.toml ADDED
@@ -0,0 +1,31 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "celldega"
7
+ version = "0.1.3"
8
+ dependencies = ["anywidget"]
9
+ readme = "README.md"
10
+
11
+ [project.optional-dependencies]
12
+ dev = ["watchfiles", "jupyterlab"]
13
+
14
+ # automatically add the dev feature to the default env (e.g., hatch shell)
15
+ [tool.hatch.envs.default]
16
+ features = ["dev"]
17
+
18
+
19
+ [tool.hatch.build]
20
+ only-packages = true
21
+ artifacts = ["src/celldega/static/*"]
22
+
23
+ [tool.hatch.build.hooks.jupyter-builder]
24
+ build-function = "hatch_jupyter_builder.npm_builder"
25
+ ensured-targets = ["src/celldega/static/widget.js"]
26
+ skip-if-exists = ["src/celldega/static/widget.js"]
27
+ dependencies = ["hatch-jupyter-builder>=0.5.0"]
28
+
29
+ [tool.hatch.build.hooks.jupyter-builder.build-kwargs]
30
+ npm = "npm"
31
+ build_cmd = "build"
@@ -0,0 +1,25 @@
1
+ import importlib.metadata
2
+ import pathlib
3
+
4
+ import anywidget
5
+ import traitlets
6
+ from traitlets import Unicode, Int, Float
7
+
8
+ try:
9
+ __version__ = importlib.metadata.version("celldega")
10
+ except importlib.metadata.PackageNotFoundError:
11
+ __version__ = "unknown"
12
+
13
+
14
+ class Counter(anywidget.AnyWidget):
15
+ _esm = pathlib.Path(__file__).parent / "static" / "widget.js"
16
+ _css = pathlib.Path(__file__).parent / "static" / "widget.css"
17
+ # value = traitlets.Int(0).tag(sync=True)
18
+
19
+ ini_x = Float(4500).tag(sync=True)
20
+ ini_y = Float(3200).tag(sync=True)
21
+ ini_zoom = Float(0).tag(sync=True)
22
+ max_image_zoom = Int(16).tag(sync=True)
23
+ bounce_time = Int(200).tag(sync=True)
24
+ token_traitlet = Unicode('token').tag(sync=True)
25
+ base_url = Unicode('').tag(sync=True)
@@ -0,0 +1,39 @@
1
+ // wasm-plugin.js
2
+ import * as esbuild from 'esbuild';
3
+ import path from 'node:path';
4
+ import fs from 'node:fs';
5
+
6
+ let wasmPlugin = {
7
+ name: 'wasm',
8
+ setup(build) {
9
+ build.onResolve({ filter: /\.wasm$/ }, args => {
10
+ if (args.namespace === 'wasm-stub') {
11
+ return {
12
+ path: args.path,
13
+ namespace: 'wasm-binary',
14
+ };
15
+ }
16
+ if (args.resolveDir === '') {
17
+ return; // Ignore unresolvable paths
18
+ }
19
+ return {
20
+ path: path.isAbsolute(args.path) ? args.path : path.join(args.resolveDir, args.path),
21
+ namespace: 'wasm-stub',
22
+ };
23
+ });
24
+
25
+ build.onLoad({ filter: /.*/, namespace: 'wasm-stub' }, async (args) => ({
26
+ contents: `import wasm from ${JSON.stringify(args.path)}
27
+ export default (imports) =>
28
+ WebAssembly.instantiate(wasm, imports).then(
29
+ result => result.instance.exports)`,
30
+ }));
31
+
32
+ build.onLoad({ filter: /.*/, namespace: 'wasm-binary' }, async (args) => ({
33
+ contents: await fs.promises.readFile(args.path),
34
+ loader: 'binary',
35
+ }));
36
+ },
37
+ };
38
+
39
+ export default wasmPlugin;