SIGN IN SIGN UP

A data visualization and analytics component, especially well-suited for large and/or streaming datasets.

0 0 19 C++
2019-01-05 22:56:05 -05:00
/******************************************************************************
*
* Copyright (c) 2017, the Perspective Authors.
*
* This file is part of the Perspective library, distributed under the terms of
* the Apache License 2.0. The full license can be found in the LICENSE file.
*
*/
2021-09-12 14:08:32 -04:00
const {
execute,
execute_throw,
docker,
resolve,
getarg,
bash,
python_image,
} = require("./script_utils.js");
const fs = require("fs-extra");
2019-01-05 22:56:05 -05:00
2021-10-14 00:32:34 -04:00
let PYTHON = getarg("--python38")
2021-09-12 14:08:32 -04:00
? "python3.8"
: getarg("--python36")
? "python3.6"
2021-10-23 01:29:39 -04:00
: getarg("--python37")
? "python3.7"
: "python3";
let IMAGE = "manylinux2010";
const IS_DOCKER = process.env.PSP_DOCKER;
if (IS_DOCKER) {
2021-10-14 00:32:34 -04:00
let MANYLINUX_VERSION = getarg("--manylinux2010")
? "manylinux2010"
: getarg("--manylinux2014")
? "manylinux2014"
: "manylinux2010";
IMAGE = python_image(MANYLINUX_VERSION, PYTHON);
}
2019-12-10 21:48:45 +00:00
2019-12-06 23:30:51 -05:00
const IS_CI = getarg("--ci");
2020-08-24 10:59:40 -04:00
const SETUP_ONLY = getarg("--setup-only");
const IS_INSTALL = getarg("--install");
2019-01-05 22:56:05 -05:00
// Check that the `PYTHON` command is valid, else default to `python`.
try {
execute_throw`${PYTHON} --version`;
} catch (e) {
console.warn(`\`${PYTHON}\` not found - using \`python\` instead.`);
PYTHON = "python";
}
2019-01-05 22:56:05 -05:00
try {
2019-12-06 23:30:51 -05:00
const dist = resolve`${__dirname}/../python/perspective/dist`;
const cpp = resolve`${__dirname}/../cpp/perspective/src`;
const cmakelists = resolve`${__dirname}/../cpp/perspective/CMakeLists.txt`;
2020-02-18 14:33:01 -05:00
const lic = resolve`${__dirname}/../LICENSE`;
2019-12-06 23:30:51 -05:00
const cmake = resolve`${__dirname}/../cmake`;
const dcmake = resolve`${dist}/cmake`;
2020-02-18 14:33:01 -05:00
const dlic = resolve`${dist}/LICENSE`;
2019-12-06 23:30:51 -05:00
fs.mkdirpSync(dist);
2021-09-12 14:08:32 -04:00
fs.copySync(cmakelists, resolve`${dist}/CMakeLists.txt`, {
preserveTimestamps: true,
});
fs.copySync(cpp, resolve`${dist}/src`, {preserveTimestamps: true});
2020-02-18 14:33:01 -05:00
fs.copySync(lic, dlic, {preserveTimestamps: true});
2019-12-06 23:30:51 -05:00
fs.copySync(cmake, dcmake, {preserveTimestamps: true});
Merge Perspective-Python and build out Node/Pybind can construct ctx0, ctx1, ctx2 add better test, move low level tests down fix test clean up build/test/lint scripts WIP: make python API more symmetric to JS API process table data, working view constructors edit python dockerfile update style more types supported don't purge docker assets until end of test stage don't allow table to fail, try to install packages locally update build scripts to install deps assert in table tests Fixed Dockerfile don't use target=/Volumes/files/jpmc/perspective locally forward API to latest master add autopep8 fix script no -r avoid global, remove dependency install don't install in local folder merge master changes style fixes refactoring python code to be modular, add docstring examples, fix some style issues, add support for format=1 and format=2 tables, add initial support for numpy and pandas types seperate script for building/linting/testing all in one install optionals remove individual license, remap badges in readme, remove perspective-python travis, remove bettercodehub fix test, use warning instead of warn add codecov upload bugfix for segfault lint in precommit WIP: to_dict(), add scalar_to_py split apart pythons C++ code, don't make vectors and maps opaque readd comented stuff, remove some more todos support some numpy types merge from pyapi merge from pyapi add scalar_to_py for outputting data fix bug with boolean columns working to_dict, to_columns for 0, 1, 2 sided views refactor to_dict, to_column, add limit and index tests update working refactor data formatter, start on numpy export support python-only numpy add numpy tests remove working fix performance issue, make aggregates a dict parse strings with datetime, accept string schemas, add more tests to_records() and to_dict() replace to_dict() and to_columns() read and write date(), datetime() objects, parse date/datetime strings don't install before build revamp docs add docs framework for all packages, generate markdown for outputs including autodocs update readmes to remove gitter, extract pandas flattening, change type mapping convert to UTC in tests travis is in UTC adding pandas export add simple to_df tests
2019-06-17 13:34:06 -04:00
2020-08-24 10:59:40 -04:00
if (SETUP_ONLY) {
2020-08-26 14:10:58 -04:00
// don't execute any build steps, just copy
// the C++ assets into the python folder
2020-08-24 10:59:40 -04:00
return;
}
Merge Perspective-Python and build out Node/Pybind can construct ctx0, ctx1, ctx2 add better test, move low level tests down fix test clean up build/test/lint scripts WIP: make python API more symmetric to JS API process table data, working view constructors edit python dockerfile update style more types supported don't purge docker assets until end of test stage don't allow table to fail, try to install packages locally update build scripts to install deps assert in table tests Fixed Dockerfile don't use target=/Volumes/files/jpmc/perspective locally forward API to latest master add autopep8 fix script no -r avoid global, remove dependency install don't install in local folder merge master changes style fixes refactoring python code to be modular, add docstring examples, fix some style issues, add support for format=1 and format=2 tables, add initial support for numpy and pandas types seperate script for building/linting/testing all in one install optionals remove individual license, remap badges in readme, remove perspective-python travis, remove bettercodehub fix test, use warning instead of warn add codecov upload bugfix for segfault lint in precommit WIP: to_dict(), add scalar_to_py split apart pythons C++ code, don't make vectors and maps opaque readd comented stuff, remove some more todos support some numpy types merge from pyapi merge from pyapi add scalar_to_py for outputting data fix bug with boolean columns working to_dict, to_columns for 0, 1, 2 sided views refactor to_dict, to_column, add limit and index tests update working refactor data formatter, start on numpy export support python-only numpy add numpy tests remove working fix performance issue, make aggregates a dict parse strings with datetime, accept string schemas, add more tests to_records() and to_dict() replace to_dict() and to_columns() read and write date(), datetime() objects, parse date/datetime strings don't install before build revamp docs add docs framework for all packages, generate markdown for outputs including autodocs update readmes to remove gitter, extract pandas flattening, change type mapping convert to UTC in tests travis is in UTC adding pandas export add simple to_df tests
2019-06-17 13:34:06 -04:00
let cmd;
2019-12-06 23:30:51 -05:00
if (IS_CI) {
2021-10-14 00:32:34 -04:00
cmd = bash`${PYTHON} -m pip install -e .[dev] --no-clean &&`;
2019-12-16 17:18:07 -05:00
2020-08-26 14:10:58 -04:00
// pip install in-place with --no-clean so that pep-518 assets stick
// around for later wheel build (so cmake cache can stay in place)
//
// lint the folder with flake8
//
// pytest the client first (since we need to move the shared libraries out of place
// temporarily to simulate them not being installed)
//
// then run the remaining test suite
2020-01-06 16:37:14 -05:00
cmd =
cmd +
2020-09-08 16:23:54 -04:00
`${PYTHON} -m flake8 perspective && echo OK && \
${PYTHON} -m pytest -vvv --noconftest perspective/tests/client_mode && \
2020-02-10 19:33:08 -05:00
${PYTHON} -m pytest -vvv perspective \
--ignore=perspective/tests/client_mode \
2020-02-10 19:33:08 -05:00
--junitxml=python_junit.xml --cov-report=xml --cov-branch \
2020-01-06 15:58:38 -05:00
--cov=perspective`;
2019-12-10 21:48:45 +00:00
if (IMAGE == "python") {
2020-09-08 16:23:54 -04:00
// test the sdist to make sure we dont
2020-08-26 14:10:58 -04:00
// dist a non-functioning source dist
2020-01-06 16:37:14 -05:00
cmd =
cmd +
`&& \
2019-12-10 21:48:45 +00:00
${PYTHON} setup.py sdist && \
${PYTHON} -m pip install -U dist/*.tar.gz`;
}
} else if (IS_INSTALL) {
cmd = `${PYTHON} -m pip install .`;
2019-12-06 23:30:51 -05:00
} else {
2019-12-10 21:48:45 +00:00
cmd = bash`${PYTHON} setup.py build -v`;
2019-12-06 23:30:51 -05:00
}
Merge Perspective-Python and build out Node/Pybind can construct ctx0, ctx1, ctx2 add better test, move low level tests down fix test clean up build/test/lint scripts WIP: make python API more symmetric to JS API process table data, working view constructors edit python dockerfile update style more types supported don't purge docker assets until end of test stage don't allow table to fail, try to install packages locally update build scripts to install deps assert in table tests Fixed Dockerfile don't use target=/Volumes/files/jpmc/perspective locally forward API to latest master add autopep8 fix script no -r avoid global, remove dependency install don't install in local folder merge master changes style fixes refactoring python code to be modular, add docstring examples, fix some style issues, add support for format=1 and format=2 tables, add initial support for numpy and pandas types seperate script for building/linting/testing all in one install optionals remove individual license, remap badges in readme, remove perspective-python travis, remove bettercodehub fix test, use warning instead of warn add codecov upload bugfix for segfault lint in precommit WIP: to_dict(), add scalar_to_py split apart pythons C++ code, don't make vectors and maps opaque readd comented stuff, remove some more todos support some numpy types merge from pyapi merge from pyapi add scalar_to_py for outputting data fix bug with boolean columns working to_dict, to_columns for 0, 1, 2 sided views refactor to_dict, to_column, add limit and index tests update working refactor data formatter, start on numpy export support python-only numpy add numpy tests remove working fix performance issue, make aggregates a dict parse strings with datetime, accept string schemas, add more tests to_records() and to_dict() replace to_dict() and to_columns() read and write date(), datetime() objects, parse date/datetime strings don't install before build revamp docs add docs framework for all packages, generate markdown for outputs including autodocs update readmes to remove gitter, extract pandas flattening, change type mapping convert to UTC in tests travis is in UTC adding pandas export add simple to_df tests
2019-06-17 13:34:06 -04:00
if (IS_DOCKER) {
2019-12-10 21:48:45 +00:00
execute`${docker(IMAGE)} bash -c "cd python/perspective && \
2019-12-06 23:30:51 -05:00
${cmd} "`;
2019-01-05 22:56:05 -05:00
} else {
2019-12-06 23:30:51 -05:00
const python_path = resolve`${__dirname}/../python/perspective`;
execute`cd ${python_path} && ${cmd}`;
2019-01-05 22:56:05 -05:00
}
} catch (e) {
2019-01-17 20:51:06 -05:00
console.log(e.message);
2019-01-05 22:56:05 -05:00
process.exit(1);
}