depot/third_party/nixpkgs/pkgs/development/python-modules/dash/default.nix

129 lines
2.3 KiB
Nix

{
lib,
buildPythonPackage,
fetchFromGitHub,
yarnConfigHook,
fetchYarnDeps,
nodejs,
setuptools,
flask,
werkzeug,
plotly,
dash-html-components,
dash-core-components,
dash-table,
importlib-metadata,
typing-extensions,
requests,
retrying,
nest-asyncio,
celery,
redis,
diskcache,
multiprocess,
psutil,
flask-compress,
pytestCheckHook,
pytest-mock,
mock,
pyyaml,
}:
buildPythonPackage rec {
pname = "dash";
version = "2.18.1";
pyproject = true;
src = fetchFromGitHub {
owner = "plotly";
repo = "dash";
rev = "refs/tags/v${version}";
hash = "sha256-2LwM1lrJNdekoDN+wDHgaSlGOnpK618r65UHj7cP59E=";
};
nativeBuildInputs = [
yarnConfigHook
nodejs
];
yarnOfflineCache = fetchYarnDeps {
yarnLock = "${src}/@plotly/dash-jupyterlab/yarn.lock";
hash = "sha256-L/or8jO6uEypI5krwy/ElIxa6jJrXGsCRZ9mh+0kcGA=";
};
# as of writing this yarnConfigHook has no parameter that changes in which directory it will be run
# until then we use preConfigure for entering the directory and preBuild for exiting it
preConfigure = ''
pushd @plotly/dash-jupyterlab
substituteInPlace package.json \
--replace-fail 'jlpm' 'yarn'
'';
preBuild = ''
# Generate the jupyterlab extension files
yarn --offline run build:pack
popd
'';
build-system = [ setuptools ];
dependencies = [
flask
werkzeug
plotly
dash-html-components
dash-core-components
dash-table
importlib-metadata
typing-extensions
requests
retrying
nest-asyncio
];
optional-dependencies = {
celery = [
celery
redis
];
diskcache = [
diskcache
multiprocess
psutil
];
compress = [ flask-compress ];
};
nativeCheckInputs = [
pytestCheckHook
pytest-mock
mock
pyyaml
];
disabledTestPaths = [
"tests/unit/test_browser.py"
"tests/unit/test_app_runners.py" # Uses selenium
"tests/integration"
];
pythonImportsCheck = [ "dash" ];
meta = {
changelog = "https://github.com/plotly/dash/blob/${src.rev}/CHANGELOG.md";
description = "Python framework for building analytical web applications";
homepage = "https://dash.plot.ly/";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
antoinerg
tomasajt
];
};
}