Skip to content

Commit

Permalink
Add some fixes to enable prebuilt in classic notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
timkpaine committed Mar 16, 2023
1 parent 0c334fb commit 7f28567
Show file tree
Hide file tree
Showing 13 changed files with 90 additions and 77 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ python/perspective/perspective/tests/table/psp_test
python/perspective/perspective/node/assets/*
/__pycache__
python/perspective/pip-wheel-metadata
python/perspective/README.md
python/perspective/python_junit.xml
python/perspective/coverage.xml
python/perspective/bench/stresstest/results
Expand Down
11 changes: 8 additions & 3 deletions packages/perspective-jupyterlab/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ const NB_BUILDS = [
define: {
global: "window",
},
plugins: [WasmPlugin(true), WorkerPlugin(true), AMDLoader([])],
plugins: [
WasmPlugin(true),
WorkerPlugin({ inline: true }),
AMDLoader([]),
],
loader: {
".ttf": "file",
".css": "text",
Expand All @@ -78,13 +82,14 @@ const NB_BUILDS = [
},
plugins: [
WasmPlugin(true),
WorkerPlugin(true),
AMDLoader([`@jupyter-widgets/base`]),
WorkerPlugin({ inline: true }),
AMDLoader(["@jupyter-widgets/base"]),
],
external: ["@jupyter*"],
format: "cjs",
loader: {
".ttf": "file",
".css": "text",
},
outfile: path.join(NBEXTENSION_PATH, "index.js"),
},
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 @@ -42,7 +42,7 @@
"@finos/perspective-viewer-d3fc": "^1.9.4",
"@finos/perspective-viewer-datagrid": "^1.9.4",
"@finos/perspective-viewer-openlayers": "^1.9.4",
"@jupyter-widgets/base": "^6",
"@jupyter-widgets/base": "^2 || ^3 || ^4 || ^5 || ^6",
"@jupyterlab/application": "^3.6.1",
"@lumino/application": "^1.27.0",
"@lumino/widgets": "^1.37.0"
Expand Down
8 changes: 7 additions & 1 deletion packages/perspective-jupyterlab/src/js/notebook/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
// url for the notebook is not known at build time and is therefore computed
// dynamically.

import THEMES from "../../../dist/css/perspective-jupyterlab.css";

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

// Export the required load_ipython_extension
export function load_ipython_extension() {}
exports.load_ipython_extension = () => {
const style = document.createElement("style");
style.textContent = THEMES;
document.head.appendChild(style);
};
9 changes: 7 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,10 @@

import "@finos/perspective-viewer-datagrid";
import "@finos/perspective-viewer-d3fc";
export { PerspectiveView } from "../view";
export { PerspectiveModel } from "../model";
import "@finos/perspective-viewer-openlayers/dist/umd/perspective-viewer-openlayers.js";

import { PerspectiveView } from "../view";
import { PerspectiveModel } from "../model";

exports.PerspectiveModel = PerspectiveModel;
exports.PerspectiveView = PerspectiveView;
1 change: 1 addition & 0 deletions python/perspective/README.md
5 changes: 5 additions & 0 deletions python/perspective/perspective/extension/install.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"packageManager": "python",
"packageName": "perspective-python",
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package perspective-python"
}
13 changes: 12 additions & 1 deletion python/perspective/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,19 @@ requires = [
"setuptools",
"wheel",
"numpy>=1.13.1,<2",
"jupyter-packaging==0.12.0",
"jupyter-packaging==0.12.3",
]
build-backend = "jupyter_packaging.build_api"

[tool.black]
exclude = "perspective/tests/*"

[tool.check-manifest]
ignore = [
"dist/**",
"perspective/table/*.so",
"perspective/table/*.pyd",
"perspective/table/*.dll",
"perspective/labextension/**",
"perspective/nbextension/perspective-nbextension.js ",
]
10 changes: 0 additions & 10 deletions python/perspective/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,3 @@ per-file-ignores =
asyncio_mode=strict
testpaths =
perspective/tests

[check-manifest]
# ignore files legitimately missing in VCS
ignore =
dist/**
perspective/table/*.so
perspective/table/*.pyd
perspective/table/*.dll
perspective/labextension/**
perspective/nbextension/perspective-nbextension.js
53 changes: 22 additions & 31 deletions python/perspective/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import sysconfig
from codecs import open
from distutils.version import LooseVersion
from jupyter_packaging import get_data_files, wrap_installers, get_version

from setuptools import Extension, find_packages, setup
from setuptools.command.build_ext import build_ext
Expand All @@ -28,14 +29,6 @@
except ImportError:
raise Exception("Requires Python 3.7 or later")

# try/except on jupyter_packaging to allow setup.py to be evaluated
try:
from jupyter_packaging import get_version
except ImportError:

def get_version(file):
return "0.0.0"


here = os.path.abspath(os.path.dirname(__file__))
nb_path = os.path.join("perspective", "nbextension", "static")
Expand Down Expand Up @@ -309,31 +302,28 @@ def run_check(self):
"perspective/labextension",
"**",
),
# Labextension install command
(
"share/jupyter/labextensions/@finos/perspective-jupyterlab",
"perspective/extension",
"install.json",
),
]

try:
from jupyter_packaging import (
combine_commands,
create_cmdclass,
ensure_targets,
)

cmdclass = create_cmdclass("js", data_files_spec=data_files_spec)
cmdclass["js"] = combine_commands(
ensure_targets(
[]
if SKIP_JS_FILES
else [
os.path.join("perspective", "nbextension", "static", "index.js"),
os.path.join("perspective", "labextension", "package.json"),
os.path.join("perspective", "labextension", "static", "style.js"),
]
),
)
cmdclass["build_ext"] = PSPBuild
cmdclass["sdist"] = combine_commands(cmdclass["sdist"], PSPCheckSDist)
except ImportError:
cmdclass = {}
ensured_targets = (
[]
if SKIP_JS_FILES
else [
os.path.join("perspective", "nbextension", "static", "index.js"),
os.path.join("perspective", "labextension", "package.json"),
os.path.join("perspective", "labextension", "static", "style.js"),
]
)

cmdclass = {}
cmdclass["js"] = wrap_installers(ensured_targets=ensured_targets)
cmdclass["build_ext"] = PSPBuild
cmdclass["sdist"] = PSPCheckSDist


setup(
Expand All @@ -355,6 +345,7 @@ def run_check(self):
],
keywords="analytics tools plotting",
packages=find_packages(exclude=["bench", "bench.*"]),
data_files=get_data_files(data_files_spec),
include_package_data=True,
zip_safe=False,
python_requires=">=3.7",
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint_python.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ try {
let cmd;
let lint_cmd = "flake8 perspective bench setup.py";
let fix_cmd = "black perspective bench setup.py --exclude tests";
let check_cmd = "check-manifest";
let check_cmd = "check-manifest -v .";

if (CMD_TYPE === "fix") {
cmd = fix_cmd;
Expand Down
5 changes: 2 additions & 3 deletions scripts/script_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,13 +449,12 @@ exports.copy_files_to_python_folder = () => {
const dist = resolve`${__dirname}/../python/perspective/dist`;
const cpp = resolve`${__dirname}/../cpp/perspective/src`;
const cmakelists = resolve`${__dirname}/../cpp/perspective/CMakeLists.txt`;
const lic = resolve`${__dirname}/../LICENSE`;
const readme = resolve`${__dirname}/../README.md`;

const cmake = resolve`${__dirname}/../cmake`;
const dcmake = resolve`${dist}/cmake`;

const lic = resolve`${__dirname}/../LICENSE`;
const dlic = resolve`${dist}/LICENSE`;
const dreadme = resolve`${dist}/../README.md`;

fse.mkdirpSync(dist);
fse.copySync(cmakelists, resolve`${dist}/CMakeLists.txt`, {
Expand Down
47 changes: 24 additions & 23 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3271,18 +3271,19 @@
dependencies:
lodash "^4.17.21"

"@jupyter-widgets/base@^6":
version "6.0.2"
resolved "https://registry.yarnpkg.com/@jupyter-widgets/base/-/base-6.0.2.tgz#ee6e614eb70f2593fce61eea8731217d869c5a2a"
integrity sha512-CIVjSTrqQFzkg9VCdDjrjDqwbba3eZfNigCPFSuKmMVXc+ATAOFczOv9/9uaCPzQ+E+0g6SOLhJ25SpKB0cl9g==
"@jupyter-widgets/base@^2 || ^3 || ^4 || ^5 || ^6":
version "4.1.2"
resolved "https://registry.yarnpkg.com/@jupyter-widgets/base/-/base-4.1.2.tgz#b0b1d94232b8e54c77d11c21de4127ca2e22fd69"
integrity sha512-URaQ6rUR0ZC1G1g0pSZHcV8W9x5pK/FnC/zSF5/i2QHmjLVfwVRBFt7a8VL88xZG8V4G8tOIDZTTg1NZcHfB0A==
dependencies:
"@jupyterlab/services" "^6.0.0"
"@lumino/coreutils" "^1.11.1"
"@lumino/messaging" "^1.10.1"
"@lumino/widgets" "^1.30.0"
"@types/backbone" "1.4.14"
"@lumino/coreutils" "^1.2.0"
"@lumino/messaging" "^1.2.1"
"@lumino/widgets" "^1.3.0"
"@types/backbone" "^1.4.1"
"@types/lodash" "^4.14.134"
backbone "1.4.0"
backbone "1.2.3"
base64-js "^1.2.1"
jquery "^3.1.1"
lodash "^4.17.4"

Expand Down Expand Up @@ -3804,7 +3805,7 @@
resolved "https://registry.yarnpkg.com/@lumino/coreutils/-/coreutils-1.12.0.tgz#fbdef760f736eaf2bd396a5c6fc3a68a4b449b15"
integrity sha512-DSglh4ylmLi820CNx9soJmDJCpUgymckdWeGWuN0Ash5g60oQvrQDfosVxEhzmNvtvXv45WZEqSBzDP6E5SEmQ==

"@lumino/coreutils@^1.11.0 || ^2.0.0-alpha.6", "@lumino/coreutils@^1.11.1", "@lumino/coreutils@^1.12.1":
"@lumino/coreutils@^1.11.0 || ^2.0.0-alpha.6", "@lumino/coreutils@^1.12.1", "@lumino/coreutils@^1.2.0":
version "1.12.1"
resolved "https://registry.yarnpkg.com/@lumino/coreutils/-/coreutils-1.12.1.tgz#79860c9937483ddf6cda87f6c2b9da8eb1a5d768"
integrity sha512-JLu3nTHzJk9N8ohZ85u75YxemMrmDzJdNgZztfP7F7T7mxND3YVNCkJG35a6aJ7edu1sIgCjBxOvV+hv27iYvQ==
Expand Down Expand Up @@ -3869,7 +3870,7 @@
"@lumino/algorithm" "^1.9.1"
"@lumino/collections" "^1.9.1"

"@lumino/messaging@^1.10.3":
"@lumino/messaging@^1.10.3", "@lumino/messaging@^1.2.1":
version "1.10.3"
resolved "https://registry.yarnpkg.com/@lumino/messaging/-/messaging-1.10.3.tgz#b6227bdfc178a8542571625ecb68063691b6af3c"
integrity sha512-F/KOwMCdqvdEG8CYAJcBSadzp6aI7a47Fr60zAKGqZATSRRRV41q53iXU7HjFPqQqQIvdn9Z7J32rBEAyQAzww==
Expand Down Expand Up @@ -3934,7 +3935,7 @@
dependencies:
"@lumino/algorithm" "^1.9.2"

"@lumino/widgets@^1.30.0", "@lumino/widgets@^1.37.0", "@lumino/widgets@^1.37.1":
"@lumino/widgets@^1.3.0", "@lumino/widgets@^1.37.0", "@lumino/widgets@^1.37.1":
version "1.37.1"
resolved "https://registry.yarnpkg.com/@lumino/widgets/-/widgets-1.37.1.tgz#d7a2398b276e15e60aff4fec58c035d46549a75b"
integrity sha512-/whz5B/hL0fjv0bR8JYZ+Emx+CH7HBwXc4TqI9PrrHGm3g6+jRJAyIFGZcQubqkPxxHrRE/VxQgoDKGhINw/Gw==
Expand Down Expand Up @@ -4536,10 +4537,10 @@
dependencies:
"@babel/types" "^7.3.0"

"@types/[email protected].14":
version "1.4.14"
resolved "https://registry.yarnpkg.com/@types/backbone/-/backbone-1.4.14.tgz#4b71f0c25d89cfa9a10b18042f0b03d35a53364c"
integrity sha512-85ldQ99fiYTJFBlZuAJRaCdvTZKZ2p1fSs3fVf+6Ub6k1X0g0hNJ0qJ/2FOByyyAQYLtbEz3shX5taKQfBKBDw==
"@types/backbone@^1.4.1":
version "1.4.15"
resolved "https://registry.yarnpkg.com/@types/backbone/-/backbone-1.4.15.tgz#505323ab8fea11ecaec74cb3f73d569a4e5eb779"
integrity sha512-WWeKtYlsIMtDyLbbhkb96taJMEbfQBnuz7yw1u0pkphCOtksemoWhIXhK74VRCY9hbjnsH3rsJu2uUiFtnsEYg==
dependencies:
"@types/jquery" "*"
"@types/underscore" "*"
Expand Down Expand Up @@ -5976,12 +5977,12 @@ babel-preset-jest@^25.5.0:
babel-plugin-jest-hoist "^25.5.0"
babel-preset-current-node-syntax "^0.1.2"

backbone@1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/backbone/-/backbone-1.4.0.tgz#54db4de9df7c3811c3f032f34749a4cd27f3bd12"
integrity sha512-RLmDrRXkVdouTg38jcgHhyQ/2zjg7a8E6sz2zxfz21Hh17xDJYUHBZimVIt5fUyS8vbfpeSmTL3gUjTEvUV3qQ==
backbone@1.2.3:
version "1.2.3"
resolved "https://registry.yarnpkg.com/backbone/-/backbone-1.2.3.tgz#c22cfd07fc86ebbeae61d18929ed115e999d65b9"
integrity sha512-1/eXj4agG79UDN7TWnZXcGD6BJrBwLZKCX7zYcBIy9jWf4mrtVkw7IE1VOYFnrKahsmPF9L55Tib9IQRvk027w==
dependencies:
underscore ">=1.8.3"
underscore ">=1.7.0"

bail@^1.0.0:
version "1.0.5"
Expand All @@ -6003,7 +6004,7 @@ base16@^1.0.0:
resolved "https://registry.yarnpkg.com/base16/-/base16-1.0.0.tgz#e297f60d7ec1014a7a971a39ebc8a98c0b681e70"
integrity sha512-pNdYkNPiJUnEhnfXV56+sQy8+AaPcG3POZAUnwr4EeqCUZFz4u2PePbo3e5Gj4ziYPCWGUZT9RHisvJKnwFuBQ==

base64-js@^1.0.2, base64-js@^1.2.3, base64-js@^1.3.1:
base64-js@^1.0.2, base64-js@^1.2.1, base64-js@^1.2.3, base64-js@^1.3.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
Expand Down Expand Up @@ -17794,7 +17795,7 @@ [email protected], unbzip2-stream@^1.0.9:
buffer "^5.2.1"
through "^2.3.8"

underscore@>=1.8.3, underscore@~1.13.2:
underscore@>=1.7.0, underscore@~1.13.2:
version "1.13.6"
resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.6.tgz#04786a1f589dc6c09f761fc5f45b89e935136441"
integrity sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==
Expand Down

0 comments on commit 7f28567

Please sign in to comment.