Made with
```shell
git restore .
fd '\.nix$' pkgs/ --type f -j1 -x bash -xc "$(cat <<"EOF"
typos --no-check-filenames --write-changes "$1"
git diff --exit-code "$1" && exit
#( git diff "$1" | grep -qE "^\+ +[^# ]") && git restore "$1"
count1="$( bat --language nix --diff --style changes "$1" --theme "Monokai Extended" --color always | aha --no-header | grep -E '^<span style="color:olive;">~</span> ' | wc -l )"
count2="$( bat --language nix --diff --style changes "$1" --theme "Monokai Extended" --color always | aha --no-header | grep -E '^<span style="color:olive;">~</span> (<span style="color:#f8f8f2;"> *</span>)?<span style="color:#75715e;">.*</span>$' | wc -l )"
[[ $count1 -ne $count2 ]] && git restore "$1"
EOF
)" -- {}
```
and filtered with `GIT_DIFF_OPTS='--unified=15' git -c interactive.singleKey=true add --patch`
I initially tried using the tree-sitter cli, python bindings and even ast-grep through various means, but this is what I ended up with.
53 lines
1.2 KiB
Nix
53 lines
1.2 KiB
Nix
{
|
|
lib,
|
|
buildPythonPackage,
|
|
fetchFromGitHub,
|
|
hatchling,
|
|
jupyter-server,
|
|
pytestCheckHook,
|
|
pytest-tornasync,
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "notebook-shim";
|
|
version = "0.2.4";
|
|
format = "pyproject";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "jupyter";
|
|
repo = "notebook_shim";
|
|
tag = "v${version}";
|
|
hash = "sha256-CWnXOKE1xvr+a/qWNY6XCTB5+G/fg2O/glgeLzYD+Zc=";
|
|
};
|
|
|
|
nativeBuildInputs = [ hatchling ];
|
|
propagatedBuildInputs = [ jupyter-server ];
|
|
|
|
preCheck = ''
|
|
mv notebook_shim/conftest.py notebook_shim/tests
|
|
cd notebook_shim/tests
|
|
'';
|
|
|
|
# TODO: understand & possibly fix why tests fail. On github most testfiles
|
|
# have been committed with msgs "wip" though.
|
|
doCheck = false;
|
|
|
|
nativeCheckInputs = [
|
|
pytestCheckHook
|
|
pytest-tornasync
|
|
];
|
|
|
|
pythonImportsCheck = [ "notebook_shim" ];
|
|
|
|
meta = with lib; {
|
|
description = "Switch frontends to Jupyter Server";
|
|
longDescription = ''
|
|
This project provides a way for JupyterLab and other frontends to switch
|
|
to Jupyter Server for their Python Web application backend.
|
|
'';
|
|
homepage = "https://github.com/jupyter/notebook_shim";
|
|
license = licenses.bsd3;
|
|
maintainers = [ ];
|
|
};
|
|
}
|