{ lib, stdenv, buildPythonPackage, fetchFromGitHub, # build-time qt6, # build-system setuptools, # dependencies datalab-capsule, fastapi, guidata, jedi, numpy, packaging, pandas, pip, plotpy, psutil, pydantic, pywavelets, scikit-image, scipy, sigima, sigimax, uvicorn, # optional-dependencies babel, build, coverage, pre-commit, pylint, ruff, myst-parser, pydata-sphinx-theme, sphinx, sphinx-copybutton, sphinx-design, sphinx-intl, sphinx-sitemap, sphinxcontrib-svg2pdfconverter, sphinxext-opengraph, opencv-python-headless, pyinstaller, pyqt6, # tests httpx2, pytest, pytest-xvfb, pytestCheckHook, pyyaml, versionCheckHook, websockets, fullTestSuite ? false, datalab-platform, # self }: buildPythonPackage (finalAttrs: { pname = "datalab-platform"; version = "1.4.1"; pyproject = true; src = fetchFromGitHub { owner = "DataLab-Platform"; repo = "DataLab"; tag = "v${finalAttrs.version}"; hash = "sha256-hbGXTjuSScPgC/nIocIqJWiO5w7DEjCGwh0+iNZTWk0="; }; nativeBuildInputs = [ qt6.wrapQtAppsHook ]; buildInputs = [ qt6.qtbase qt6.qtsvg ] ++ lib.optionals stdenv.hostPlatform.isLinux [ qt6.qtwayland ]; build-system = [ setuptools ]; dependencies = [ datalab-capsule fastapi guidata jedi numpy packaging pandas # pip is used only in an isolated child processes with `--isolated --no-index --target` # to install pinned plugin wheels into a profile (`~/.config/.DataLab_v1/installed_plugins/`) # leaving the nix store, and global pip directory untouched. # Without this the plugin's functionality is diminished pip plotpy psutil pydantic pywavelets scikit-image scipy sigima sigimax uvicorn ] ++ uvicorn.optional-dependencies.standard ++ finalAttrs.passthru.optional-dependencies.qt ++ lib.optionals fullTestSuite [ # test dependencies - required for bin/datalab-tests pytest httpx2 pyyaml ]; optional-dependencies = { dev = [ babel build coverage pre-commit pylint ruff ]; doc = [ myst-parser pydata-sphinx-theme sphinx sphinx-copybutton sphinx-design sphinx-intl sphinx-sitemap sphinxcontrib-svg2pdfconverter sphinxext-opengraph ]; exe = [ opencv-python-headless pyinstaller pyqt6 ]; opencv = [ opencv-python-headless ]; qt = [ pyqt6 ]; }; pythonImportsCheck = [ "datalab" ]; nativeInstallCheckInputs = [ versionCheckHook ]; preCheck = '' export QT_PLUGIN_PATH="${lib.getBin qt6.qtbase}/${qt6.qtbase.qtPluginPrefix}:${qt6.qtsvg}/${qt6.qtbase.qtPluginPrefix}" ''; nativeCheckInputs = [ httpx2 pytestCheckHook pyyaml ] ++ lib.optionals fullTestSuite [ pytest-xvfb ruff websockets ]; # running the full test suite takes ~20 minutes, moved to passthru.tests pytestFlags = lib.optionals (!fullTestSuite) [ "--collect-only" ]; passthru.tests.full = datalab-platform.override { fullTestSuite = true; }; postInstall = lib.optionalString (!fullTestSuite) '' rm $out/bin/datalab-tests ''; dontWrapQtApps = true; preFixup = '' # Python scripts need to be manually wrapped for exe in "$out/bin"/datalab*; do wrapQtApp "$exe" done ''; meta = { description = "Open-source Platform for Scientific and Technical Data Processing and Visualization"; homepage = "https://github.com/DataLab-Platform/DataLab"; changelog = "https://github.com/DataLab-Platform/DataLab/releases/tag/${finalAttrs.src.tag}"; mainProgram = "datalab"; license = lib.licenses.bsd3; maintainers = with lib.maintainers; [ eljamm ]; teams = with lib.teams; [ ngi ]; }; })