Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Windows JupyterLab packaging #2705

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -244,5 +244,5 @@ rust/perspective-js/docs
rust/perspective-python/docs

.pyodide-*/
rust/perspective-python/perspective.data/data/share/jupyter/labextensions/@finos/perspective-jupyterlab/static
rust/perspective-python/perspective.data/data/share/jupyter/labextensions/@finos/perspective-jupyterlab/package.json
rust/perspective-python/*.data
# rust/perspective-python/perspective.data/data/share/jupyter/labextensions/@finos/perspective-jupyterlab/package.json
17 changes: 15 additions & 2 deletions packages/perspective-jupyterlab/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@
import cpy from "cpy";
import { WasmPlugin } from "@finos/perspective-esbuild-plugin/wasm.js";
import { WorkerPlugin } from "@finos/perspective-esbuild-plugin/worker.js";
import { AMDLoader } from "@finos/perspective-esbuild-plugin/amd.js";
// import { AMDLoader } from "@finos/perspective-esbuild-plugin/amd.js";
import { build } from "@finos/perspective-esbuild-plugin/build.js";
import * as path from "node:path";
import { BuildCss } from "@prospective.co/procss/target/cjs/procss.js";
import fs from "node:fs";
import * as fs from "node:fs";
import * as url from "node:url";
import { createRequire } from "node:module";
import { execSync } from "node:child_process";

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

await Promise.all(BUILD.map(build)).catch(() => process.exit(1));
cpy(["src/less/*"], "dist/less");
execSync("jupyter labextension build .", { stdio: "inherit" });

const pkg = JSON.parse(fs.readFileSync("../../package.json").toString());
const version = pkg.version.replace(/-(rc|alpha|beta)\.\d+/, (x) =>
x.replace("-", "").replace(".", "")
);

const psp_dir = `perspective_python-${version}.data`;
await cpy(
["dist/cjs/**/*"],
`../../rust/perspective-python/${psp_dir}/data/share/jupyter/labextensions/@finos/perspective-jupyterlab`
);
}

build_all();
7 changes: 3 additions & 4 deletions packages/perspective-jupyterlab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
"bench": "npm-run-all bench:build bench:run",
"bench:build": "echo \"No Benchmarks\"",
"bench:run": "echo \"No Benchmarks\"",
"build": "npm-run-all build:js build:labextension",
"build:js": "node build.mjs",
"build:labextension": "jupyter labextension build .",
"build": "node build.mjs",
"clean": "npm-run-all clean:*",
"clean:dist": "rimraf dist",
"clean:lib": "rimraf lib",
Expand All @@ -49,13 +47,14 @@
"@finos/perspective-esbuild-plugin": "workspace:^",
"@finos/perspective-test": "workspace:^",
"@jupyterlab/builder": "^4",
"copy-webpack-plugin": "~12",
"@prospective.co/procss": "^0.1.15",
"cpy": "^9.0.1"
},
"jupyterlab": {
"webpackConfig": "./webpack.config.js",
"extension": true,
"outputDir": "../../rust/perspective-python/perspective.data/data/share/jupyter/labextensions/@finos/perspective-jupyterlab",
"outputDir": "./dist/cjs",
"sharedPackages": {
"@jupyter-widgets/base": {
"bundled": false,
Expand Down
5 changes: 1 addition & 4 deletions packages/perspective-jupyterlab/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ module.exports = {
},
plugins: [
new CopyPlugin({
patterns: [
{ from: "./install.json", to: "../install.json" },
// { from: "other", to: "public" },
],
patterns: [{ from: "./install.json", to: "../install.json" }],
}),
],
};
56 changes: 56 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions rust/perspective-python/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

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

let flags = "--release";
if (!!process.env.PSP_DEBUG) {
Expand All @@ -25,6 +27,12 @@ const opts = {
},
};

const version = pkg.version.replace(/-(rc|alpha|beta)\.\d+/, (x) =>
x.replace("-", "").replace(".", "")
);

fs.mkdirSync(`./perspective_python-${version}.data`, { recursive: true });

const build_wheel = !!process.env.PSP_BUILD_WHEEL;
const build_sdist = !!process.env.PSP_BUILD_SDIST;

Expand Down

This file was deleted.

3 changes: 1 addition & 2 deletions rust/perspective-python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ build-backend = "maturin"

[project]
name = "perspective-python"
version = "3.0.0-rc1"
requires-python = ">=3.9"
dynamic = ["version"]
classifiers = [
Expand All @@ -26,7 +25,7 @@ classifiers = [

[tool.maturin]
module-name = "perspective"
data = "perspective.data"
data = "perspective_python-3.0.0rc1.data"
features = ["pyo3/extension-module"]

[tool.pytest.ini_options]
Expand Down
22 changes: 11 additions & 11 deletions tools/perspective-scripts/repack_wheel.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@

import { execSync } from "node:child_process";
import * as fs from "node:fs";
import * as path from "node:path";
import pkg from "../../package.json" assert { type: "json" };

const __dirname = new URL(".", import.meta.url).pathname;

const wheel_file = fs.readdirSync(".").filter((x) => x.endsWith(".whl"))[0];
const pkg_name = wheel_file.split("-").slice(0, 2).join("-");
execSync(`wheel unpack ${wheel_file}`);

fs.cpSync(
path.join(__dirname, "../../rust/perspective-python/perspective.data"),
`${pkg_name}/perspective_python-${pkg.version.replace(/-rc\.\d+/, (x) =>
x.replace("-", "").replace(".", "")
)}.data`,
{ recursive: true }
const pkg_name = wheel_file.split("-").slice(0, 2).join("-");
const version = pkg.version.replace(/-(rc|alpha|beta)\.\d+/, (x) =>
x.replace("-", "").replace(".", "")
);

const dest = `${pkg_name}/perspective_python-${version}.data`;
const src = `rust/perspective-python/perspective_python-${version}.data`;
fs.cpSync(src, dest, {
recursive: true,
});

execSync(`wheel pack ${pkg_name}`);

// what kind of customers
texodus marked this conversation as resolved.
Show resolved Hide resolved
Loading