python3Packages.jupyter-collaboration: build from source and fix tests

This commit is contained in:
natsukium
2025-05-20 16:16:06 +02:00
committed by Gaetan Lepage
parent 2060c41118
commit 85a5f2b680
5 changed files with 35 additions and 51 deletions
@@ -33,7 +33,7 @@ buildPythonPackage rec {
# no tests
doCheck = false;
passthru.tests = jupyter-collaboration.tests;
passthru.tests = jupyter-collaboration;
meta = {
description = "JupyterLab/Jupyter Notebook 7+ extension providing user interface integration for real time collaboration";
@@ -1,7 +1,7 @@
{
lib,
buildPythonPackage,
fetchPypi,
fetchFromGitHub,
# build-system
hatchling,
@@ -10,9 +10,15 @@
jupyter-collaboration-ui,
jupyter-docprovider,
jupyter-server-ydoc,
jupyterlab,
# tests
callPackage,
dirty-equals,
httpx-ws,
pytest-jupyter,
pytest-timeout,
pytestCheckHook,
writableTmpDirAsHomeHook,
}:
buildPythonPackage rec {
@@ -20,26 +26,43 @@ buildPythonPackage rec {
version = "4.0.2";
pyproject = true;
src = fetchPypi {
pname = "jupyter_collaboration";
inherit version;
hash = "sha256-MXKFiuwO36TZGsLlemRUuy04JW/GCWMVdgRBIFTQuiE=";
src = fetchFromGitHub {
owner = "jupyterlab";
repo = "jupyter-collaboration";
tag = "v${version}";
hash = "sha256-BCvTtrlP45YC9G/m/e8Nvbls7AugIaQzO2Gect1EmGE=";
};
sourceRoot = "${src.name}/projects/jupyter-collaboration";
build-system = [ hatchling ];
dependencies = [
jupyter-collaboration-ui
jupyter-docprovider
jupyter-server-ydoc
jupyterlab
];
pythonImportsCheck = [ "jupyter_collaboration" ];
# no tests
doCheck = false;
nativeCheckInputs = [
dirty-equals
httpx-ws
pytest-jupyter
pytest-timeout
pytestCheckHook
writableTmpDirAsHomeHook
];
passthru.tests = callPackage ./test.nix { };
pytestFlagsArray = [
# pytest.PytestCacheWarning: could not create cache path /build/source/.pytest_cache/v/cache/nodeids: [Errno 13] Permission denied: '/build/source/pytest-cache-files-plraagdr'
"-p"
"no:cacheprovider"
"$src/tests"
];
__darwinAllowLocalNetworking = true;
meta = {
description = "JupyterLab Extension enabling Real-Time Collaboration";
@@ -1,39 +0,0 @@
{
stdenvNoCC,
fetchFromGitHub,
jupyter-collaboration,
pytest-jupyter,
pytestCheckHook,
websockets,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "jupyter-collaboration-test";
inherit (jupyter-collaboration) version;
src = fetchFromGitHub {
owner = "jupyterlab";
repo = "jupyter-collaboration";
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-6hDYB1uC0WraB37s9EKLJF7jyFu0B3xLocuLYyKj4hs=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "timeout = 300" ""
'';
installPhase = ''
touch $out
'';
env.HOME = "$TMPDIR";
doCheck = true;
nativeCheckInputs = [
jupyter-collaboration
pytest-jupyter
pytestCheckHook
websockets
];
})
@@ -33,7 +33,7 @@ buildPythonPackage rec {
# no tests
doCheck = false;
passthru.tests = jupyter-collaboration.tests;
passthru.tests = jupyter-collaboration;
meta = {
description = "JupyterLab/Jupyter Notebook 7+ extension integrating collaborative shared models";
@@ -41,7 +41,7 @@ buildPythonPackage rec {
# no tests
doCheck = false;
passthru.tests = jupyter-collaboration.tests;
passthru.tests = jupyter-collaboration;
meta = {
description = "Jupyter-server extension integrating collaborative shared models";