Skip to content

Commit

Permalink
Update github actions build workflow to build and publish labextensio…
Browse files Browse the repository at this point in the history
…n and nbextension assets in JS build, then download from python build

WIP

CI passing (to be squashed)

* fix up some rebase errors
* update yarn.lock
* brute force install jupyter_packaging
* skip rebuilding/installing wheel in test_js_and_python

[removed] will it run full ci
  • Loading branch information
timkpaine committed Mar 16, 2023
1 parent 76b9b23 commit 9b56cff
Show file tree
Hide file tree
Showing 12 changed files with 1,301 additions and 180 deletions.
64 changes: 27 additions & 37 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ jobs:
################
# Python
- name: Install python dependencies
run: yarn _requires_python
run: pip install jupyter_packaging && yarn _requires_python

################
# Linux
Expand Down Expand Up @@ -401,13 +401,13 @@ jobs:
with:
name: nbextension-dist
path: python/perspective/perspective/nbextension
# if-no-files-found: error # TODO
if-no-files-found: error # TODO

- uses: actions/upload-artifact@v3
with:
name: labextension-dist
path: python/perspective/perspective/labextension
# if-no-files-found: error # TODO
if-no-files-found: error # TODO

##########################################################################################################################
##########################################################################################################################
Expand Down Expand Up @@ -509,7 +509,7 @@ jobs:
################
# Python
- name: Install python dependencies
run: yarn _requires_python
run: pip install jupyter_packaging && yarn _requires_python

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#~~~~~~~~~ Build Pipelines ~~~~~~~~~#
Expand Down Expand Up @@ -639,7 +639,7 @@ jobs:
################
# Python
- name: Install python dependencies
run: yarn _requires_python
run: pip install jupyter_packaging && yarn _requires_python

################
# Rust
Expand Down Expand Up @@ -715,7 +715,7 @@ jobs:
###################################################################
# Run JS build first, then use the artifacts in the python builds #
###################################################################
needs: [initialize]
needs: [initialize, build_js]

strategy:
# NOTE: this matrix should build wheels across all supported envs.
Expand Down Expand Up @@ -811,17 +811,15 @@ jobs:
################
# JS Artifacts #
################
# TODO
# - uses: actions/download-artifact@v3
# with:
# name: nbextension-dist
# python: python/perspective/perspective/nbextension

# TODO
# - uses: actions/download-artifact@v3
# with:
# name: labextension-dist
# python: python/perspective/perspective/labextension
- uses: actions/download-artifact@v3
with:
name: nbextension-dist
path: python/perspective/perspective/nbextension

- uses: actions/download-artifact@v3
with:
name: labextension-dist
path: python/perspective/perspective/labextension

##########
# Caches #
Expand Down Expand Up @@ -916,7 +914,7 @@ jobs:
################
# Python
- name: Install python dependencies
run: yarn _requires_python
run: pip install jupyter_packaging && yarn _requires_python
if: ${{ runner.os != 'Linux' }} # skip on manylinux2014

################
Expand Down Expand Up @@ -1096,17 +1094,15 @@ jobs:
name: perspective-viewer-dist
path: rust/perspective-viewer/dist

# TODO
# - uses: actions/download-artifact@v3
# with:
# name: nbextension-dist
# python: python/perspective/perspective/nbextension
- uses: actions/download-artifact@v3
with:
name: nbextension-dist
path: python/perspective/perspective/nbextension

# TODO
# - uses: actions/download-artifact@v3
# with:
# name: labextension-dist
# python: python/perspective/perspective/labextension
- uses: actions/download-artifact@v3
with:
name: labextension-dist
path: python/perspective/perspective/labextension

##########
# Caches #
Expand Down Expand Up @@ -1171,7 +1167,7 @@ jobs:
################
# Python
- name: Install python dependencies
run: yarn _requires_python
run: pip install jupyter_packaging && yarn _requires_python

# Download artifact
- uses: actions/download-artifact@v3
Expand All @@ -1185,12 +1181,6 @@ jobs:
- name: Install wheel (local)
run: python -m pip install -U *manylinux2014*.whl --target python/perspective

- name: Install perspective-jupyterlab extension dependencies
run: yarn jlab_link

- name: Install perspective-jupyterlab labextension
run: jupyter labextension install packages/perspective-jupyterlab --dev-build=True --no-minimize

- name: Check Installed labextensions
run: jupyter labextension list

Expand Down Expand Up @@ -1337,7 +1327,7 @@ jobs:
################
# Python
- name: Install python dependencies
run: yarn _requires_python
run: pip install jupyter_packaging && yarn _requires_python

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#~~~~~~~~~ Build Pipelines ~~~~~~~~~#
Expand Down Expand Up @@ -1475,7 +1465,7 @@ jobs:
################
# Python
- name: Install python dependencies
run: yarn _requires_python
run: pip install jupyter_packaging && yarn _requires_python

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#~~~~~~~~~ Build Pipelines ~~~~~~~~~#
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ rust/perspective-viewer/target*
rust/perspective-viewer/pkg
python/perspective/perspective/nbextension/static
python/perspective/perspective/labextension
python/perspective/wheelhouse

