diff --git a/pkgs/development/python-modules/jupyterlab-git-core/default.nix b/pkgs/development/python-modules/jupyterlab-git-core/default.nix new file mode 100644 index 000000000000..087b6e42e175 --- /dev/null +++ b/pkgs/development/python-modules/jupyterlab-git-core/default.nix @@ -0,0 +1,96 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + git, + nodejs, + writableTmpDirAsHomeHook, + yarn-berry_3, + anyio, + hatch-jupyter-builder, + hatch-nodejs-version, + hatchling, + jupyterlab, + nbdime, + nbformat, + packaging, + pexpect, + pytest-asyncio, + pytestCheckHook, + traitlets, +}: + +buildPythonPackage rec { + pname = "jupyterlab-git-core"; + version = "0.54.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "jupyterlab"; + repo = "jupyterlab-git"; + tag = "v${version}"; + hash = "sha256-oTXvugfBay2cmRDu4yo6eFm3qGal3wgxc83dFeKs5Gw="; + }; + + nativeBuildInputs = [ + nodejs + yarn-berry_3.yarnBerryConfigHook + ]; + + offlineCache = yarn-berry_3.fetchYarnBerryDeps { + inherit src; + hash = "sha256-gJvrR/4Ov9jHjhPtlqYe9ZfMYOd2WtGQdbDGv/JikJA="; + }; + + preBuild = '' + cd packages/core + ''; + + build-system = [ + hatch-jupyter-builder + hatch-nodejs-version + hatchling + jupyterlab + ]; + + dependencies = [ + anyio + nbformat + packaging + pexpect + traitlets + ]; + + propagatedBuildInputs = [ git ]; + + nativeCheckInputs = [ + nbdime + pytest-asyncio + pytestCheckHook + writableTmpDirAsHomeHook + ]; + + preCheck = '' + ( + cd ../.. + jlpm test --runInBand \ + src/__tests__/test-components/NotebookDiff.spec.tsx \ + src/__tests__/test-components/PlainTextDiff.spec.tsx + ) + + # Upstream's Core tests import the sibling server package from the workspace. + export PYTHONPATH="$PWD/../jupyterlab''${PYTHONPATH:+:$PYTHONPATH}" + ''; + + pytestFlags = [ "--confcutdir=." ]; + + pythonImportsCheck = [ "jupyterlab_git_core" ]; + + meta = { + description = "Core package for the JupyterLab Git extension"; + homepage = "https://github.com/jupyterlab/jupyterlab-git"; + changelog = "https://github.com/jupyterlab/jupyterlab-git/blob/${src.tag}/CHANGELOG.md"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ chiroptical ]; + }; +} diff --git a/pkgs/development/python-modules/jupyterlab-git/default.nix b/pkgs/development/python-modules/jupyterlab-git/default.nix index 759833aab88a..e740150d3b52 100644 --- a/pkgs/development/python-modules/jupyterlab-git/default.nix +++ b/pkgs/development/python-modules/jupyterlab-git/default.nix @@ -1,21 +1,14 @@ { lib, buildPythonPackage, - fetchFromGitHub, - git, gitMinimal, - nodejs, writableTmpDirAsHomeHook, - yarn-berry_3, - jupyter-server, - hatch-jupyter-builder, hatch-nodejs-version, hatchling, - jupyterlab, + jupyterlab-git-core, + jupyter-server, + jupytext, nbdime, - nbformat, - packaging, - pexpect, pytest-asyncio, pytest-jupyter, pytest-tornasync, @@ -25,46 +18,28 @@ buildPythonPackage rec { pname = "jupyterlab-git"; - version = "0.52.0"; + inherit (jupyterlab-git-core) src version; pyproject = true; - src = fetchFromGitHub { - owner = "jupyterlab"; - repo = "jupyterlab-git"; - tag = "v${version}"; - hash = "sha256-BMzn+134hSYUFrDF+4+Bs81hzSURP9VNX4D9x2UuPMQ="; - }; - - nativeBuildInputs = [ - nodejs - yarn-berry_3.yarnBerryConfigHook - ]; - - offlineCache = yarn-berry_3.fetchYarnBerryDeps { - inherit src; - hash = "sha256-3pVc4xz5ilamCg97wdaLQliBHeSr3mPYwhgnz/lvfj0="; - }; + preBuild = '' + cd packages/jupyterlab + ''; build-system = [ - hatch-jupyter-builder hatch-nodejs-version hatchling - jupyterlab ]; dependencies = [ + jupyterlab-git-core jupyter-server nbdime - nbformat - packaging - pexpect traitlets ]; - propagatedBuildInputs = [ git ]; - nativeCheckInputs = [ gitMinimal + jupytext pytest-asyncio pytest-jupyter pytest-tornasync @@ -72,15 +47,6 @@ buildPythonPackage rec { writableTmpDirAsHomeHook ]; - disabledTestPaths = [ - "jupyterlab_git/tests/test_handlers.py" - ]; - - disabledTests = [ - "test_Git_get_nbdiff_file" - "test_Git_get_nbdiff_dict" - ]; - pythonImportsCheck = [ "jupyterlab_git" ]; __darwinAllowLocalNetworking = true; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 2c2ee3cbdb30..dfce39355bfa 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -8668,6 +8668,8 @@ self: super: with self; { jupyterlab-git = callPackage ../development/python-modules/jupyterlab-git { }; + jupyterlab-git-core = callPackage ../development/python-modules/jupyterlab-git-core { }; + jupyterlab-lsp = callPackage ../development/python-modules/jupyterlab-lsp { }; jupyterlab-pygments = callPackage ../development/python-modules/jupyterlab-pygments { };