diff --git a/.github/PULL_REQUEST_TEMPLATE/Documentation.md b/.github/PULL_REQUEST_TEMPLATE/Documentation.md index 901684c595..9574b2df55 100644 --- a/.github/PULL_REQUEST_TEMPLATE/Documentation.md +++ b/.github/PULL_REQUEST_TEMPLATE/Documentation.md @@ -12,18 +12,18 @@ about: Improves documentation for the API or on the docs website. - [ ] I have linted, spell-checked, and grammar-checked my documentation additions. -- [ ] I have run `yarn docs` to regenerate the API documentation from source. -- [ ] Within `/docs`, I have run `yarn start` to regenerate the Docusaurus site, and I have validated the changes +- [ ] I have run `pnpm run docs` to regenerate the API documentation from source. +- [ ] Within `/docs`, I have run `pnpm run start` to regenerate the Docusaurus site, and I have validated the changes - [ ] My additions are styled and structured correctly on the Docusaurus site ## Checklist diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 008b23b7f3..d4f37dc9d5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -85,7 +85,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: # for pull_request so we can do HEAD^2 fetch-depth: 2 @@ -191,7 +191,7 @@ jobs: - ubuntu-22.04 # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md python-version: - 3.9 - node-version: [18.x] + node-version: [20.x] # NOTE: don't fail fast as sometimes npm blocks the burst of fetches from GHA fail-fast: false @@ -203,7 +203,7 @@ jobs: steps: - name: Clean System - uses: AdityaGarg8/remove-unwanted-software@v2 + uses: AdityaGarg8/remove-unwanted-software@v3 if: ${{ runner.os == 'Linux' }} with: remove-android: "true" @@ -212,33 +212,21 @@ jobs: remove-codeql: "true" - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 ########## # Caches # ########## - ################ - # Yarn Cache - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - shell: bash - if: ${{ needs.initialize.outputs.SKIP_CACHE == 'false' }} - - name: Setup yarn cache - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + ################ + # PNPM Cache + - name: Install pnpm + uses: pnpm/action-setup@v3 with: - path: | - ~/.cache/ms-playwright - ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - if: ${{ needs.initialize.outputs.SKIP_CACHE == 'false' }} + version: 9 - name: Setup emsdk cache - uses: actions/cache@v3 + uses: actions/cache@v4 id: emsdk-cache with: path: .emsdk @@ -250,7 +238,7 @@ jobs: ################ # Pip Cache - name: Setup pip cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} @@ -261,7 +249,7 @@ jobs: ################ # Cargo Cache - name: Setup cargo cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.cargo/bin/ @@ -284,17 +272,17 @@ jobs: # Language and Compiler Setup # ############################### - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: "pip" - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - cache: "yarn" - cache-dependency-path: yarn.lock + cache: "pnpm" + cache-dependency-path: pnpm-lock.yaml - name: Install latest nightly rust uses: dtolnay/rust-toolchain@nightly @@ -307,23 +295,21 @@ jobs: # Dependencies # ################ ################ + # Install LLVM - also adds .llvm/bin to the PATH - name: Install LLVM 17 - uses: KyleMayes/install-llvm-action@v1 + uses: KyleMayes/install-llvm-action@v2 with: version: "17" directory: "./.llvm" # JS - - name: Install yarn - run: npm install -g yarn - - name: Install js dependencies - run: yarn + run: pnpm install ################ # Python - name: Install python dependencies - run: yarn _requires_python + run: pnpm run _requires_python ################ # Linux @@ -342,15 +328,15 @@ jobs: ############### - name: WebAssembly Build - run: yarn build_js --ci + run: pnpm run build_js --ci env: PSP_USE_CCACHE: 1 # - name: Docs Build - # run: yarn docs + # run: pnpm run docs - name: Lint - run: yarn lint + run: pnpm run lint env: PSP_PROJECT: "js" @@ -361,65 +347,65 @@ jobs: # Upload built JS artifacts for tests # # (listed here in the same order they appear in the directory) - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: perspective-dist path: packages/perspective/dist/ - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: perspective-jupyterlab-dist path: packages/perspective-jupyterlab/dist/ - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: perspective-viewer-d3fc-dist path: packages/perspective-viewer-d3fc/dist - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: perspective-viewer-datagrid-dist path: packages/perspective-viewer-datagrid/dist - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: perspective-viewer-openlayers-dist path: packages/perspective-viewer-openlayers/dist - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: perspective-esbuild-plugin-dist path: packages/perspective-esbuild-plugin/dist - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: perspective-webpack-plugin-dist path: packages/perspective-webpack-plugin/dist - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: perspective-cli-dist path: packages/perspective-cli/dist - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: perspective-workspace-dist path: packages/perspective-workspace/dist - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: perspective-viewer-dist path: rust/perspective-viewer/dist ###################################################### # Upload Jupyter artifacts for python build/test/dist - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: nbextension-dist path: python/perspective/perspective/nbextension if-no-files-found: error # TODO - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: labextension-dist path: python/perspective/perspective/labextension @@ -460,10 +446,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install LLVM 17 - uses: KyleMayes/install-llvm-action@v1 + uses: KyleMayes/install-llvm-action@v2 with: version: "17" directory: "./.llvm" @@ -471,30 +457,18 @@ jobs: ########## # Caches # ########## - ################ - # Yarn Cache - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - shell: bash - if: ${{ needs.initialize.outputs.SKIP_CACHE == 'false' }} - - name: Setup yarn cache - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + ################ + # PNPM Cache + - name: Install pnpm + uses: pnpm/action-setup@v3 with: - path: | - ~/.cache/ms-playwright - ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - if: ${{ needs.initialize.outputs.SKIP_CACHE == 'false' }} + version: 9 ################ # Pip Cache - name: Setup pip cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} @@ -506,35 +480,32 @@ jobs: # Language and Compiler Setup # ############################### - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: "pip" - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - cache: "yarn" - cache-dependency-path: yarn.lock + cache: "pnpm" + cache-dependency-path: pnpm-lock.yaml ################ # Dependencies # ################ ################ # JS - - name: Install yarn - run: npm install -g yarn - - name: Install js dependencies - run: yarn + run: pnpm install env: PSP_SKIP_EMSDK_INSTALL: 1 ################ # Python - name: Install python dependencies - run: yarn _requires_python + run: pnpm run _requires_python #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# #~~~~~~~~~ Build Pipelines ~~~~~~~~~# @@ -545,13 +516,13 @@ jobs: ######## # Linux - name: Python Lint (Linux) - run: yarn lint + run: pnpm run lint env: PYTHON_VERSION: ${{ matrix.python-version }} PSP_PROJECT: python - name: JavaScript Lint - run: yarn lint + run: pnpm run lint env: PYTHON_VERSION: ${{ matrix.python-version }} PSP_PROJECT: js @@ -580,7 +551,7 @@ jobs: - ubuntu-20.04 # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md python-version: - 3.9 - node-version: [18.x] + node-version: [20.x] # NOTE: don't fail fast as sometimes npm blocks the burst of fetches from GHA fail-fast: false @@ -592,35 +563,21 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 ########## # Caches # ########## ################ - # Yarn Cache - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - shell: bash - if: ${{ needs.initialize.outputs.SKIP_CACHE == 'false' }} - - - name: Setup yarn cache - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + - name: Install pnpm + uses: pnpm/action-setup@v3 with: - path: | - ${{ steps.yarn-cache-dir-path.outputs.dir }} - ~/.cache/ms-playwright - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - if: ${{ needs.initialize.outputs.SKIP_CACHE == 'false' }} + version: 9 ################ # Pip Cache - name: Setup pip cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} @@ -631,7 +588,7 @@ jobs: ################ # Cargo Cache - name: Setup cargo cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.cargo/bin/ @@ -646,35 +603,32 @@ jobs: # Language and Compiler Setup # ############################### - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: "pip" - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - cache: "yarn" - cache-dependency-path: yarn.lock + cache: "pnpm" + cache-dependency-path: pnpm-lock.yaml ################ # Dependencies # ################ ################ # JS - - name: Install yarn - run: npm install -g yarn - - name: Install js dependencies - run: yarn + run: pnpm install env: PSP_SKIP_EMSDK_INSTALL: 1 ################ # Python - name: Install python dependencies - run: yarn _requires_python + run: pnpm run _requires_python ################ # Rust @@ -688,37 +642,37 @@ jobs: #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# #~~~~~~~~~ Build Pipelines ~~~~~~~~~# #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-dist path: packages/perspective/dist/ - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-jupyterlab-dist path: packages/perspective-jupyterlab/dist/ - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-viewer-d3fc-dist path: packages/perspective-viewer-d3fc/dist - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-viewer-datagrid-dist path: packages/perspective-viewer-datagrid/dist - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-viewer-openlayers-dist path: packages/perspective-viewer-openlayers/dist - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-workspace-dist path: packages/perspective-workspace/dist - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-viewer-dist path: rust/perspective-viewer/dist @@ -727,12 +681,12 @@ jobs: # WebAssembly # ############### - name: WebAssembly Test - run: yarn test_js --ci + run: pnpm run test_js --ci ###################### # Fancy HTML reports # ###################### - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: failure() with: name: playwright-report @@ -757,98 +711,81 @@ jobs: strategy: matrix: os: [ubuntu-20.04] - node-version: [18.x] + node-version: [20.x] runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 ########## # Caches # ########## ################ - # Yarn Cache - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - shell: bash - if: ${{ needs.initialize.outputs.SKIP_CACHE == 'false' }} - - - name: Setup yarn cache - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + - name: Install pnpm + uses: pnpm/action-setup@v3 with: - path: | - ${{ steps.yarn-cache-dir-path.outputs.dir }} - ~/.cache/ms-playwright - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - if: ${{ needs.initialize.outputs.SKIP_CACHE == 'false' }} + version: 9 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - cache: "yarn" - cache-dependency-path: yarn.lock + cache: "pnpm" + cache-dependency-path: pnpm-lock.yaml ################ # Dependencies # ################ ################ # JS - - name: Install yarn - run: npm install -g yarn - - name: Install js dependencies - run: yarn + run: pnpm install env: PSP_SKIP_EMSDK_INSTALL: 1 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# #~~~~~~~~~ Build Pipelines ~~~~~~~~~# #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-dist path: packages/perspective/dist/ - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-jupyterlab-dist path: packages/perspective-jupyterlab/dist/ - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-viewer-d3fc-dist path: packages/perspective-viewer-d3fc/dist - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-viewer-datagrid-dist path: packages/perspective-viewer-datagrid/dist - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-viewer-openlayers-dist path: packages/perspective-viewer-openlayers/dist - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-workspace-dist path: packages/perspective-workspace/dist - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-viewer-dist path: rust/perspective-viewer/dist - name: Benchmarks - run: yarn bench + run: pnpm run bench - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: perspective-js-benchmarks path: tools/perspective-bench/dist/benchmark-js.arrow @@ -895,7 +832,7 @@ jobs: container: - none # Not manylinux, we will use this space to build the WASM assets - 2014 - node-version: [18.x] + node-version: [20.x] is-full-run: - ${{ needs.initialize.outputs.FULL_RUN == 'true' }} include-windows-run: @@ -948,7 +885,7 @@ jobs: steps: - name: Clean System - uses: AdityaGarg8/remove-unwanted-software@v2 + uses: AdityaGarg8/remove-unwanted-software@v3 if: ${{ runner.os == 'Linux' }} with: remove-android: "true" @@ -957,7 +894,7 @@ jobs: remove-codeql: "true" - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 ##################################################### # Conditionals # @@ -974,12 +911,12 @@ jobs: ################ # JS Artifacts # ################ - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: nbextension-dist path: python/perspective/perspective/nbextension - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: labextension-dist path: python/perspective/perspective/labextension @@ -988,29 +925,15 @@ jobs: # Caches # ########## ################ - # Yarn Cache - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - shell: bash - if: ${{ needs.initialize.outputs.SKIP_CACHE == 'false' }} - - - name: Setup yarn cache - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + - name: Install pnpm + uses: pnpm/action-setup@v3 with: - path: | - ${{ steps.yarn-cache-dir-path.outputs.dir }} - ~/.cache/ms-playwright - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - if: ${{ needs.initialize.outputs.SKIP_CACHE == 'false' }} + version: 9 ################ # Pip Cache - name: Setup pip cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} @@ -1021,7 +944,7 @@ jobs: ################ # Homebrew Cache - name: Setup homebrew cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/Library/Caches/Homebrew/boost--* @@ -1033,7 +956,7 @@ jobs: ################ # vcpkg Cache - name: Setup vcpkg cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | C:\Users\runneradmin\AppData\Local\vcpkg\archives @@ -1049,18 +972,18 @@ jobs: # Language and Compiler Setup # ############################### - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: "pip" if: ${{ runner.os != 'Linux' }} # skip on manylinux2014 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - cache: "yarn" - cache-dependency-path: yarn.lock + cache: "pnpm" + cache-dependency-path: pnpm-lock.yaml if: ${{ runner.os != 'Linux' }} # skip on manylinux2014 ################ @@ -1068,26 +991,22 @@ jobs: ################ ################ # - name: Install LLVM 17 - # uses: KyleMayes/install-llvm-action@v1 + # uses: KyleMayes/install-llvm-action@v2 # if: false # with: # version: "17" # directory: "./.llvm" # JS - - name: Install yarn - run: npm install -g yarn - if: ${{ runner.os != 'Linux' }} - - name: Install js dependencies - run: yarn + run: pnpm install env: PSP_SKIP_EMSDK_INSTALL: 1 ################ # Python - name: Install python dependencies - run: yarn _requires_python + run: pnpm run _requires_python if: ${{ runner.os != 'Linux' }} # skip on manylinux2014 ################ @@ -1123,7 +1042,7 @@ jobs: ######## # Linux - name: Python Wheel Steps (Linux) - run: yarn _wheel_python --ci + run: pnpm run _wheel_python --ci env: PYTHON_VERSION: ${{ matrix.python-version }} MANYLINUX: ${{ matrix.container }} @@ -1134,8 +1053,8 @@ jobs: # Macos - name: Python Build Steps (Macos) run: | - yarn _wheel_python --ci --macos - yarn _wheel_python --ci --macos --arm + pnpm run _wheel_python --ci --macos + pnpm run _wheel_python --ci --macos --arm env: PYTHON_VERSION: ${{ matrix.python-version }} if: ${{ runner.os == 'macOS' }} @@ -1152,7 +1071,7 @@ jobs: ########## # Windows - name: Python Build Steps (Windows vc14.3) - run: yarn _wheel_python --ci + run: pnpm run _wheel_python --ci env: PSP_GENERATOR: Visual Studio 17 2022 PSP_VCPKG_PATH: C:/vcpkg/scripts/buildsystems/vcpkg.cmake @@ -1161,19 +1080,19 @@ jobs: #################### # Upload artifacts # #################### - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: perspective-python-dist-${{ matrix.os }}-${{ matrix.python-version }} path: python/perspective/dist/*.whl if: ${{ runner.os == 'Windows' }} - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: perspective-python-dist-${{ matrix.os }}-${{ matrix.python-version }} path: python/perspective/wheelhouse/*.whl if: ${{ runner.os != 'Windows' }} - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: perspective-python-sdist path: python/perspective/dist/*.tar.gz @@ -1210,9 +1129,9 @@ jobs: - name: copy files run: | - npm install -g yarn - yarn --frozen-lockfile - yarn build_python --setup-only + npm install -g pnpm + pnpm install --frozen-lockfile + pnpm run build_python --setup-only - name: Linux init steps run: sudo node tools/perspective-scripts/install_tools.mjs @@ -1227,7 +1146,7 @@ jobs: run: pyodide build python/perspective --exports=pyinit - name: Upload pyodide wheel - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: perspective-python-dist-pyodide path: dist/*.whl @@ -1259,7 +1178,7 @@ jobs: - ubuntu-20.04 # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md python-version: - 3.9 - node-version: [18.x] + node-version: [20.x] # NOTE: don't fail fast as sometimes npm blocks the burst of fetches from GHA fail-fast: false @@ -1271,44 +1190,44 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-dist path: packages/perspective/dist/ - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-jupyterlab-dist path: packages/perspective-jupyterlab/dist/ - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-viewer-d3fc-dist path: packages/perspective-viewer-d3fc/dist - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-viewer-datagrid-dist path: packages/perspective-viewer-datagrid/dist - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-workspace-dist path: packages/perspective-workspace/dist - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-viewer-dist path: rust/perspective-viewer/dist - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: nbextension-dist path: python/perspective/perspective/nbextension - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: labextension-dist path: python/perspective/perspective/labextension @@ -1317,29 +1236,15 @@ jobs: # Caches # ########## ################ - # Yarn Cache - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - shell: bash - if: ${{ needs.initialize.outputs.SKIP_CACHE == 'false' }} - - - name: Setup yarn cache - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + - name: Install pnpm + uses: pnpm/action-setup@v3 with: - path: | - ${{ steps.yarn-cache-dir-path.outputs.dir }} - ~/.cache/ms-playwright - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - if: ${{ needs.initialize.outputs.SKIP_CACHE == 'false' }} + version: 9 ################ # Pip Cache - name: Setup pip cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} @@ -1351,28 +1256,25 @@ jobs: # Language and Compiler Setup # ############################### - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: "pip" - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - cache: "yarn" - cache-dependency-path: yarn.lock + cache: "pnpm" + cache-dependency-path: pnpm-lock.yaml ################ # Dependencies # ################ ################ # JS - - name: Install yarn - run: npm install -g yarn - - name: Install js dependencies - run: yarn --frozen-lockfile + run: pnpm install --frozen-lockfile env: PSP_SKIP_EMSDK_INSTALL: 1 @@ -1382,10 +1284,10 @@ jobs: ################ # Python - name: Install python dependencies - run: yarn _requires_python + run: pnpm run _requires_python # Download artifact - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-python-dist-${{ matrix.os }}-${{ matrix.python-version }} @@ -1400,7 +1302,7 @@ jobs: run: jupyter labextension list - name: Run Jupyterlab tests - run: yarn test_js --jupyter + run: pnpm run test_js --jupyter env: PACKAGE: perspective-jupyterlab @@ -1437,7 +1339,7 @@ jobs: - 3.9 - "3.10" - 3.11 - node-version: [18.x] + node-version: [20.x] is-full-run: - ${{ needs.initialize.outputs.FULL_RUN == 'true' }} include-windows-run: @@ -1482,35 +1384,21 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 ########## # Caches # ########## ################ - # Yarn Cache - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - shell: bash - if: ${{ needs.initialize.outputs.SKIP_CACHE == 'false' }} - - - name: Setup yarn cache - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + - name: Install pnpm + uses: pnpm/action-setup@v3 with: - path: | - ~/.cache/ms-playwright - ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - if: ${{ needs.initialize.outputs.SKIP_CACHE == 'false' }} + version: 9 ################ # Pip Cache - name: Setup pip cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} @@ -1522,35 +1410,32 @@ jobs: # Language and Compiler Setup # ############################### - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: "pip" - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - cache: "yarn" - cache-dependency-path: yarn.lock + cache: "pnpm" + cache-dependency-path: pnpm-lock.yaml ################ # Dependencies # ################ ################ # JS - - name: Install yarn - run: npm install -g yarn - - name: Install js dependencies - run: yarn + run: pnpm install env: PSP_SKIP_EMSDK_INSTALL: 1 ################ # Python - name: Install python dependencies - run: yarn _requires_python + run: pnpm run _requires_python #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# #~~~~~~~~~ Build Pipelines ~~~~~~~~~# @@ -1559,7 +1444,7 @@ jobs: # Python - Test # ################# # Download artifact - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-python-dist-${{ matrix.os }}-${{ matrix.python-version }} @@ -1584,7 +1469,7 @@ jobs: # Run tests - name: Python Test Steps - run: yarn test_python --debug + run: pnpm run test_python --debug ########################################################################################################################## ########################################################################################################################## @@ -1622,35 +1507,21 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 ########## # Caches # ########## ################ - # Yarn Cache - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - shell: bash - if: ${{ needs.initialize.outputs.SKIP_CACHE == 'false' }} - - - name: Setup yarn cache - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + - name: Install pnpm + uses: pnpm/action-setup@v3 with: - path: | - ~/.cache/ms-playwright - ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - if: ${{ needs.initialize.outputs.SKIP_CACHE == 'false' }} + version: 9 ################ # Pip Cache - name: Setup pip cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} @@ -1662,28 +1533,25 @@ jobs: # Language and Compiler Setup # ############################### - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: "pip" - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - cache: "yarn" - cache-dependency-path: yarn.lock + cache: "pnpm" + cache-dependency-path: pnpm-lock.yaml ################ # Dependencies # ################ ################ # JS - - name: Install yarn - run: npm install -g yarn - - name: Install js dependencies - run: yarn --frozen-lockfile + run: pnpm install --frozen-lockfile env: PSP_SKIP_EMSDK_INSTALL: 1 @@ -1695,13 +1563,13 @@ jobs: ################ # Python - name: Install python dependencies - run: yarn _requires_python + run: pnpm run _requires_python #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# #~~~~~~~~~ Build Pipelines ~~~~~~~~~# #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # Download sdist - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-python-sdist @@ -1737,40 +1605,26 @@ jobs: matrix: os: [ubuntu-20.04] python-version: [3.11] - node-version: [18.x] + node-version: [20.x] if: startsWith(github.ref, 'refs/tags/v') runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 ########## # Caches # ########## ################ - # Yarn Cache - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - shell: bash - if: ${{ needs.initialize.outputs.SKIP_CACHE == 'false' }} - - - name: Setup yarn cache - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + - name: Install pnpm + uses: pnpm/action-setup@v3 with: - path: | - ~/.cache/ms-playwright - ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - if: ${{ needs.initialize.outputs.SKIP_CACHE == 'false' }} + version: 9 ################ # Pip Cache - name: Setup pip cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} @@ -1782,35 +1636,32 @@ jobs: # Language and Compiler Setup # ############################### - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} cache: "pip" - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - cache: "yarn" - cache-dependency-path: yarn.lock + cache: "pnpm" + cache-dependency-path: pnpm-lock.yaml ################ # Dependencies # ################ ################ # JS - - name: Install yarn - run: npm install -g yarn - - name: Install js dependencies - run: yarn + run: pnpm install env: PSP_SKIP_EMSDK_INSTALL: 1 ################ # Python - name: Install python dependencies - run: yarn _requires_python + run: pnpm rin _requires_python #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# #~~~~~~~~~ Build Pipelines ~~~~~~~~~# @@ -1819,7 +1670,7 @@ jobs: # Python - Test # ################# # Download artifact - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-python-dist-${{ matrix.os }}-${{ matrix.python-version }} @@ -1829,12 +1680,12 @@ jobs: if: ${{ runner.os == 'Linux' }} - name: Run Benchmark - run: yarn bench + run: pnpm run bench shell: bash env: PSP_PROJECT: python - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: perspective-python-benchmarks path: tools/perspective-bench/dist/benchmark-python.arrow @@ -1878,161 +1729,187 @@ jobs: # path is empty, but `actions/downlaod-artifact` fails, and 3 JS # packages have no `dist`. - # - uses: actions/download-artifact@v3 + # - uses: actions/download-artifact@v4 # with: # name: perspective-cli-dist # path: packages/perspective-cli/dist - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-dist path: packages/perspective/dist/ - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-jupyterlab-dist path: packages/perspective-jupyterlab/dist/ - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-viewer-d3fc-dist path: packages/perspective-viewer-d3fc/dist - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-viewer-datagrid-dist path: packages/perspective-viewer-datagrid/dist - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-viewer-openlayers-dist path: packages/perspective-viewer-openlayers/dist - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-workspace-dist path: packages/perspective-workspace/dist - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-viewer-dist path: rust/perspective-viewer/dist - # - uses: actions/download-artifact@v3 + # - uses: actions/download-artifact@v4 # with: # name: perspective-esbuild-plugin-dist # path: packages/perspective-esbuild-plugin/dist - # - uses: actions/download-artifact@v3 + # - uses: actions/download-artifact@v4 # with: # name: perspective-webpack-plugin-dist # path: packages/perspective-webpack-plugin/dist - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: nbextension-dist path: python/perspective/perspective/nbextension - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: labextension-dist path: python/perspective/perspective/labextension - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-python-dist-ubuntu-20.04-3.7 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-python-dist-ubuntu-20.04-3.8 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-python-dist-ubuntu-20.04-3.9 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-python-dist-ubuntu-20.04-3.10 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-python-dist-ubuntu-20.04-3.11 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-python-dist-macos-11-3.7 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-python-dist-macos-11-3.8 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-python-dist-macos-11-3.9 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-python-dist-macos-11-3.10 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-python-dist-macos-11-3.11 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-python-dist-windows-2022-3.7 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-python-dist-windows-2022-3.8 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-python-dist-windows-2022-3.9 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-python-dist-windows-2022-3.10 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-python-dist-windows-2022-3.11 - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-python-dist-pyodide - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-python-sdist - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-js-benchmarks - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: perspective-python-benchmarks - - name: NPM pack - run: | - npm pack \ - --workspace=@finos/perspective \ - --workspace=@finos/perspective-viewer \ - --workspace=@finos/perspective-viewer-datagrid \ - --workspace=@finos/perspective-viewer-d3fc \ - --workspace=@finos/perspective-viewer-openlayers \ - --workspace=@finos/perspective-workspace \ - --workspace=@finos/perspective-cli \ - --workspace=@finos/perspective-webpack-plugin \ - --workspace=@finos/perspective-esbuild-plugin \ - --workspace=@finos/perspective-jupyterlab + - name: NPM pack perspective + run: pnpm pack --pack-destination=../.. + working-directory: ./packages/perspective + + - name: NPM pack perspective-viewer + run: pnpm pack --pack-destination=../.. + working-directory: ./rust/perspective-viewer + + - name: NPM pack perspective-viewer-datagrid + run: pnpm pack --pack-destination=../.. + working-directory: ./packages/perspective-viewer-datagrid + + - name: NPM pack perspective-viewer-d3fc + run: pnpm pack --pack-destination=../.. + working-directory: ./packages/perspective-viewer-d3fc + + - name: NPM pack perspective-viewer-openlayers + run: pnpm pack --pack-destination=../.. + working-directory: ./packages/perspective-viewer-openlayers + + - name: NPM pack perspective-workspace + run: pnpm pack --pack-destination=../.. + working-directory: ./packages/perspective-workspace + + - name: NPM pack perspective-cli + run: pnpm pack --pack-destination=../.. + working-directory: ./packages/perspective-cli + + - name: NPM pack perspective-webpack-plugin + run: pnpm pack --pack-destination=../.. + working-directory: ./packages/perspective-webpack-plugin + + - name: NPM pack perspective-esbuild-plugin + run: pnpm pack --pack-destination=../.. + working-directory: ./packages/perspective-esbuild-plugin + + - name: NPM pack perspective-jupyterlab + run: pnpm pack --pack-destination=../.. + working-directory: ./packages/perspective-jupyterlab - name: Debug run: ls -lah - name: Release wheels - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v2 with: draft: true generate_release_notes: true diff --git a/.husky/pre-push b/.husky/pre-push index 84489edd6a..bf440db5fa 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,4 +1,4 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -yarn prepush +pnpm run prepush diff --git a/cpp/perspective/build.js b/cpp/perspective/build.js index 320ebdd488..b6d27df83b 100644 --- a/cpp/perspective/build.js +++ b/cpp/perspective/build.js @@ -21,7 +21,7 @@ const cwd = path.join(process.cwd(), "dist", env); delete process.env.NODE; function bootstrap(file) { - execSync(`cargo run -p perspective-bootstrap -- ${file}`, { + execSync(`cargo run --color always -p perspective-bootstrap -- ${file}`, { cwd: path.join(process.cwd(), "..", "..", "rust", "perspective-viewer"), stdio, }); diff --git a/docs/docs/development.md b/docs/docs/development.md index c88f4bcadb..2c84ad9775 100644 --- a/docs/docs/development.md +++ b/docs/docs/development.md @@ -147,13 +147,21 @@ yarn jlab_link # run this whenever you need to update a local perspective packag Install system dependencies through Homebrew: ```bash -brew install cmake +brew install cmake llvm@17 +brew link llvm@17 # optional, see below ``` On M1 (Apple Silicon) systems, make sure your brew-installed dependencies are in `/opt/homebrew` (the default location), and that `/opt/homebrew/bin` is on the `PATH`. +If you do not want to link the llvm@17 keg, then while developing ensure it is +on your PATH too, like this: + +``` +PATH=$(brew --prefix llvm@17)/bin:$PATH +``` + **Note**: Perspective vendors its C++ extensions, so you may run into trouble building if you have `brew`-installed versions of libraries, such as `flatbuffers`. diff --git a/docs/package.json b/docs/package.json index e474ad8f18..afaf1f64bd 100644 --- a/docs/package.json +++ b/docs/package.json @@ -16,13 +16,13 @@ "dependencies": { "@docusaurus/core": "2.2.0", "@docusaurus/preset-classic": "2.2.0", - "@finos/perspective": "^2.10.0", - "@finos/perspective-viewer": "^2.10.0", - "@finos/perspective-viewer-d3fc": "^2.10.0", - "@finos/perspective-viewer-datagrid": "^2.10.0", - "@finos/perspective-webpack-plugin": "^2.10.0", + "@finos/perspective": "workspace:^", + "@finos/perspective-viewer": "workspace:^", + "@finos/perspective-viewer-d3fc": "workspace:^", + "@finos/perspective-viewer-datagrid": "workspace:^", + "@finos/perspective-webpack-plugin": "workspace:^", "@mdx-js/react": "^1.6.22", - "blocks": "^2.10.0", + "blocks": "workspace:^", "clsx": "^1.1.1", "prism-react-renderer": "^1.3.3", "react": "^17.0.2", diff --git a/examples/blocks/index.mjs b/examples/blocks/index.mjs index 6c1d513a92..42828be440 100644 --- a/examples/blocks/index.mjs +++ b/examples/blocks/index.mjs @@ -12,9 +12,9 @@ import * as fs from "fs"; import { get_examples, LOCAL_EXAMPLES } from "./examples.js"; -import sh from "@finos/perspective-scripts/sh.mjs"; import * as url from "url"; import * as path from "node:path"; +import { execSync } from "child_process"; const version = JSON.parse(fs.readFileSync("./package.json")).version; const __dirname = url.fileURLToPath(new URL(".", import.meta.url)).slice(0, -1); @@ -37,7 +37,7 @@ const replacements = { export async function dist_examples( outpath = `${__dirname}/../../docs/static/blocks` ) { - sh`mkdir -p ${outpath}`.runSync(); + execSync(`mkdir -p ${outpath}`, {stdio:"inherit"}); const readme = generate_readme(); let existing = fs.readFileSync(`${__dirname}/../../README.md`).toString(); existing = existing.replace( @@ -51,7 +51,7 @@ export async function dist_examples( if (fs.existsSync(`${__dirname}/src/${name}`)) { // Copy for (const filename of fs.readdirSync(`${__dirname}/src/${name}`)) { - sh`mkdir -p ${outpath}/${name}`.runSync(); + execSync(`mkdir -p ${outpath}/${name}`, {stdio:"inherit"}); if ( filename.endsWith(".mjs") || filename.endsWith(".js") || @@ -71,7 +71,7 @@ export async function dist_examples( filecontents ); } else if (filename !== ".git") { - sh`cp ${__dirname}/src/${name}/${filename} ${outpath}/${name}/${filename}`.runSync(); + execSync(`cp ${__dirname}/src/${name}/${filename} ${outpath}/${name}/${filename}`, {stdio:"inherit"}); } } @@ -79,7 +79,7 @@ export async function dist_examples( if (fs.existsSync(path.join(outpath, name, "build.mjs"))) { console.log("Building " + name); const script = `${outpath}/${name}/build.mjs`; - sh`node ${script}`.runSync(); + execSync(`node ${script}`, {stdio:"inherit"}); } } } diff --git a/examples/blocks/package.json b/examples/blocks/package.json index 663ac74583..b244140d94 100644 --- a/examples/blocks/package.json +++ b/examples/blocks/package.json @@ -10,12 +10,12 @@ "keywords": [], "license": "Apache-2.0", "dependencies": { - "@finos/perspective": "^2.10.0", - "@finos/perspective-viewer": "^2.10.0", - "@finos/perspective-viewer-d3fc": "^2.10.0", - "@finos/perspective-viewer-datagrid": "^2.10.0", - "@finos/perspective-viewer-openlayers": "^2.10.0", - "@finos/perspective-workspace": "^2.10.0", + "@finos/perspective": "workspace:^", + "@finos/perspective-viewer": "workspace:^", + "@finos/perspective-viewer-d3fc": "workspace:^", + "@finos/perspective-viewer-datagrid": "workspace:^", + "@finos/perspective-viewer-openlayers": "workspace:^", + "@finos/perspective-workspace": "workspace:^", "superstore-arrow": "3.0.0" }, "devDependencies": { diff --git a/examples/blocks/src/olympics/build.mjs b/examples/blocks/src/olympics/build.mjs index d6f1adc79c..f9452200d8 100644 --- a/examples/blocks/src/olympics/build.mjs +++ b/examples/blocks/src/olympics/build.mjs @@ -10,9 +10,7 @@ // ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃ // ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ -import sh from "@finos/perspective-scripts/sh.mjs"; -// import * as url from "url"; - +import { execSync } from "child_process"; import perspective from "@finos/perspective"; import { Uint8ArrayReader, @@ -34,9 +32,10 @@ async function main() { return; } - sh`kaggle datasets download -d heesoo37/120-years-of-olympic-history-athletes-and-results` - .cwd(__dirname) - .runSync(); + execSync( + `cd ${__dirname} && kaggle datasets download -d heesoo37/120-years-of-olympic-history-athletes-and-results`, + { stdio: "inherit" } + ); const zip = fs.readFileSync( `${__dirname}/120-years-of-olympic-history-athletes-and-results.zip` diff --git a/examples/esbuild-example/package.json b/examples/esbuild-example/package.json index cbc5bf3f43..de12f6aa5e 100644 --- a/examples/esbuild-example/package.json +++ b/examples/esbuild-example/package.json @@ -5,20 +5,20 @@ "description": "An esbuild example app built using `@finos/perspective-viewer`.", "scripts": { "build": "node build.js", - "start": "yarn build && http-server dist" + "start": "pnpm run build && http-server dist" }, "keywords": [], "license": "Apache-2.0", "dependencies": { - "@finos/perspective": "^2.10.0", - "@finos/perspective-viewer": "^2.10.0", - "@finos/perspective-viewer-d3fc": "^2.10.0", - "@finos/perspective-viewer-datagrid": "^2.10.0", - "@finos/perspective-viewer-openlayers": "^2.10.0", + "@finos/perspective": "workspace:^", + "@finos/perspective-viewer": "workspace:^", + "@finos/perspective-viewer-d3fc": "workspace:^", + "@finos/perspective-viewer-datagrid": "workspace:^", + "@finos/perspective-viewer-openlayers": "workspace:^", "superstore-arrow": "^3.0.0" }, "devDependencies": { - "@finos/perspective-esbuild-plugin": "^2.10.0", + "@finos/perspective-esbuild-plugin": "workspace:^", "esbuild": "^0.14.54", "http-server": "^14.1.1" } diff --git a/examples/esbuild-remote/package.json b/examples/esbuild-remote/package.json index 9a3338e535..4a18e4637b 100644 --- a/examples/esbuild-remote/package.json +++ b/examples/esbuild-remote/package.json @@ -9,15 +9,15 @@ "keywords": [], "license": "Apache-2.0", "dependencies": { - "@finos/perspective": "^2.10.0", - "@finos/perspective-viewer": "^2.10.0", - "@finos/perspective-viewer-d3fc": "^2.10.0", - "@finos/perspective-viewer-datagrid": "^2.10.0", - "express": "^4.17.1", + "@finos/perspective": "workspace:^", + "@finos/perspective-viewer": "workspace:^", + "@finos/perspective-viewer-d3fc": "workspace:^", + "@finos/perspective-viewer-datagrid": "workspace:^", + "express": "4.18.2", "express-ws": "^5.0.2" }, "devDependencies": { - "@finos/perspective-esbuild-plugin": "^2.10.0", + "@finos/perspective-esbuild-plugin": "workspace:^", "esbuild": "^0.14.54" } } diff --git a/examples/git-history/package.json b/examples/git-history/package.json index 46313ebaa9..b93b7cc751 100644 --- a/examples/git-history/package.json +++ b/examples/git-history/package.json @@ -9,9 +9,9 @@ "keywords": [], "license": "Apache-2.0", "dependencies": { - "@finos/perspective": "^2.10.0", - "@finos/perspective-viewer": "^2.10.0", - "@finos/perspective-viewer-d3fc": "^2.10.0", - "@finos/perspective-viewer-datagrid": "^2.10.0" + "@finos/perspective": "workspace:^", + "@finos/perspective-viewer": "workspace:^", + "@finos/perspective-viewer-d3fc": "workspace:^", + "@finos/perspective-viewer-datagrid": "workspace:^" } } diff --git a/examples/promo/package.json b/examples/promo/package.json index 66afb1577a..b5694585ca 100644 --- a/examples/promo/package.json +++ b/examples/promo/package.json @@ -13,14 +13,14 @@ "keywords": [], "license": "Apache-2.0", "dependencies": { - "@finos/perspective": "^2.10.0", - "@finos/perspective-viewer": "^2.10.0", - "@finos/perspective-viewer-d3fc": "^2.10.0", - "@finos/perspective-viewer-datagrid": "^2.10.0", - "@finos/perspective-workspace": "^2.10.0" + "@finos/perspective": "workspace:^", + "@finos/perspective-viewer": "workspace:^", + "@finos/perspective-viewer-d3fc": "workspace:^", + "@finos/perspective-viewer-datagrid": "workspace:^", + "@finos/perspective-workspace": "workspace:^" }, "devDependencies": { - "@finos/perspective-webpack-plugin": "^2.10.0", + "@finos/perspective-webpack-plugin": "workspace:^", "http-server": "^14.1.1", "npm-run-all": "^4.1.3", "rimraf": "^2.5.2" diff --git a/examples/python-aiohttp/package.json b/examples/python-aiohttp/package.json index 2170d4a63f..d75adb2cb2 100644 --- a/examples/python-aiohttp/package.json +++ b/examples/python-aiohttp/package.json @@ -9,15 +9,15 @@ "keywords": [], "license": "Apache-2.0", "dependencies": { - "@finos/perspective": "^2.10.0", - "@finos/perspective-viewer": "^2.10.0", - "@finos/perspective-viewer-d3fc": "^2.10.0", - "@finos/perspective-viewer-datagrid": "^2.10.0", - "@finos/perspective-workspace": "^2.10.0", + "@finos/perspective": "workspace:^", + "@finos/perspective-viewer": "workspace:^", + "@finos/perspective-viewer-d3fc": "workspace:^", + "@finos/perspective-viewer-datagrid": "workspace:^", + "@finos/perspective-workspace": "workspace:^", "superstore-arrow": "^3.0.0" }, "devDependencies": { - "@finos/perspective-webpack-plugin": "^2.10.0", + "@finos/perspective-webpack-plugin": "workspace:^", "npm-run-all": "^4.1.3", "rimraf": "^2.5.2" } diff --git a/examples/python-starlette/package.json b/examples/python-starlette/package.json index 7ac8f413ed..b81572f117 100644 --- a/examples/python-starlette/package.json +++ b/examples/python-starlette/package.json @@ -9,15 +9,15 @@ "keywords": [], "license": "Apache-2.0", "dependencies": { - "@finos/perspective": "^2.10.0", - "@finos/perspective-viewer": "^2.10.0", - "@finos/perspective-viewer-d3fc": "^2.10.0", - "@finos/perspective-viewer-datagrid": "^2.10.0", - "@finos/perspective-workspace": "^2.10.0", + "@finos/perspective": "workspace:^", + "@finos/perspective-viewer": "workspace:^", + "@finos/perspective-viewer-d3fc": "workspace:^", + "@finos/perspective-viewer-datagrid": "workspace:^", + "@finos/perspective-workspace": "workspace:^", "superstore-arrow": "^3.0.0" }, "devDependencies": { - "@finos/perspective-webpack-plugin": "^2.10.0", + "@finos/perspective-webpack-plugin": "workspace:^", "npm-run-all": "^4.1.3", "rimraf": "^2.5.2" } diff --git a/examples/python-tornado-streaming/package.json b/examples/python-tornado-streaming/package.json index 6fe8388dd3..7c7036b7be 100644 --- a/examples/python-tornado-streaming/package.json +++ b/examples/python-tornado-streaming/package.json @@ -9,15 +9,15 @@ "keywords": [], "license": "Apache-2.0", "dependencies": { - "@finos/perspective": "^2.10.0", - "@finos/perspective-viewer": "^2.10.0", - "@finos/perspective-viewer-d3fc": "^2.10.0", - "@finos/perspective-viewer-datagrid": "^2.10.0", - "@finos/perspective-workspace": "^2.10.0", + "@finos/perspective": "workspace:^", + "@finos/perspective-viewer": "workspace:^", + "@finos/perspective-viewer-d3fc": "workspace:^", + "@finos/perspective-viewer-datagrid": "workspace:^", + "@finos/perspective-workspace": "workspace:^", "superstore-arrow": "^3.0.0" }, "devDependencies": { - "@finos/perspective-webpack-plugin": "^2.10.0", + "@finos/perspective-webpack-plugin": "workspace:^", "npm-run-all": "^4.1.3", "rimraf": "^2.5.2" } diff --git a/examples/python-tornado/package.json b/examples/python-tornado/package.json index 6b6fa0b604..76611846ed 100644 --- a/examples/python-tornado/package.json +++ b/examples/python-tornado/package.json @@ -9,15 +9,15 @@ "keywords": [], "license": "Apache-2.0", "dependencies": { - "@finos/perspective": "^2.10.0", - "@finos/perspective-viewer": "^2.10.0", - "@finos/perspective-viewer-d3fc": "^2.10.0", - "@finos/perspective-viewer-datagrid": "^2.10.0", - "@finos/perspective-workspace": "^2.10.0", + "@finos/perspective": "workspace:^", + "@finos/perspective-viewer": "workspace:^", + "@finos/perspective-viewer-d3fc": "workspace:^", + "@finos/perspective-viewer-datagrid": "workspace:^", + "@finos/perspective-workspace": "workspace:^", "superstore-arrow": "^3.0.0" }, "devDependencies": { - "@finos/perspective-webpack-plugin": "^2.10.0", + "@finos/perspective-webpack-plugin": "workspace:^", "npm-run-all": "^4.1.3", "rimraf": "^2.5.2" } diff --git a/examples/react-example/package.json b/examples/react-example/package.json index 9714a28aee..3b2d997f6f 100644 --- a/examples/react-example/package.json +++ b/examples/react-example/package.json @@ -10,17 +10,17 @@ "keywords": [], "license": "Apache-2.0", "dependencies": { - "@finos/perspective": "^2.10.0", - "@finos/perspective-viewer": "^2.10.0", - "@finos/perspective-viewer-d3fc": "^2.10.0", - "@finos/perspective-viewer-datagrid": "^2.10.0", - "react": "^16.14.0", - "react-dom": "^16.9.17" + "@finos/perspective": "workspace:^", + "@finos/perspective-viewer": "workspace:^", + "@finos/perspective-viewer-d3fc": "workspace:^", + "@finos/perspective-viewer-datagrid": "workspace:^", + "react": "^17.0.2", + "react-dom": "^17.0.2" }, "devDependencies": { - "@finos/perspective-webpack-plugin": "^2.10.0", - "@types/react": "^16.14.0", - "@types/react-dom": "^16.9.17", + "@finos/perspective-webpack-plugin": "workspace:^", + "@types/react": "^17.0.2", + "@types/react-dom": "^17.0.2", "source-map-loader": "^0.2.4", "ts-loader": "^6.2.1" } diff --git a/examples/webpack-cross-origin/package.json b/examples/webpack-cross-origin/package.json index a4e23be542..b4f61d5167 100644 --- a/examples/webpack-cross-origin/package.json +++ b/examples/webpack-cross-origin/package.json @@ -12,13 +12,13 @@ "keywords": [], "license": "Apache-2.0", "dependencies": { - "@finos/perspective": "^2.10.0", - "@finos/perspective-viewer": "^2.10.0", - "@finos/perspective-viewer-d3fc": "^2.10.0", - "@finos/perspective-viewer-datagrid": "^2.10.0" + "@finos/perspective": "workspace:^", + "@finos/perspective-viewer": "workspace:^", + "@finos/perspective-viewer-d3fc": "workspace:^", + "@finos/perspective-viewer-datagrid": "workspace:^" }, "devDependencies": { - "@finos/perspective-webpack-plugin": "^2.10.0", + "@finos/perspective-webpack-plugin": "workspace:^", "css-loader": "^0.28.7", "html-webpack-plugin": "^5.1.0", "http-server": "^14.1.1", diff --git a/examples/webpack-example/package.json b/examples/webpack-example/package.json index 8d86e86eef..ac4ca4cd3f 100644 --- a/examples/webpack-example/package.json +++ b/examples/webpack-example/package.json @@ -4,19 +4,20 @@ "version": "2.10.0", "description": "An example app built using `@finos/perspective-viewer`.", "scripts": { - "build": "webpack", + "webpack_build": "webpack", "start": "webpack serve" }, "keywords": [], "license": "Apache-2.0", "dependencies": { - "@finos/perspective": "^2.10.0", - "@finos/perspective-viewer": "^2.10.0", - "@finos/perspective-viewer-d3fc": "^2.10.0", - "@finos/perspective-viewer-datagrid": "^2.10.0" + "@finos/perspective": "workspace:^", + "@finos/perspective-viewer": "workspace:^", + "@finos/perspective-viewer-d3fc": "workspace:^", + "@finos/perspective-viewer-datagrid": "workspace:^" }, "devDependencies": { - "@finos/perspective-webpack-plugin": "^2.10.0", + "@finos/perspective-webpack-plugin": "workspace:^", + "arraybuffer-loader": "^1.0.8", "css-loader": "^0.28.7", "html-webpack-plugin": "^5.1.0", "style-loader": "^0.18.2", diff --git a/examples/workspace-editing-python/package.json b/examples/workspace-editing-python/package.json index 37f41790df..60ab30eb7b 100644 --- a/examples/workspace-editing-python/package.json +++ b/examples/workspace-editing-python/package.json @@ -4,7 +4,7 @@ "version": "2.10.0", "description": "An example app demonstrating client/server editing, built using `@finos/perspective-workspace` and `perspective-python`.", "scripts": { - "start": "yarn webpack && yarn start:server", + "start": "pnpm run webpack && pnpm run start:server", "start:client": "webpack-dev-server --open", "start:server": "PYTHONPATH=../../python/perspective python3 src/server.py", "webpack": "webpack --color" @@ -12,14 +12,14 @@ "keywords": [], "license": "Apache-2.0", "dependencies": { - "@finos/perspective": "^2.10.0", - "@finos/perspective-viewer": "^2.10.0", - "@finos/perspective-viewer-d3fc": "^2.10.0", - "@finos/perspective-viewer-datagrid": "^2.10.0", - "@finos/perspective-workspace": "^2.10.0" + "@finos/perspective": "workspace:^", + "@finos/perspective-viewer": "workspace:^", + "@finos/perspective-viewer-d3fc": "workspace:^", + "@finos/perspective-viewer-datagrid": "workspace:^", + "@finos/perspective-workspace": "workspace:^" }, "devDependencies": { - "@finos/perspective-webpack-plugin": "^2.10.0", + "@finos/perspective-webpack-plugin": "workspace:^", "http-server": "^14.1.1", "npm-run-all": "^4.1.3", "rimraf": "^2.5.2" diff --git a/examples/workspace/package.json b/examples/workspace/package.json index 5b8b218d7a..cbcf2ac811 100644 --- a/examples/workspace/package.json +++ b/examples/workspace/package.json @@ -10,14 +10,14 @@ "keywords": [], "license": "Apache-2.0", "dependencies": { - "@finos/perspective": "^2.10.0", - "@finos/perspective-viewer": "^2.10.0", - "@finos/perspective-viewer-d3fc": "^2.10.0", - "@finos/perspective-viewer-datagrid": "^2.10.0", - "@finos/perspective-workspace": "^2.10.0" + "@finos/perspective": "workspace:^", + "@finos/perspective-viewer": "workspace:^", + "@finos/perspective-viewer-d3fc": "workspace:^", + "@finos/perspective-viewer-datagrid": "workspace:^", + "@finos/perspective-workspace": "workspace:^" }, "devDependencies": { - "@finos/perspective-webpack-plugin": "^2.10.0", + "@finos/perspective-webpack-plugin": "workspace:^", "http-server": "^14.1.1", "npm-run-all": "^4.1.3", "rimraf": "^2.5.2" diff --git a/package.json b/package.json index c485d1a4ed..5a96f4d069 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "emscripten": "3.1.48", "llvm": "17.0.6", "engines": { - "node": ">=14.18.2" + "node": ">=14.18.2 <22" }, "workspaces": [ "tools/perspective-test", @@ -36,8 +36,16 @@ "python/perspective" ], "devDependencies": { + "@finos/perspective": "workspace:^", + "@finos/perspective-viewer": "workspace:^", + "@finos/perspective-viewer-datagrid": "workspace:^", + "@finos/perspective-viewer-d3fc": "workspace:^", + "@finos/perspective-viewer-openlayers": "workspace:^", + "@finos/perspective-workspace": "workspace:^", + "@finos/perspective-jupyterlab": "workspace:^", + "@finos/perspective-test": "workspace:^", "@fontsource/roboto-mono": "4.5.10", - "@playwright/test": "^1.30.0", + "@playwright/test": "^1.37.1", "@types/ws": "^7.2.2", "@zip.js/zip.js": "^2.7.27", "auto-changelog": "^2.4.0", @@ -68,6 +76,7 @@ "sinon": "^7.3.1", "stoppable": "^1.1.0", "style-loader": "^3.3.1", + "superstore-arrow": "3.0.0", "tar": "^6.1.13", "term-img": "^4.1.0", "timezone-mock": "^1.3.6", @@ -98,7 +107,7 @@ "setup": "node tools/perspective-scripts/setup.mjs", "docs": "node tools/perspective-scripts/docs.mjs", "test": "node tools/perspective-scripts/test.mjs", - "test:jupyter": "yarn workspace @finos/perspective-jupyterlab test:jupyter", + "test:jupyter": "pnpm run --recursive --filter @finos/perspective-jupyterlab test:jupyter", "test_js": "node tools/perspective-scripts/test_js.mjs", "test_python": "node tools/perspective-scripts/test_python.mjs", "clean": "node tools/perspective-scripts/clean.mjs", diff --git a/packages/perspective-cli/package.json b/packages/perspective-cli/package.json index 72e0e37855..0b46830416 100644 --- a/packages/perspective-cli/package.json +++ b/packages/perspective-cli/package.json @@ -24,12 +24,12 @@ "perspective": "perspective" }, "dependencies": { - "@finos/perspective": "^2.10.0", - "@finos/perspective-viewer": "^2.10.0", - "@finos/perspective-viewer-d3fc": "^2.10.0", - "@finos/perspective-viewer-datagrid": "^2.10.0", - "@finos/perspective-viewer-openlayers": "^2.10.0", - "@finos/perspective-workspace": "^2.10.0", + "@finos/perspective": "workspace:^", + "@finos/perspective-viewer": "workspace:^", + "@finos/perspective-viewer-d3fc": "workspace:^", + "@finos/perspective-viewer-datagrid": "workspace:^", + "@finos/perspective-viewer-openlayers": "workspace:^", + "@finos/perspective-workspace": "workspace:^", "commander": "^2.19.0", "puppeteer": "^13.1.3" } diff --git a/packages/perspective-jupyterlab/package.json b/packages/perspective-jupyterlab/package.json index c051a498b8..1a899bf051 100644 --- a/packages/perspective-jupyterlab/package.json +++ b/packages/perspective-jupyterlab/package.json @@ -34,19 +34,19 @@ "version": "yarn build" }, "dependencies": { - "@finos/perspective": "^2.10.0", - "@finos/perspective-viewer": "^2.10.0", - "@finos/perspective-viewer-d3fc": "^2.10.0", - "@finos/perspective-viewer-datagrid": "^2.10.0", - "@finos/perspective-viewer-openlayers": "^2.10.0", + "@finos/perspective": "workspace:^", + "@finos/perspective-viewer": "workspace:^", + "@finos/perspective-viewer-d3fc": "workspace:^", + "@finos/perspective-viewer-datagrid": "workspace:^", + "@finos/perspective-viewer-openlayers": "workspace:^", "@jupyter-widgets/base": "^2 || ^3 || ^4 || ^5 || ^6", "@jupyterlab/application": "^3.6.1", "@lumino/application": "^1.27.0", "@lumino/widgets": "^1.37.0" }, "devDependencies": { - "@finos/perspective-esbuild-plugin": "^2.10.0", - "@finos/perspective-test": "^2.10.0", + "@finos/perspective-esbuild-plugin": "workspace:^", + "@finos/perspective-test": "workspace:^", "@jupyterlab/builder": "^3.4.0", "@prospective.co/procss": "^0.1.15", "cpy": "^9.0.1" diff --git a/packages/perspective-jupyterlab/src/js/notebook/css.js b/packages/perspective-jupyterlab/src/js/notebook/css.js new file mode 100644 index 0000000000..047af3216c --- /dev/null +++ b/packages/perspective-jupyterlab/src/js/notebook/css.js @@ -0,0 +1,20 @@ +// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ +// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃ +// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃ +// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃ +// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃ +// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ +// ┃ Copyright (c) 2017, the Perspective Authors. ┃ +// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃ +// ┃ This file is part of the Perspective library, distributed under the terms ┃ +// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃ +// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + +import THEMES from "../../../dist/css/perspective-jupyterlab.css"; + +// Export the required load_ipython_extension +exports.load_css = () => { + const style = document.createElement("style"); + style.textContent = THEMES; + document.head.appendChild(style); +}; diff --git a/packages/perspective-jupyterlab/src/js/notebook/extension.js b/packages/perspective-jupyterlab/src/js/notebook/extension.js index e8647d347a..9626da743d 100644 --- a/packages/perspective-jupyterlab/src/js/notebook/extension.js +++ b/packages/perspective-jupyterlab/src/js/notebook/extension.js @@ -11,17 +11,11 @@ // ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ /* eslint-disable no-underscore-dangle */ +import { load_css } from "./css"; // This file contains the javascript that is run when the notebook is loaded. // It contains some requirejs configuration and the `load_ipython_extension` // which is required for any notebook extension. -// -// Some static assets may be required by the custom widget javascript. The base -// 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: { @@ -33,9 +27,6 @@ if (window.require) { }); } -// Export the required load_ipython_extension exports.load_ipython_extension = () => { - const style = document.createElement("style"); - style.textContent = THEMES; - document.head.appendChild(style); + load_css(); }; diff --git a/packages/perspective-jupyterlab/src/js/notebook/index.js b/packages/perspective-jupyterlab/src/js/notebook/index.js index 4dde6a378d..c39aea3bb7 100644 --- a/packages/perspective-jupyterlab/src/js/notebook/index.js +++ b/packages/perspective-jupyterlab/src/js/notebook/index.js @@ -14,8 +14,14 @@ import "@finos/perspective-viewer-datagrid"; import "@finos/perspective-viewer-d3fc"; import "@finos/perspective-viewer-openlayers"; +import { load_css } from "./css"; import { PerspectiveView } from "../view"; import { PerspectiveModel } from "../model"; exports.PerspectiveModel = PerspectiveModel; exports.PerspectiveView = PerspectiveView; + +// Run if in vs-code +if (window.vscIPyWidgets) { + load_css(); +} diff --git a/packages/perspective-jupyterlab/src/js/view.js b/packages/perspective-jupyterlab/src/js/view.js index 5999fcd141..0afe525253 100644 --- a/packages/perspective-jupyterlab/src/js/view.js +++ b/packages/perspective-jupyterlab/src/js/view.js @@ -404,10 +404,16 @@ export class PerspectiveView extends DOMWidgetView { table.update(updated.delta); } - this._client_view.on_update( - (updated) => this._client_view_update_callback(updated), - { mode: "row" } - ); + if (this._client_view) { + // NOTE: if `plugin_config_changed` called before + // `_handle_load_message`, this will be undefined + // Ignore, as `_handle_load_message` is sure to + // follow. + this._client_view.on_update( + (updated) => this._client_view_update_callback(updated), + { mode: "row" } + ); + } this._kernel_view.on_update( (updated) => this._kernel_view_update_callback(updated), diff --git a/packages/perspective-jupyterlab/src/less/index.less b/packages/perspective-jupyterlab/src/less/index.less index 3213497ec6..7f7d634588 100644 --- a/packages/perspective-jupyterlab/src/less/index.less +++ b/packages/perspective-jupyterlab/src/less/index.less @@ -35,6 +35,14 @@ div.PSPContainer { height: 520px; } +// Widget height for Voila +// Widget height for VS Code +body[data-voila="voila"] .jp-OutputArea-output div.PSPContainer, +body[data-vscode-theme-id] .cell-output-ipywidget-background div.PSPContainer { + min-height: 520px; + height: 520px; +} + div.PSPContainer perspective-viewer[theme="Pro Light"] { --plugin--border: 1px solid #e0e0e0; } diff --git a/packages/perspective-viewer-d3fc/package.json b/packages/perspective-viewer-d3fc/package.json index 86896fe689..413cd6a49a 100644 --- a/packages/perspective-viewer-d3fc/package.json +++ b/packages/perspective-viewer-d3fc/package.json @@ -46,8 +46,8 @@ "author": "", "license": "Apache-2.0", "dependencies": { - "@finos/perspective": "^2.10.0", - "@finos/perspective-viewer": "^2.10.0", + "@finos/perspective": "workspace:^", + "@finos/perspective-viewer": "workspace:^", "chroma-js": "^1.3.4", "d3fc": "^15.2.4", "d3-selection": "^3.0.0", @@ -58,8 +58,8 @@ }, "devDependencies": { "@types/d3": "^7.0.0", - "@finos/perspective-esbuild-plugin": "^2.10.0", - "@finos/perspective-test": "^2.10.0", + "@finos/perspective-esbuild-plugin": "workspace:^", + "@finos/perspective-test": "workspace:^", "@prospective.co/procss": "^0.1.15" } } diff --git a/packages/perspective-viewer-d3fc/src/ts/axis/axisType.ts b/packages/perspective-viewer-d3fc/src/ts/axis/axisType.ts index 957bca9dad..6c24579622 100644 --- a/packages/perspective-viewer-d3fc/src/ts/axis/axisType.ts +++ b/packages/perspective-viewer-d3fc/src/ts/axis/axisType.ts @@ -19,7 +19,7 @@ export const AXIS_TYPES = { linear: "linear", } as const; -export type AxisTypeValues = typeof AXIS_TYPES[keyof typeof AXIS_TYPES]; +export type AxisTypeValues = (typeof AXIS_TYPES)[keyof typeof AXIS_TYPES]; export interface AxisType { (): AxisTypeValues; diff --git a/packages/perspective-viewer-datagrid/package.json b/packages/perspective-viewer-datagrid/package.json index 02d5e4ba2b..3f8a0e47f0 100644 --- a/packages/perspective-viewer-datagrid/package.json +++ b/packages/perspective-viewer-datagrid/package.json @@ -29,14 +29,14 @@ "author": "", "license": "Apache-2.0", "dependencies": { - "@finos/perspective": "^2.10.0", - "@finos/perspective-viewer": "^2.10.0", + "@finos/perspective": "workspace:^", + "@finos/perspective-viewer": "workspace:^", "chroma-js": "^1.3.4", "regular-table": "=0.6.4" }, "devDependencies": { - "@prospective.co/procss": "^0.1.13", - "@finos/perspective-esbuild-plugin": "^2.10.0", - "@finos/perspective-test": "^2.10.0" + "@prospective.co/procss": "^0.1.15", + "@finos/perspective-esbuild-plugin": "workspace:^", + "@finos/perspective-test": "workspace:^" } } diff --git a/packages/perspective-viewer-datagrid/src/less/mitered-headers.less b/packages/perspective-viewer-datagrid/src/less/mitered-headers.less index 546b202f07..4eefb86ef8 100644 --- a/packages/perspective-viewer-datagrid/src/less/mitered-headers.less +++ b/packages/perspective-viewer-datagrid/src/less/mitered-headers.less @@ -31,10 +31,12 @@ 0px 10px 0 -9px var(--inactive--border-color, #8b868045); } -.psp-header-border.psp-header-group:not(.psp-is-top):not(.psp-header-group-corner) { - // right and bottom - box-shadow: 1px 0px var(--inactive--border-color, #8b868045), - 0px 10px 0 -9px var(--inactive--border-color, #8b868045); +.psp-header-border.psp-header-group { + &:not(.psp-is-top):not(.psp-header-group-corner) { + // right and bottom + box-shadow: 1px 0px var(--inactive--border-color, #8b868045), + 0px 10px 0 -9px var(--inactive--border-color, #8b868045); + } } @mixin disabled-menu-funky-box-shadow { diff --git a/packages/perspective-viewer-openlayers/package.json b/packages/perspective-viewer-openlayers/package.json index d7dc456aef..c48d7e6dd2 100644 --- a/packages/perspective-viewer-openlayers/package.json +++ b/packages/perspective-viewer-openlayers/package.json @@ -24,8 +24,8 @@ "clean:screenshots": "rimraf \"test/screenshots/**/*.@(failed|diff).png\"" }, "dependencies": { - "@finos/perspective": "^2.10.0", - "@finos/perspective-viewer": "^2.10.0", + "@finos/perspective": "workspace:^", + "@finos/perspective-viewer": "workspace:^", "d3": "^7.1.1", "d3-color": "^3.0.1", "gradient-parser": "1.0.2", @@ -33,6 +33,7 @@ "ol": "^5.3.2" }, "devDependencies": { - "@finos/perspective-esbuild-plugin": "^2.10.0" + "@finos/perspective-esbuild-plugin": "workspace:^", + "@prospective.co/procss": "^0.1.15" } } diff --git a/packages/perspective-viewer-openlayers/test/html/superstore.html b/packages/perspective-viewer-openlayers/test/html/superstore.html index 5d2a4f687f..574e6f9580 100644 --- a/packages/perspective-viewer-openlayers/test/html/superstore.html +++ b/packages/perspective-viewer-openlayers/test/html/superstore.html @@ -10,9 +10,9 @@ - - - + + + - - - - - - - - diff --git a/tools/perspective-bench/src/html/index.html b/tools/perspective-bench/src/html/index.html new file mode 100644 index 0000000000..c8eec3efe4 --- /dev/null +++ b/tools/perspective-bench/src/html/index.html @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/perspective-bench/src/js/bench.js b/tools/perspective-bench/src/js/bench.js deleted file mode 100644 index f89c4ba179..0000000000 --- a/tools/perspective-bench/src/js/bench.js +++ /dev/null @@ -1,96 +0,0 @@ -// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ -// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃ -// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃ -// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃ -// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃ -// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ -// ┃ Copyright (c) 2017, the Perspective Authors. ┃ -// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃ -// ┃ This file is part of the Perspective library, distributed under the terms ┃ -// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃ -// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ - -const fs = require("fs"); -const cp = require("child_process"); -const path = require("path"); - -/** - * Convert a list to arrow and write it to disk. `@finos/perspective` is - * imported in this scope to prevent interpreter-wide side effects of the - * library from impacting forked processes, based on an observation that some - * runs inline had anomalies across many observations that couldn't be explained - * by contemporary system load. - * @param {Array} obs_records an array of records to persist - */ -async function persist_to_arrow(obs_records) { - const psp = require("@finos/perspective"); - const table = await psp.table({ - version: "string", - time: "float", - version_idx: "integer", - benchmark: "string", - }); - - const view = await table.view(); - await table.update(obs_records); - const arrow = await view.to_arrow(); - if (!fs.existsSync(path.join(__dirname, "../../dist/"))) { - fs.mkdirSync(path.join(__dirname, "../../dist/")); - } - - fs.writeFileSync( - path.join(__dirname, "../../dist/benchmark-js.arrow"), - Buffer.from(arrow), - "binary" - ); - - fs.writeFileSync( - path.join(__dirname, "../../dist/benchmark.html"), - fs.readFileSync(path.join(__dirname, "../html/benchmark.html")), - "binary" - ); -} - -/** - * Run the benchmarks in a forked process and colelct the observations. - * @param {{version: string, i: number}} version the versions spec to send to - * the child process. - * @returns an array of observation records for this version. - */ -async function benchmark_version(version) { - let obs_records = []; - const worker = cp.fork("./src/js/worker.js"); - let cont; - worker.on("message", (details) => { - if (details.finished) { - cont(); - } else { - obs_records = obs_records.concat(details.obs_records); - } - }); - - worker.send(version); - await new Promise((r) => { - cont = r; - }); - - worker.kill(); - return obs_records; -} - -async function main() { - const pkg_path = path.join(__dirname, "../../package.json"); - const pkg_json = fs.readFileSync(pkg_path); - const pkg_deps = Object.keys(JSON.parse(pkg_json).dependencies); - const versions = ["@finos/perspective", ...pkg_deps]; - - let obs_records = []; - for (let i = 0; i < versions.length; i++) { - const batch = await benchmark_version({ path: versions[i], i }); - obs_records = obs_records.concat(batch); - } - - await persist_to_arrow(obs_records); -} - -main(); diff --git a/tools/perspective-bench/src/js/benchmark.js b/tools/perspective-bench/src/js/benchmark.js new file mode 100644 index 0000000000..183d0dd871 --- /dev/null +++ b/tools/perspective-bench/src/js/benchmark.js @@ -0,0 +1,344 @@ +// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ +// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃ +// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃ +// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃ +// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃ +// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ +// ┃ Copyright (c) 2017, the Perspective Authors. ┃ +// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃ +// ┃ This file is part of the Perspective library, distributed under the terms ┃ +// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃ +// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + +const fs = require("node:fs"); +const cp = require("node:child_process"); +const process = require("node:process"); +const path = require("node:path"); +const microtime = require("microtime"); +const express = require("express"); +const expressWs = require("express-ws"); + +const MAX_ITERATIONS = 200; +const MIN_ITERATIONS = 5; +const WARM_UP_ITERATIONS = 10; + +/** + * Utility function to push/filter. + * @param {*} a + * @param {*} x + */ +function push_if(a, x) { + if (x !== undefined) { + a.push(x); + } +} + +/** + * Calculate avg fora key. + * @param {*} a + * @param {*} key + * @returns + */ +function avg(a, key) { + return a.map((x) => x[key]).reduce((x, y) => x + y, 0) / a.length / 1000; +} + +/** + * Calculate stddev for a key. + * @param {*} array + * @param {*} key + * @returns + */ +function stddev(array, key) { + const n = array.length; + const mean = array.reduce((a, b) => a + b[key] / 1000, 0) / n; + return Math.sqrt( + array + .map((x) => Math.pow(x[key] / 1000 - mean, 2)) + .reduce((a, b) => a + b) / n + ); +} + +/** + * Calculate outliers + * @param {*} someArray + * @returns + */ +function markOutliers(someArray) { + var values = someArray.concat(); + values.sort(function (a, b) { + return a.cpu_time - b.cpu_time; + }); + + var q1 = values[Math.floor(values.length / 4)].cpu_time; + var q3 = values[Math.ceil(values.length * (3 / 4))].cpu_time; + var iqr = q3 - q1; + var maxValue = q3 + iqr * 1.5; + var minValue = q1 - iqr * 1.5; + return someArray.map(function (x) { + x.outlier = !(x.cpu_time <= maxValue && x.cpu_time >= minValue); + return x; + }); +} + +/** + * Convert a list to arrow and write it to disk. `@finos/perspective` is + * imported in this scope to prevent interpreter-wide side effects of the + * library from impacting forked processes, based on an observation that some + * runs inline had anomalies across many observations that couldn't be explained + * by contemporary system load. + * @param {Array} obs_records an array of records to persist + */ +async function persist_to_arrow(benchmarks_table, out_path = "") { + const view = await benchmarks_table.view(); + const arrow = await view.to_arrow(); + fs.writeFileSync(out_path, Buffer.from(arrow), "binary"); +} + +/** + * Run a single benchmark case, reporting the runtime + * @param {*} param0 + * @returns An observation record with timing and metadata fields for a single + * iteration of this case. + */ +async function benchmark_case({ + args, + before, + test, + benchmark, + metadata, + after, + i, +}) { + const args2 = args.slice(); + push_if(args2, await before?.(...args2)); + global.gc(false); + await new Promise(setTimeout); + const start_time = microtime.now(); + const start_cpu = process.cpuUsage(); + const x = await test(...args2); + const end = process.cpuUsage(start_cpu); + const end_time = microtime.now() - start_time; + push_if(args2, x); + await after?.(...args2); + return { + cpu_time: end.user + end.system, + real_time: end_time, + user_time: end.user, + system_time: end.system, + benchmark, + iteration: i, + ...structuredClone(metadata), + }; +} + +/** + * Run the benchmarks in a forked process and colelct the observations. + * @param {{version: string, i: number}} version the versions spec to send to + * the child process. + * @returns an array of observation records for this version. + */ +async function benchmark_version(version, benchmarks_table) { + const suite_path = path.join(process.argv[1]); + let stats = []; + const worker = cp.fork(suite_path, { + execArgv: ["--expose-gc"], + env: { BENCH_FLAG: "1" }, + }); + + let cont; + worker.on("message", (details) => { + if (details.finished) { + cont(); + } else { + benchmarks_table.update(details.obs_records); + stats.push(details.stats); + } + }); + + worker.send({ + ...version, + stats, + }); + + await new Promise((r) => { + cont = r; + }); + + worker.kill(); + return { stats }; +} + +/** + * Register a benchmark for a test case. + * @param {*} param0 + */ +exports.benchmark = async function benchmark({ + name: benchmark, + before, + before_all, + test, + after, + after_all, + args = [], + metadata = {}, + warm_up_iterations = WARM_UP_ITERATIONS, + max_iterations = MAX_ITERATIONS, + min_iterations = MIN_ITERATIONS, + max_time = 3_000_000, +} = {}) { + let obs_records = []; + push_if(args, await before_all?.(...args)); + const start_time = microtime.now(); + for (let i = 0; i < warm_up_iterations; i++) { + await benchmark_case({ + args, + before, + test, + benchmark, + metadata, + after, + i, + }); + } + + let i; + for (i = 0; i < max_iterations; i++) { + if (microtime.now() - start_time > max_time && i >= min_iterations) { + break; + } + + obs_records.push( + await benchmark_case({ + args, + before, + test, + benchmark, + metadata, + after, + i, + }) + ); + } + + obs_records = markOutliers(obs_records); + const filtered = obs_records.filter((x) => !x.outlier); + const n_outliers = obs_records.length - filtered.length; + const filtered_avg_cpu = avg(filtered, "cpu_time"); + const filtered_avg_time = avg(filtered, "real_time").toFixed(3); + const stddev_cpu = stddev(filtered, "cpu_time").toFixed(3); + const stats = { + benchmark, + metadata, + filtered_avg_cpu: filtered_avg_cpu.toFixed(3), + stddev_percent: ((stddev_cpu / filtered_avg_cpu) * 100).toFixed(1), + stddev_cpu, + filtered_avg_time, + hr_time: avg(filtered, "hr_time"), + iterations: i, + non_outliers: i - n_outliers, + }; + + console.log( + ` - ${stats.filtered_avg_cpu}ms +/-${stats.stddev_percent}% (CPU), ${stats.filtered_avg_time}ms (Real) ${stats.non_outliers}/${stats.iterations} iterations - ${benchmark}` + ); + + await after_all?.(...args); + process.send({ obs_records, stats }); +}; + +function buffer_to_arraybuffer(buffer) { + return new Int8Array( + buffer.buffer.slice( + buffer.byteOffset, + buffer.byteOffset + buffer.length + ) + ); +} + +/** + * Host a Perspective server to view the live benchmark data as it accumulates. + * @param {*} param0 + * @returns + */ +function start_server({ cwd_static_file_handler, make_server }) { + const app = expressWs(express()).app; + app.ws("/subscribe", (ws) => { + const server = make_server((proto) => + ws.send(buffer_to_arraybuffer(proto)) + ); + + ws.on("message", (proto) => + server.handle_message(buffer_to_arraybuffer(proto)) + ); + }); + + app.use("/", (x, y) => + cwd_static_file_handler(x, y, ["src/html/", "../.."]) + ); + + const server = app.listen(8081, () => { + const port = server.address().port; + console.log(`Live benchmarks at http://localhost:${port}\n`); + }); + + return server; +} + +/** + * Register a suite of benchmarks to run against a set of packages with + * similar APIs. + * @param {*} versions + * @param {*} run_version_callback + */ +exports.suite = async function ( + versions, + out_path, + run_version_callback, + start_server_callback +) { + if (!!process.env.BENCH_FLAG) { + process.on("message", async function bench_all({ path, i }) { + await run_version_callback(path, i); + process.send({ finished: true }); + }); + } else { + const psp = await import("@finos/perspective"); + const benchmarks_table = await psp.default.table( + { + version: "string", + cpu_time: "float", + system_time: "float", + user_time: "float", + real_time: "float", + version_idx: "integer", + benchmark: "string", + outlier: "boolean", + }, + { name: "benchmarks" } + ); + + const app = start_server(psp); + + for (let i = 0; i < versions.length; i++) { + let s; + if (start_server_callback) { + s = await start_server_callback(versions[i]); + } + + await Promise.all([ + benchmark_version({ path: versions[i], i }, benchmarks_table), + // benchmark_version({ path: versions[i], i }, benchmarks_table), + // benchmark_version({ path: versions[i], i }, benchmarks_table), + // benchmark_version({ path: versions[i], i }, benchmarks_table), + ]); + + await persist_to_arrow(benchmarks_table, out_path); + if (s) { + await s.close(); + } + } + + await app.close(); + } +}; diff --git a/tools/perspective-bench/src/js/worker.js b/tools/perspective-bench/src/js/worker.js deleted file mode 100644 index e391eede98..0000000000 --- a/tools/perspective-bench/src/js/worker.js +++ /dev/null @@ -1,296 +0,0 @@ -// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ -// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃ -// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃ -// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃ -// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃ -// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ -// ┃ Copyright (c) 2017, the Perspective Authors. ┃ -// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃ -// ┃ This file is part of the Perspective library, distributed under the terms ┃ -// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃ -// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ - -const fs = require("fs"); -const microtime = require("microtime"); - -let PERSPECTIVE, VERSION; -function load_version(path, i) { - const module = require(path); - let { version } = JSON.parse( - fs.readFileSync(require.resolve(`${path}/package.json`)) - ); - - PERSPECTIVE = module.default || module; - PERSPECTIVE.version = version.split(".").map((x) => parseInt(x)); - - if (i === 0) { - version = `${version} (master)`; - } - - console.log(`${version}`); - - VERSION = version; - VERSION_ID = i; -} - -const SUPERSTORE_ARROW = fs.readFileSync( - require.resolve("superstore-arrow/superstore.arrow") -).buffer; - -const SUPERSTORE_FEATHER = fs.readFileSync( - require.resolve("superstore-arrow/superstore.lz4.arrow") -).buffer; - -function new_table(perspective) { - const [M, m, _] = perspective.version; - if (M >= 2 && m >= 5) { - return SUPERSTORE_ARROW.slice(); - } else { - return SUPERSTORE_ARROW.slice(); - } -} - -const ITERATIONS = 10; -const WARM_UP_ITERATIONS = 1; - -Object.defineProperty(Array.prototype, "push_if", { - value: function (x) { - if (x !== undefined) { - this.push(x); - } - }, -}); - -Object.defineProperty(Array.prototype, "sum", { - value: function () { - return this.reduce((x, y) => x + y, 0); - }, -}); - -async function benchmark({ name, before, before_all, test, after, after_all }) { - let obs_records = []; - const args = []; - args.push_if(await before_all?.(PERSPECTIVE)); - const observations = []; - for (let i = 0; i < ITERATIONS + WARM_UP_ITERATIONS; i++) { - const args2 = args.slice(); - args2.push_if(await before?.(PERSPECTIVE, ...args2)); - const start = microtime.now(); - args2.push_if(await test(PERSPECTIVE, ...args2)); - if (i >= WARM_UP_ITERATIONS) { - observations.push(microtime.now() - start); - } - - await after?.(PERSPECTIVE, ...args2); - } - - const avg = observations.sum() / observations.length / 1000; - console.log(` - ${avg.toFixed(3)}ms - ${name}`); - await after_all?.(PERSPECTIVE, ...args); - - obs_records = obs_records.concat( - observations.map((obs) => ({ - version: VERSION, - version_idx: VERSION_ID, - time: obs, - benchmark: name, - })) - ); - - process.send({ obs_records }); -} - -async function to_data_suite() { - async function before_all(perspective) { - const table = await perspective.table(new_table(perspective)); - const view = await table.view(); - return { table, view }; - } - - async function after_all(perspective, { table, view }) { - await view.delete(); - await table.delete(); - } - - await benchmark({ - name: `.to_arrow()`, - before_all, - after_all, - async test(_perspective, { view }) { - const _arrow = await view.to_arrow(); - }, - }); - - await benchmark({ - name: `.to_csv()`, - before_all, - after_all, - async test(_perspective, { view }) { - const _csv = await view.to_csv(); - }, - }); - - await benchmark({ - name: `.to_columns()`, - before_all, - after_all, - async test(_perspective, { view }) { - const _columns = await view.to_columns(); - }, - }); - - await benchmark({ - name: `.to_json()`, - before_all, - after_all, - async test(_perspective, { view }) { - const _json = await view.to_json(); - }, - }); -} - -async function view_suite() { - async function before_all(perspective) { - const table = await perspective.table(new_table(perspective)); - for (let i = 0; i < 4; i++) { - await table.update(new_table(perspective)); - } - - const schema = await table.schema(); - - return { table, schema }; - } - - async function after_all(perspective, { table }) { - await table.delete(); - } - - async function after(perspective, { table }, view) { - await view.delete(); - } - - await benchmark({ - name: `.view()`, - before_all, - after_all, - after, - async test(_perspective, { table }) { - return await table.view(); - }, - }); - - await benchmark({ - name: `.view({group_by})`, - before_all, - after_all, - after, - async test(perspective, { table }) { - const [M, m, _] = perspective.version; - if ((M === 1 && m >= 2) || M === 2) { - return await table.view({ group_by: ["Product Name"] }); - } else { - return await table.view({ row_pivots: ["Product Name"] }); - } - }, - }); - - // await benchmark({ - // name: `.view({expressions: ["Sales" + "Profit"].reduce((x, y) => Object.assign(x, {[y]: y}), {})})`, - // before_all, - // after_all, - // after, - // async test(perspective, { table, schema }) { - // const [M, m, _] = perspective.version; - // // const columns = Object.keys(schema); - // columns = [`"Sales" + "Profit"`]; - // if (M === 0 && m < 9) { - - // } else if ((M === 1 && m >= 2) || M === 2) { - // return await table.view({ - // columns, - // group_by: ["Product Name"], - // expressions: [`"Sales" + "Profit"`].reduce((x, y) => Object.assign(x, {[y]: y}), {}), - // }); - // } else { - // return await table.view({ - // columns, - // row_pivots: ["Product Name"], - // expressions: [`"Sales" + "Profit"`].reduce((x, y) => Object.assign(x, {[y]: y}), {}), - // }); - // } - // }, - // }); - - await benchmark({ - name: `.view({group_by, aggregates: "median"})`, - before_all, - after_all, - after, - async test(perspective, { table, schema }) { - const columns = ["Sales", "Quantity", "City"]; - const aggregates = Object.fromEntries( - Object.keys(schema).map((x) => [x, "median"]) - ); - const [M, m, _] = perspective.version; - if ((M === 1 && m >= 2) || M === 2) { - return await table.view({ - group_by: ["State"], - aggregates, - columns, - }); - } else { - return await table.view({ - row_pivots: ["State"], - aggregates, - columns, - }); - } - }, - }); -} - -async function table_suite() { - async function before_all(perspective) { - const table = await perspective.table(new_table(perspective)); - const view = await table.view(); - const csv = await view.to_csv(); - await view.delete(); - await table.delete(); - return { csv }; - } - - await benchmark({ - name: `.table(arrow)`, - before_all, - async after(_perspective, _, table) { - await table.delete(); - }, - async test(perspective) { - return await perspective.table(new_table(perspective)); - }, - }); - - await benchmark({ - name: `.table(csv)`, - before_all, - async after(_perspective, _, table) { - await table.delete(); - }, - - async test(perspective, { table, csv }) { - return await perspective.table(csv); - }, - }); -} - -async function bench_all() { - await table_suite(); - await view_suite(); - await to_data_suite(); - process.send({ finished: true }); -} - -process.on("message", ({ path, i }) => { - load_version(path, i); - bench_all(); -}); diff --git a/tools/perspective-bench/yarn.lock b/tools/perspective-bench/yarn.lock deleted file mode 100644 index 7822412291..0000000000 --- a/tools/perspective-bench/yarn.lock +++ /dev/null @@ -1,402 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@babel/runtime@^7.3.4", "@babel/runtime@^7.8.4": - version "7.22.10" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.10.tgz#ae3e9631fd947cb7e3610d3e9d8fef5f76696682" - integrity sha512-21t/fkKLMZI4pqP2wlmsQAWnYW1PDyKyyUV4vCi+B25ydmdaYTKXPwCj0BzSUnZf4seIiYvSA3jcZ3gdsMFkLQ== - dependencies: - regenerator-runtime "^0.14.0" - -async-limiter@~1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" - integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== - -core-js@^2.6.9: - version "2.6.12" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec" - integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== - -core-js@^3.6.4: - version "3.32.0" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.32.0.tgz#7643d353d899747ab1f8b03d2803b0312a0fb3b6" - integrity sha512-rd4rYZNlF3WuoYuRIDEmbR/ga9CeuWX9U05umAvgrrZoHY4Z++cp/xwPQMvUpBB4Ag6J8KfD80G0zwCyaSxDww== - -d3-array@^1.2.1: - version "1.2.4" - resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-1.2.4.tgz#635ce4d5eea759f6f605863dbcfc30edc737f71f" - integrity sha512-KHW6M86R+FUPYGb3R5XiYjXPq7VzwxZ22buHhAEVG5ztoEcZZMLov530mmccaqA1GghZArjQV46fuc8kUqhhHw== - -detectie@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/detectie/-/detectie-1.0.0.tgz#66b2cae2236d4d29ef71161180957bf89fbe535d" - integrity sha512-1zThEupxHYmA+HBWT1BDjxwvppzC8mMBNlt+94rSqrZKvbew//VdHOFsvFO1eG8kdwEJub05qR8vfurXPu3UVg== - -fflate@^0.7.2, fflate@^0.7.4: - version "0.7.4" - resolved "https://registry.yarnpkg.com/fflate/-/fflate-0.7.4.tgz#61587e5d958fdabb5a9368a302c25363f4f69f50" - integrity sha512-5u2V/CDW15QM1XbbgS+0DfPxVB+jUKhWEKuuFuHncbk3tEEqzmoXL+2KyOFuKGqOnmdIy0/davWF1CkuwtibCw== - -flatbuffers@^1.10.2: - version "1.12.0" - resolved "https://registry.yarnpkg.com/flatbuffers/-/flatbuffers-1.12.0.tgz#72e87d1726cb1b216e839ef02658aa87dcef68aa" - integrity sha512-c7CZADjRcl6j0PlvFy0ZqXQ67qSEZfrVPynmnL+2zPc+NtMvrF8Y0QceMo7QqnSPc7+uWjUIAbvCQ5WIKlMVdQ== - -jsverify@^0.8.4: - version "0.8.4" - resolved "https://registry.yarnpkg.com/jsverify/-/jsverify-0.8.4.tgz#b914ccc024103d946b503f18ee780ec43febeece" - integrity sha512-nUG73Sfi8L4eOkc7pv9sflgAm43v+z6XMuePGVdRoBUxBLJiVcMcf3Xgc4h19eHHF3JwsaagOkUu825UnPBLJw== - dependencies: - lazy-seq "^1.0.0" - rc4 "~0.1.5" - trampa "^1.0.0" - typify-parser "^1.1.0" - -lazy-seq@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/lazy-seq/-/lazy-seq-1.0.0.tgz#880cb8aab256026382e02f53ec089682a74c5b6a" - integrity sha512-AQ4vRcnULa7FX6R6YTAjKQAE1MuEThidVQm0TEtTpedaBpnOwid5k6go16E5NDkafel1xAsZL73WkwdG03IzhA== - -lodash@^4.17.4: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" - integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== - -microtime@^3.0.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/microtime/-/microtime-3.1.1.tgz#f3ce12f4091c55fb2982c87205e2e7698afdcd0c" - integrity sha512-to1r7o24cDsud9IhN6/8wGmMx5R2kT0w2Xwm5okbYI3d1dk6Xv0m+Z+jg2vS9pt+ocgQHTCtgs/YuyJhySzxNg== - dependencies: - node-addon-api "^5.0.0" - node-gyp-build "^4.4.0" - -moment@^2.19.1: - version "2.29.4" - resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108" - integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== - -node-addon-api@^5.0.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-5.1.0.tgz#49da1ca055e109a23d537e9de43c09cca21eb762" - integrity sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA== - -node-gyp-build@^4.4.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.6.0.tgz#0c52e4cbf54bbd28b709820ef7b6a3c2d6209055" - integrity sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ== - -papaparse@^4.3.6: - version "4.6.3" - resolved "https://registry.yarnpkg.com/papaparse/-/papaparse-4.6.3.tgz#742e5eaaa97fa6c7e1358d2934d8f18f44aee781" - integrity sha512-LRq7BrHC2kHPBYSD50aKuw/B/dGcg29omyJbKWY3KsYUZU69RKwaBHu13jGmCYBtOc4odsLCrFyk6imfyNubJQ== - -papaparse@^5.2.0: - version "5.4.1" - resolved "https://registry.yarnpkg.com/papaparse/-/papaparse-5.4.1.tgz#f45c0f871853578bd3a30f92d96fdcfb6ebea127" - integrity sha512-HipMsgJkZu8br23pW15uvo6sib6wne/4woLZPlFf3rpDyMe9ywEXUsuD7+6K9PRkJlVT51j/sCOYDKGGS3ZJrw== - -"perspective-0-10-0@npm:@finos/perspective@0.10.0": - version "0.10.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-0.10.0.tgz#7eea7701e533dc3ee52e33760ca06e3b77328b32" - integrity sha512-PmsUiaOjChJaivDxGLNH8vAw8lG98OLlPjKCvci3iAFAEclGKMhSkHP/qYDU+NUZSPqsvk2Rf66TFsK8aiy/jg== - dependencies: - "@babel/runtime" "^7.8.4" - core-js "^3.6.4" - d3-array "^1.2.1" - detectie "1.0.0" - flatbuffers "^1.10.2" - lodash "^4.17.4" - text-encoding-utf-8 "^1.0.2" - tslib "^1.9.3" - ws "^6.1.2" - -"perspective-0-4-0@npm:@finos/perspective@0.4.0": - version "0.4.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-0.4.0.tgz#a1546bd824a8a55585104ef9b7569ac30ec422a9" - integrity sha512-1hbfGSnjpRUUDGR2cf3okI9axJyrx2vp+Js/OJWF7b2PGQgaPBw4gJzoqArEUYDhB2WnGFIkEFiV+RANmxr7AQ== - dependencies: - "@babel/runtime" "^7.3.4" - core-js "^2.6.9" - d3-array "^1.2.1" - detectie "1.0.0" - flatbuffers "^1.10.2" - lodash "^4.17.4" - moment "^2.19.1" - papaparse "^4.3.6" - text-encoding-utf-8 "^1.0.2" - tslib "^1.9.3" - ws "^6.1.2" - -"perspective-0-5-0@npm:@finos/perspective@0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-0.5.0.tgz#2ccd24cf0889e6b56d18591a46dfc07829c141e4" - integrity sha512-VHKBjB8Q6nHaQeGJdwX7wnhna4WSMDpVbWoEWbICe7b/ooV4T3kpYk8n8dpzIJpAMdPuN4TZjxRylaQdh4HiRw== - dependencies: - "@babel/runtime" "^7.8.4" - core-js "^3.6.4" - d3-array "^1.2.1" - detectie "1.0.0" - flatbuffers "^1.10.2" - jsverify "^0.8.4" - lodash "^4.17.4" - moment "^2.19.1" - papaparse "^5.2.0" - text-encoding-utf-8 "^1.0.2" - tslib "^1.9.3" - ws "^6.1.2" - -"perspective-0-6-0@npm:@finos/perspective@0.6.0": - version "0.6.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-0.6.0.tgz#52dc2ba88b184094e0ee1d50d15b56a774ea76ce" - integrity sha512-qVEz6aD/lS8pskmrM6gZwfVQo5Uti2wUG6ncqvt3FapdxyZmvNYceBboXdl5c+j7bQqLdh3i9LHt1+RZXlmRkA== - dependencies: - "@babel/runtime" "^7.8.4" - core-js "^3.6.4" - d3-array "^1.2.1" - detectie "1.0.0" - flatbuffers "^1.10.2" - lodash "^4.17.4" - text-encoding-utf-8 "^1.0.2" - tslib "^1.9.3" - ws "^6.1.2" - -"perspective-0-7-0@npm:@finos/perspective@0.7.0": - version "0.7.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-0.7.0.tgz#f10cb51b186021e08b2d422b1f2a4573d8a71fc0" - integrity sha512-2WPlCu4t50uPJvL9RbKxhffRxdyOFUGed5e2FsZVytkZ8kk79Sbl7i6uPvwud1UXtDfnaVPphrsTSpgyxYZy0A== - dependencies: - "@babel/runtime" "^7.8.4" - core-js "^3.6.4" - d3-array "^1.2.1" - detectie "1.0.0" - flatbuffers "^1.10.2" - lodash "^4.17.4" - text-encoding-utf-8 "^1.0.2" - tslib "^1.9.3" - ws "^6.1.2" - -"perspective-0-8-0@npm:@finos/perspective@0.8.0": - version "0.8.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-0.8.0.tgz#2dba84317c2e414d913a12fa48767c9187dc0b46" - integrity sha512-QhZNx6dyJ1N3GZzSWeFEzH6tzGqdf05gaYXSaB6TuHFN/6N2YcthrbotbMh78ouGYVwbtBOo4vsM1mJAPAu84w== - dependencies: - "@babel/runtime" "^7.8.4" - core-js "^3.6.4" - d3-array "^1.2.1" - detectie "1.0.0" - flatbuffers "^1.10.2" - lodash "^4.17.4" - text-encoding-utf-8 "^1.0.2" - tslib "^1.9.3" - ws "^6.1.2" - -"perspective-0-9-0@npm:@finos/perspective@0.9.0": - version "0.9.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-0.9.0.tgz#a61ccd0c519bac037477491c93d046d5239b34f7" - integrity sha512-CkQ8thiCcSLpIr08aMYaYaMcHgk0Cj2PS1TPpz0hbwlR27UZeItgqrR4LNb3Fl4O6lZ3DaBQXIlqV05sP9yvGg== - dependencies: - "@babel/runtime" "^7.8.4" - core-js "^3.6.4" - d3-array "^1.2.1" - detectie "1.0.0" - flatbuffers "^1.10.2" - lodash "^4.17.4" - text-encoding-utf-8 "^1.0.2" - tslib "^1.9.3" - ws "^6.1.2" - -"perspective-1-0-0@npm:@finos/perspective@1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-1.0.0.tgz#53831540b3d05a0d5d6f54602c83ea3f33e7b3f1" - integrity sha512-WTi0hxM+EpWTpzqKp5w+ulGepUX6JGp+cwitSdCVHNsodRfatUNwVzdliVD5O8f2UMrkKMP4Dqwrm2WmxAj8Bg== - dependencies: - "@babel/runtime" "^7.8.4" - core-js "^3.6.4" - d3-array "^1.2.1" - detectie "1.0.0" - flatbuffers "^1.10.2" - lodash "^4.17.4" - text-encoding-utf-8 "^1.0.2" - tslib "^1.9.3" - ws "^6.1.2" - -"perspective-1-1-0@npm:@finos/perspective@1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-1.1.0.tgz#e68c5b2527e9e3fe4ca1ddd197f50fb5fc819035" - integrity sha512-UHqkIKXmJ+q++hhVrVe9uFuNXifeyImHinUOi1Vyw172GpWZE1w8b53zRRk9P2U3WtYm7x7Jrhp1ILqkZ5F+aw== - dependencies: - fflate "^0.7.2" - ws "^6.1.2" - -"perspective-1-2-0@npm:@finos/perspective@1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-1.2.0.tgz#cc6130b4501154dcc47089062c8a765cd0f8decf" - integrity sha512-yOg83p/Z8agzq34CzkU3FzaNsdlWcr8yEDNScI1zyo2n39pvfhfCkM+d5RE/n9E9IDinn2lgk4L11ymsI79iUA== - dependencies: - fflate "^0.7.2" - ws "^6.1.2" - -"perspective-1-3-0@npm:@finos/perspective@1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-1.3.0.tgz#195e90b0248b74dd19f1203618b04c5e574a6d33" - integrity sha512-+Ll7l9aZTxhKcbdQC22Gj3A5CmLKCWTHF6AmXqopPq0dzsHHbmK+ME688zNwpb7aip8OiReOmBx9eh7LZKiDOw== - dependencies: - fflate "^0.7.2" - ws "^6.1.2" - -"perspective-1-4-0@npm:@finos/perspective@1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-1.4.0.tgz#0a7eb25fc8a711ebf74905cb5228a0229298de47" - integrity sha512-I12CehEq+6VljBNf/cHHgsTbPzYZcoINB/dTAJRcWUmGBMIuOzk4GYsQrNP6ekJj69gqM4C5a2rCeg7gurEN0g== - dependencies: - fflate "^0.7.2" - ws "^6.1.2" - -"perspective-1-5-0@npm:@finos/perspective@1.5.0": - version "1.5.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-1.5.0.tgz#717c4caf8d4da9ed9e6f25c7c21edee927225dde" - integrity sha512-g57dcsdwaHleFp2m7wyZSnEcc8FAigd7Gvw/l5+gwyeZugQpezfmKf1loGYwjYzzun7EMlyvPK5kYbRauAcjVg== - dependencies: - fflate "^0.7.2" - ws "^6.1.2" - -"perspective-1-6-0@npm:@finos/perspective@1.6.0": - version "1.6.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-1.6.0.tgz#e1c768ddb1c9ed4d7788238137a3d42e1297b9d1" - integrity sha512-D+4JYWPqGF4o1kDqpqDnjhLCCq8/nnWTChBAltnk0qtrDOWDibeYjT2cssik9EQsxkGdTTTvxMJsyohWJPitZg== - dependencies: - fflate "^0.7.2" - ws "^6.1.2" - -"perspective-1-7-0@npm:@finos/perspective@1.7.0": - version "1.7.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-1.7.0.tgz#3333ecd2f5706844ff51dac09d9d8485c5a95b15" - integrity sha512-Src3etxrClxAQMtbl5zVXRYEvlulIz/CMuZbU/t30FyQuyhw7g5QyBRqff3DUrS7oBz7A32sDNhZT+Qvp5DsrA== - dependencies: - fflate "^0.7.2" - ws "^6.1.2" - -"perspective-1-8-0@npm:@finos/perspective@1.8.0": - version "1.8.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-1.8.0.tgz#210091368d7668b10248efbe7ed5013fdbb9e016" - integrity sha512-fuQCWiV8079ZOJxf3D95NpJAYogNjVvJ/ksvQs8rbBbDRkGDOppte5FNmLaiDbzb1rHxCIKE6vL3bCSsb8Nc7A== - dependencies: - fflate "^0.7.2" - ws "^6.1.2" - -"perspective-1-9-0@npm:@finos/perspective@1.9.0": - version "1.9.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-1.9.0.tgz#a922ea92fbe906c1a1034bb9ba361c1725047d16" - integrity sha512-856/Pxl+jg2zoxk9q9NA4iA/RHw/9VKvFJEaVC27DtDWkMQaS1SEeuQOtJWQtA7CDS9rHXk5G/I6bY1eEVyRSA== - dependencies: - fflate "^0.7.2" - ws "^6.1.2" - -"perspective-2-0-0@npm:@finos/perspective@2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-2.0.0.tgz#28cb7460af1f35a291c3de863d1ab4bf9d8c1598" - integrity sha512-JLrVRPDoLO8SY3w2rhDWrSE6mU8NX849oIXyWToj479eC5PhYzDpOScr8VafkVPUd+vStyffMLiR43WwOFIqrg== - dependencies: - fflate "^0.7.4" - ws "^6.1.2" - -"perspective-2-1-0@npm:@finos/perspective@2.1.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-2.1.0.tgz#b083029bd9f4bc808cb76b1a0ecfc7d5816f42e2" - integrity sha512-NgDJtM7BbPEry574qQuSkzKEDdhSBSJecFeMyTOOlfzQ8cldR9xMg7/Lo5/NQWWi5cKuyzTWjTphOn6bP2M6YA== - dependencies: - fflate "^0.7.4" - ws "^6.1.2" - -"perspective-2-2-0@npm:@finos/perspective@2.2.0": - version "2.2.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-2.2.0.tgz#5f99b009004c93e69bb58e27540ebbdb7a2a071a" - integrity sha512-OPSFrwnaUyDnAL4jQb4kICMDBO6tqZ1vGGgd9xgTssB0VToIXObPMzlNAFtuWDL7qwiyxupqMYkjXMhoRGY7pA== - dependencies: - fflate "^0.7.4" - ws "^6.1.2" - -"perspective-2-3-0@npm:@finos/perspective@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-2.3.0.tgz#485f11a712f5faa65264ab2f5debfe6e66e0cd7e" - integrity sha512-SnsdYdYHXKarG/mFIUcZmUiTKo9yccnbd+r0a9BRUcY3p9VuDPdp8fnPanoXLKi1xUkIz7RJSSTVpbPL1T+jWg== - dependencies: - fflate "^0.7.4" - ws "^6.1.2" - -"perspective-2-4-0@npm:@finos/perspective@2.4.0": - version "2.4.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-2.4.0.tgz#932525159f4b15c4d3b21675c222dcd53d5b0bc7" - integrity sha512-JPYGAZq0WmcYUKXnyqdgZW+UPvgSAiWHmYx6I+ZVbjz1TIuuPFZ5Yw1n/VumUrjNGn/XNl7WnUUovh31Tez7tQ== - dependencies: - fflate "^0.7.4" - ws "^6.1.2" - -"perspective-2-5-0@npm:@finos/perspective@2.5.0": - version "2.5.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-2.5.0.tgz#590cbedac0768b0ce82e3276f3b602de8a908058" - integrity sha512-4YUs0oLvvGG4HQzqLJQCkRic+FW4h623etmcjBSuqcC3tLT+OMFxNZ8Z3NjS6uvdFu6vPTO7fAA0RnTdZKhXKg== - dependencies: - fflate "^0.7.4" - ws "^6.1.2" - -"perspective-2-6-0@npm:@finos/perspective@2.6.0": - version "2.6.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-2.6.0.tgz#dc4e6f0ddebbad475dc0c33b14e5aaff7875cdda" - integrity sha512-3YIBv4h1wQl8FBuabWLIV6H5aS1ufDC4/xjsrp3bIL5y5dgYwV5Uqr3gFj6cpmbWn0jNaFb6pEVm3Scn2QyDNw== - dependencies: - fflate "^0.7.4" - stoppable "1.1.0" - ws "^6.1.2" - -"perspective-2-7-0@npm:@finos/perspective@2.7.0": - version "2.7.0" - resolved "https://registry.yarnpkg.com/@finos/perspective/-/perspective-2.7.0.tgz#8a99a070cd679bce721c96cf5d188d1ff7c60395" - integrity sha512-/9UHAnH1iW8ANnfplDLGMS60dx3R8UWRoL0dKTx9A3jNbeP2l+5wd0twsal00FqR/wgUomd3+tbbkzOIMsNclA== - dependencies: - stoppable "1.1.0" - ws "^6.1.2" - -rc4@~0.1.5: - version "0.1.5" - resolved "https://registry.yarnpkg.com/rc4/-/rc4-0.1.5.tgz#08c6e04a0168f6eb621c22ab6cb1151bd9f4a64d" - integrity sha512-xdDTNV90z5x5u25Oc871Xnvu7yAr4tV7Eluh0VSvrhUkry39q1k+zkz7xroqHbRq+8PiazySHJPArqifUvz9VA== - -regenerator-runtime@^0.14.0: - version "0.14.0" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz#5e19d68eb12d486f797e15a3c6a918f7cec5eb45" - integrity sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA== - -stoppable@1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/stoppable/-/stoppable-1.1.0.tgz#32da568e83ea488b08e4d7ea2c3bcc9d75015d5b" - integrity sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw== - -text-encoding-utf-8@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz#585b62197b0ae437e3c7b5d0af27ac1021e10d13" - integrity sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg== - -trampa@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/trampa/-/trampa-1.0.1.tgz#b866bc192331f64b4f57a8acf4ab71d0e900b692" - integrity sha512-93WeyHNuRggPEsfCe+yHxCgM2s6H3Q8Wmlt6b6ObJL8qc7eZlRaFjQxwTrB+zbvGtlDRnAkMoYYo3+2uH/fEwA== - -tslib@^1.9.3: - version "1.14.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" - integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== - -typify-parser@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/typify-parser/-/typify-parser-1.1.0.tgz#ac73bfa5f25343468e2d0f3346c6117bc03d3c99" - integrity sha512-p5+L1sc6Al3bcStMwiZNxDh4ii4JxL+famEbSIUuOUMVoNn9Nz27AT1jL3x7poMHxqKK0UQIUAp5lGkKbyKkFA== - -ws@^6.1.2: - version "6.2.2" - resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.2.tgz#dd5cdbd57a9979916097652d78f1cc5faea0c32e" - integrity sha512-zmhltoSR8u1cnDsD43TX59mzoMZsLKqUweyYBAIvTngR3shc0W6aOZylZmq/7hqyVxPdi+5Ud2QInblgyE72fw== - dependencies: - async-limiter "~1.0.0" diff --git a/tools/perspective-scripts/bench.mjs b/tools/perspective-scripts/bench.mjs index ed3bb57a5b..b7212f0a44 100644 --- a/tools/perspective-scripts/bench.mjs +++ b/tools/perspective-scripts/bench.mjs @@ -14,12 +14,9 @@ import * as dotenv from "dotenv"; import sh from "./sh.mjs"; dotenv.config({ path: "./.perspectiverc" }); -const args = process.argv.slice(2); if (process.env.PSP_PROJECT === undefined || process.env.PSP_PROJECT === "js") { - sh`yarn && nice -n 0 npm run bench` - .cwd("tools/perspective-bench") - .runSync(); + sh`pnpm run --recursive --filter perspective-bench bench`.runSync(); } else { sh`PYTHONPATH=python/perspective nice -n 0 python3 python/perspective/bench/runtime/run_perspective_benchmark.py` // .env({ PYTHONPATH: "python/perspective" }) diff --git a/tools/perspective-scripts/build.mjs b/tools/perspective-scripts/build.mjs index a21ecacbab..06febbe2ab 100644 --- a/tools/perspective-scripts/build.mjs +++ b/tools/perspective-scripts/build.mjs @@ -12,6 +12,7 @@ import * as fs from "fs"; import * as dotenv from "dotenv"; +import { run_with_scope } from "./sh_perspective.mjs"; dotenv.config({ path: "./.perspectiverc" }); diff --git a/tools/perspective-scripts/lint_cpp.mjs b/tools/perspective-scripts/lint_cpp.mjs index 7dbf027438..e532612404 100644 --- a/tools/perspective-scripts/lint_cpp.mjs +++ b/tools/perspective-scripts/lint_cpp.mjs @@ -45,7 +45,7 @@ export function tidyLint(flags) { * @param {string} sourceDir */ function tidy(buildDir, sourceDir, flags) { - const ctpath = CLANG_TIDY_PATH; + const ctpath = CLANG_TIDY; // if (!fs.existsSync(ctpath)) { // console.warn("run-clang-tidy not found, skipping lint"); // return; @@ -62,24 +62,17 @@ function tidy(buildDir, sourceDir, flags) { } } -const CLANG_TIDY_PATH = fs.existsSync(`${__dirname}/../../.llvm`) - ? `${__dirname}/../../.llvm/bin/run-clang-tidy` - : `run-clang-tidy`; - -const CLANG_FMT_PATH = fs.existsSync(`${__dirname}/../../.llvm`) - ? `${__dirname}/../../.llvm/bin/clang-format` - : `clang-format`; - -console.log(`${__dirname}/../../.llvm`); +const CLANG_TIDY = `run-clang-tidy`; +const CLANG_FORMAT = `clang-format`; function formatLint(dir) { - execSync(`${CLANG_FMT_PATH} -style=file --dry-run -Werror ${dir}`, { + execSync(`${CLANG_FORMAT} -style=file --dry-run -Werror ${dir}`, { stdio: "inherit", }); } function clangFormatFix(dir) { - execSync(`${CLANG_FMT_PATH} -style=file -i ${dir}`, { + execSync(`${CLANG_FORMAT} -style=file -i ${dir}`, { stdio: "inherit", }); } diff --git a/tools/perspective-scripts/lint_headers.mjs b/tools/perspective-scripts/lint_headers.mjs index 540e2f11a6..3ff160e4a3 100644 --- a/tools/perspective-scripts/lint_headers.mjs +++ b/tools/perspective-scripts/lint_headers.mjs @@ -23,6 +23,8 @@ const IGNORE_PATHS = fs_sync .concat([ "llvm/*", "cmake/*", + "pnpm-lock.yaml", + "pnpm-workspace.yaml", "cpp/perspective/src/cpp/vendor", "cpp/perspective/src/include/perspective/vendor", "python/perspective/perspective/core/_version.py", diff --git a/tools/perspective-scripts/sh_perspective.mjs b/tools/perspective-scripts/sh_perspective.mjs index f6d47c5354..73bba7be99 100644 --- a/tools/perspective-scripts/sh_perspective.mjs +++ b/tools/perspective-scripts/sh_perspective.mjs @@ -18,6 +18,7 @@ import rimraf from "rimraf"; import { createRequire } from "node:module"; import sh from "./sh.mjs"; import * as url from "url"; +import { execSync } from "child_process"; dotenv.config({ path: "./.perspectiverc" }); process.env.FORCE_COLOR = true; @@ -133,85 +134,13 @@ export const run_with_scope = async function run_recursive(strings, ...args) { let scope = process.env.PACKAGE && process.env.PACKAGE !== "" ? process.env.PACKAGE.split(",").map((x) => `@finos/${x}`) - : null; + : []; - const stdout = await sh`npm ls --depth 1 --json`.exec({ silent: true }); - const workspaces = JSON.parse(stdout.toString()); - const compiled = new Set( - Object.keys(workspaces.dependencies).filter( - (x) => !workspaces.dependencies[x].resolved?.startsWith("file:") - ) - ); - - let uncompiled = Object.keys(workspaces.dependencies).filter( - (x) => - workspaces.dependencies[x].resolved?.startsWith("file:") && - (scope === null || scope.indexOf(x) >= 0) - ); - - const is_valid = new Set(uncompiled); - - while (uncompiled.length > 0) { - const batch = []; - const new_uncompiled = []; - for (const pkgname of uncompiled) { - let deps_met = true; - const pkg = workspaces.dependencies[pkgname]; - if (pkg.dependencies) { - for (const dep of Object.keys(pkg.dependencies)) { - deps_met = - deps_met && (!is_valid.has(dep) || compiled.has(dep)); - if (!deps_met) { - // console.debug( - // `${pkgname} has unmet dependency ${dep} ${is_valid.has( - // dep - // )}` - // ); - - break; - } - } - - if (deps_met) { - batch.push(pkgname); - } else { - new_uncompiled.push(pkgname); - } - } else { - batch.push(pkgname); - } - } - - if (batch.length === 0) { - throw new Error( - `Failed to resolved dependencies for ${new_uncompiled.join( - "," - )}` - ); - } - - const cmd = strings[0].split(" ")[0]; - console.log(`-- Running ${cmd} for ${batch.join(",")}`); - for (const pkgname of batch) { - const pkg = JSON.parse( - fs.readFileSync(_require.resolve(pkgname + "/package.json")) - ); - - if (pkg.scripts?.[cmd]) { - sh` - ${sh(PACKAGE_MANAGER)} --workspace ${pkgname} run \ - ${Array.isArray(strings) ? sh(strings, ...args) : strings} - `.runSync(); - } - - compiled.add(pkgname); - } - - uncompiled = new_uncompiled; - } - - if (scope?.length === 0) { - } + const cmd = strings[0].split(" ")[0]; + const filters = scope.map((x) => `--filter ${x}`).join(" "); + execSync(`pnpm run --sequential --recursive ${filters} ${cmd}`, { + stdio: "inherit", + }); }; /** diff --git a/tools/perspective-test/load-viewer-csv.js b/tools/perspective-test/load-viewer-csv.js index 2d24f8afcf..29e1407b12 100644 --- a/tools/perspective-test/load-viewer-csv.js +++ b/tools/perspective-test/load-viewer-csv.js @@ -10,10 +10,13 @@ // ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃ // ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ -import perspective from "/perspective.js"; +import perspective from "/node_modules/@finos/perspective/dist/cdn/perspective.js"; async function load() { - let resp = await fetch("/@finos/perspective-test/assets/superstore.csv"); + let resp = await fetch( + "/node_modules/@finos/perspective-test/assets/superstore.csv" + ); + let csv = await resp.text(); const viewer = document.querySelector("perspective-viewer"); const worker = perspective.worker(); diff --git a/tools/perspective-test/load-viewer-superstore.js b/tools/perspective-test/load-viewer-superstore.js index ce42eae8f3..f90dbb1204 100644 --- a/tools/perspective-test/load-viewer-superstore.js +++ b/tools/perspective-test/load-viewer-superstore.js @@ -10,10 +10,13 @@ // ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃ // ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ -import perspective from "/perspective.js"; +import perspective from "/node_modules/@finos/perspective/dist/cdn/perspective.js"; async function load() { - let resp = await fetch("/@finos/perspective-test/assets/superstore.csv"); + let resp = await fetch( + "/node_modules/@finos/perspective-test/assets/superstore.csv" + ); + let csv = await resp.text(); const viewer = document.querySelector("perspective-viewer"); const worker = perspective.worker(); diff --git a/tools/perspective-test/load-workspace-arrow.js b/tools/perspective-test/load-workspace-arrow.js index b869ff6f26..d73d185474 100644 --- a/tools/perspective-test/load-workspace-arrow.js +++ b/tools/perspective-test/load-workspace-arrow.js @@ -10,10 +10,13 @@ // ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃ // ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ -import perspective from "/perspective.js"; +import perspective from "/node_modules/@finos/perspective/dist/cdn/perspective.js"; async function load() { - let resp = await fetch("/superstore-arrow/superstore.lz4.arrow"); + let resp = await fetch( + "/node_modules/superstore-arrow/superstore.lz4.arrow" + ); + let arrow = await resp.arrayBuffer(); const worker = perspective.worker(); const table = await worker.table(arrow); diff --git a/tools/perspective-test/package.json b/tools/perspective-test/package.json index e8725e2016..7acdee8c5d 100644 --- a/tools/perspective-test/package.json +++ b/tools/perspective-test/package.json @@ -19,7 +19,6 @@ "author": "", "license": "Apache-2.0", "dependencies": { - "@finos/perspective": "^2.10.0", "xml-formatter": "2.4.0" } } diff --git a/tools/perspective-test/playwright.config.ts b/tools/perspective-test/playwright.config.ts index 13fa82ab12..64828802d5 100644 --- a/tools/perspective-test/playwright.config.ts +++ b/tools/perspective-test/playwright.config.ts @@ -160,7 +160,7 @@ export default defineConfig({ }, forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, - quiet: true, + quiet: !process.env.PSP_DEBUG, reporter: process.env.CI ? [["github"], ["html"]] : [["dot"]], projects: PROJECTS, outputDir: "dist/results", @@ -187,5 +187,7 @@ export default defineConfig({ command: "yarn ts-node src/js/start_test_server.ts", port: TEST_SERVER_PORT, reuseExistingServer: true, + stdout: "pipe", + stderr: "pipe", }, }); diff --git a/tools/perspective-test/src/html/basic-test.html b/tools/perspective-test/src/html/basic-test.html index 210dd9300d..67f06a1512 100644 --- a/tools/perspective-test/src/html/basic-test.html +++ b/tools/perspective-test/src/html/basic-test.html @@ -10,13 +10,13 @@ - - - - + + + + - - + +