rust/perspective-viewer/target
rust/perspective-viewer/pkg
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@
"fix": "npm-run-all --silent fix:*",
"check_python": "node scripts/lint_python.js --check-manifest",
"version": "node scripts/version.js && python3 python/perspective/scripts/write_version.py && git add python/perspective/perspective/core/_version.py",
"jlab_link": "node scripts/jlab_link.js",
"jlab_link": "pip3 install ./python/perspective --no-build-isolation",
"repl": "node scripts/repl.js"
}
Expand Down
15 changes: 4 additions & 11 deletions packages/perspective-jupyterlab/build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const cpy_mod = import("cpy");
const { lessLoader } = require("esbuild-plugin-less");
const { WasmPlugin } = require("@finos/perspective-esbuild-plugin/wasm");
const { WorkerPlugin } = require("@finos/perspective-esbuild-plugin/worker");
const { AMDLoader } = require("@finos/perspective-esbuild-plugin/amd");
Expand All @@ -19,12 +18,6 @@ const NBEXTENSION_PATH = path.resolve(
"static"
);

const THEMES_BUILD = {
entryPoints: ["src/less/index.less"],
plugins: [WasmPlugin(false), lessLoader()],
outdir: "dist/css",
};

const TEST_BUILD = {
entryPoints: ["src/js/psp_widget.js"],
define: {
Expand All @@ -47,8 +40,7 @@ const LAB_BUILD = {
global: "window",
},
plugins: [
lessLoader(),
WasmPlugin(true),
WasmPlugin(true),
WorkerPlugin({ inline: true }),

// See note in `rust/perspective-viewer/build.js`
Expand Down Expand Up @@ -109,7 +101,9 @@ function add(builder, path, path2) {
}

const PROD_BUILD = [LAB_BUILD, ...NB_BUILDS];
const BUILD = process.argv.some((x) => x == "--test") ? TEST_BUILD : PROD_BUILD;
const BUILD = process.argv.some((x) => x == "--test")
? [TEST_BUILD]
: PROD_BUILD;

async function build_all() {
const { default: cpy } = await cpy_mod;
Expand All @@ -123,7 +117,6 @@ async function build_all() {
builder3.compile().get("index.css")
);

await build(THEMES_BUILD);
await Promise.all(BUILD.map(build)).catch(() => process.exit(1));
cpy(["dist/css/*"], "dist/umd");
cpy(["src/less/*"], "dist/less");
Expand Down
2 changes: 1 addition & 1 deletion packages/perspective-jupyterlab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"devDependencies": {
"@finos/perspective-esbuild-plugin": "^1.9.4",
"@finos/perspective-test": "^1.9.4",
"@jupyterlab/builder": "^3.4.0"
"@jupyterlab/builder": "^3.4.0",
"@prospective.co/procss": "^0.1.12",
"cpy": "^9.0.1"
},
Expand Down
5 changes: 1 addition & 4 deletions packages/perspective-jupyterlab/src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ export * from "./version";
export * from "./view";
export * from "./widget";

/* css */
import "../less/index.less";

import "@finos/perspective-viewer-datagrid";
import "@finos/perspective-viewer-d3fc";
import "@finos/perspective-viewer-openlayers/dist/umd/perspective-viewer-openlayers.js";
Expand All @@ -27,7 +24,7 @@ let plugins = [PerspectiveJupyterPlugin];

// Conditionally import renderers if running in jupyterlab only
if (window && window._JUPYTERLAB) {
const {PerspectiveRenderers} = require("./renderer");
const { PerspectiveRenderers } = require("./renderer");
plugins.push(PerspectiveRenderers);
}

Expand Down
8 changes: 1 addition & 7 deletions packages/perspective-jupyterlab/src/js/notebook/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
// url for the notebook is not known at build time and is therefore computed
// dynamically.

import THEMES from "../../../dist/css/index.css";

if (window.require) {
window.require.config({
map: {
Expand All @@ -31,8 +29,4 @@ if (window.require) {
}

// Export the required load_ipython_extension
export function load_ipython_extension() {
const style = document.createElement("style");
style.textContent = THEMES;
document.head.appendChild(style);
}
export function load_ipython_extension() {}
4 changes: 2 additions & 2 deletions packages/perspective-jupyterlab/src/js/notebook/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@

import "@finos/perspective-viewer-datagrid";
import "@finos/perspective-viewer-d3fc";
export {PerspectiveView} from "../view";
export {PerspectiveModel} from "../model";
export { PerspectiveView } from "../view";
export { PerspectiveModel } from "../model";
3 changes: 0 additions & 3 deletions packages/perspective-webpack-plugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ class PerspectiveWebpackPlugin {
test: /\.wasm$/,
include: [this.options.wasmPath, this.options.viewerPath],
type: "asset/resource",
generator: {
filename: this.options.wasmName,
},
});
} else {
rules.push({
Expand Down
2 changes: 1 addition & 1 deletion scripts/_wheel_python.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ try {

// These are system deps that may only be in place from pep-517/518 so
// lets reinstall them to be sure
cmd += `${PYTHON} -m pip install -U 'numpy>=1.13.1' jupyter_packaging wheel twine && `;
cmd += `${PYTHON} -m pip install -U 'numpy>=1.13.1' jupyter_packaging wheel twine auditwheel && `;

// remove the build folder so we completely rebuild (and pick up the
// libs we just installed above, since this build method won't use
Expand Down
2 changes: 1 addition & 1 deletion scripts/nb_link.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* the Apache License 2.0. The full license can be found in the LICENSE file.
*
*/
const {execute} = require("./script_utils.js");
const { execute } = require("./script_utils.js");
const path = require("path");

const nb_path = path.resolve(
Expand Down
Loading

0 comments on commit 9b56cff

Please sign in to comment.