Skip to content

Commit 92ecdc9

Browse files
authored
Merge pull request #2705 from finos/fix-jlab-win
Fix Windows JupyterLab packaging
2 parents 9a07402 + a3279e8 commit 92ecdc9

File tree

9 files changed

+97
-30
lines changed

9 files changed

+97
-30
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,5 +244,5 @@ rust/perspective-js/docs
244244
rust/perspective-python/docs
245245

246246
.pyodide-*/
247-
rust/perspective-python/perspective.data/data/share/jupyter/labextensions/@finos/perspective-jupyterlab/static
248-
rust/perspective-python/perspective.data/data/share/jupyter/labextensions/@finos/perspective-jupyterlab/package.json
247+
rust/perspective-python/*.data
248+
# rust/perspective-python/perspective.data/data/share/jupyter/labextensions/@finos/perspective-jupyterlab/package.json

packages/perspective-jupyterlab/build.mjs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@
1313
import cpy from "cpy";
1414
import { WasmPlugin } from "@finos/perspective-esbuild-plugin/wasm.js";
1515
import { WorkerPlugin } from "@finos/perspective-esbuild-plugin/worker.js";
16-
import { AMDLoader } from "@finos/perspective-esbuild-plugin/amd.js";
16+
// import { AMDLoader } from "@finos/perspective-esbuild-plugin/amd.js";
1717
import { build } from "@finos/perspective-esbuild-plugin/build.js";
1818
import * as path from "node:path";
1919
import { BuildCss } from "@prospective.co/procss/target/cjs/procss.js";
20-
import fs from "node:fs";
20+
import * as fs from "node:fs";
2121
import * as url from "node:url";
2222
import { createRequire } from "node:module";
23+
import { execSync } from "node:child_process";
2324

2425
const _require = createRequire(import.meta.url);
2526
const __dirname = url.fileURLToPath(new URL(".", import.meta.url)).slice(0, -1);
@@ -130,6 +131,18 @@ async function build_all() {
130131

131132
await Promise.all(BUILD.map(build)).catch(() => process.exit(1));
132133
cpy(["src/less/*"], "dist/less");
134+
execSync("jupyter labextension build .", { stdio: "inherit" });
135+
136+
const pkg = JSON.parse(fs.readFileSync("../../package.json").toString());
137+
const version = pkg.version.replace(/-(rc|alpha|beta)\.\d+/, (x) =>
138+
x.replace("-", "").replace(".", "")
139+
);
140+
141+
const psp_dir = `perspective_python-${version}.data`;
142+
await cpy(
143+
["dist/cjs/**/*"],
144+
`../../rust/perspective-python/${psp_dir}/data/share/jupyter/labextensions/@finos/perspective-jupyterlab`
145+
);
133146
}
134147

135148
build_all();

packages/perspective-jupyterlab/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
"bench": "npm-run-all bench:build bench:run",
2121
"bench:build": "echo \"No Benchmarks\"",
2222
"bench:run": "echo \"No Benchmarks\"",
23-
"build": "npm-run-all build:js build:labextension",
24-
"build:js": "node build.mjs",
25-
"build:labextension": "jupyter labextension build .",
23+
"build": "node build.mjs",
2624
"clean": "npm-run-all clean:*",
2725
"clean:dist": "rimraf dist",
2826
"clean:lib": "rimraf lib",
@@ -49,13 +47,14 @@
4947
"@finos/perspective-esbuild-plugin": "workspace:^",
5048
"@finos/perspective-test": "workspace:^",
5149
"@jupyterlab/builder": "^4",
50+
"copy-webpack-plugin": "~12",
5251
"@prospective.co/procss": "^0.1.15",
5352
"cpy": "^9.0.1"
5453
},
5554
"jupyterlab": {
5655
"webpackConfig": "./webpack.config.js",
5756
"extension": true,
58-
"outputDir": "../../rust/perspective-python/perspective.data/data/share/jupyter/labextensions/@finos/perspective-jupyterlab",
57+
"outputDir": "./dist/cjs",
5958
"sharedPackages": {
6059
"@jupyter-widgets/base": {
6160
"bundled": false,

packages/perspective-jupyterlab/webpack.config.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ module.exports = {
1818
},
1919
plugins: [
2020
new CopyPlugin({
21-
patterns: [
22-
{ from: "./install.json", to: "../install.json" },
23-
// { from: "other", to: "public" },
24-
],
21+
patterns: [{ from: "./install.json", to: "../install.json" }],
2522
}),
2623
],
2724
};

pnpm-lock.yaml

Lines changed: 56 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/perspective-python/build.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
1212

1313
import { execSync } from "child_process";
14+
import * as fs from "node:fs";
15+
import pkg from "./package.json" assert { type: "json" };
1416

1517
let flags = "--release";
1618
if (!!process.env.PSP_DEBUG) {
@@ -25,6 +27,12 @@ const opts = {
2527
},
2628
};
2729

30+
const version = pkg.version.replace(/-(rc|alpha|beta)\.\d+/, (x) =>
31+
x.replace("-", "").replace(".", "")
32+
);
33+
34+
fs.mkdirSync(`./perspective_python-${version}.data`, { recursive: true });
35+
2836
const build_wheel = !!process.env.PSP_BUILD_WHEEL;
2937
const build_sdist = !!process.env.PSP_BUILD_SDIST;
3038

rust/perspective-python/perspective.data/data/share/jupyter/labextensions/@finos/perspective-jupyterlab/install.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

rust/perspective-python/pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ build-backend = "maturin"
1616

1717
[project]
1818
name = "perspective-python"
19-
version = "3.0.0-rc1"
2019
requires-python = ">=3.9"
2120
dynamic = ["version"]
2221
classifiers = [
@@ -26,7 +25,7 @@ classifiers = [
2625

2726
[tool.maturin]
2827
module-name = "perspective"
29-
data = "perspective.data"
28+
data = "perspective_python-3.0.0rc1.data"
3029
features = ["pyo3/extension-module"]
3130

3231
[tool.pytest.ini_options]

tools/perspective-scripts/repack_wheel.mjs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@
1212

1313
import { execSync } from "node:child_process";
1414
import * as fs from "node:fs";
15-
import * as path from "node:path";
1615
import pkg from "../../package.json" assert { type: "json" };
1716

18-
const __dirname = new URL(".", import.meta.url).pathname;
19-
2017
const wheel_file = fs.readdirSync(".").filter((x) => x.endsWith(".whl"))[0];
21-
const pkg_name = wheel_file.split("-").slice(0, 2).join("-");
2218
execSync(`wheel unpack ${wheel_file}`);
23-
24-
fs.cpSync(
25-
path.join(__dirname, "../../rust/perspective-python/perspective.data"),
26-
`${pkg_name}/perspective_python-${pkg.version.replace(/-rc\.\d+/, (x) =>
27-
x.replace("-", "").replace(".", "")
28-
)}.data`,
29-
{ recursive: true }
19+
const pkg_name = wheel_file.split("-").slice(0, 2).join("-");
20+
const version = pkg.version.replace(/-(rc|alpha|beta)\.\d+/, (x) =>
21+
x.replace("-", "").replace(".", "")
3022
);
3123

24+
const dest = `${pkg_name}/perspective_python-${version}.data`;
25+
const src = `rust/perspective-python/perspective_python-${version}.data`;
26+
fs.cpSync(src, dest, {
27+
recursive: true,
28+
});
29+
3230
execSync(`wheel pack ${pkg_name}`);
31+
32+
// what kind of customers

0 commit comments

Comments
 (0)