depot/third_party/nixpkgs/pkgs/applications/version-management/nbstripout/default.nix
Default email a0cb138ada Project import generated by Copybara.
GitOrigin-RevId: a100acd7bbf105915b0004427802286c37738fef
2023-02-02 18:25:31 +00:00

49 lines
1 KiB
Nix

{ lib
, python3
, coreutils
, git
, mercurial
}:
python3.pkgs.buildPythonApplication rec {
version = "0.6.1";
pname = "nbstripout";
src = python3.pkgs.fetchPypi {
inherit pname version;
hash = "sha256-kGW83RSIs4bk88CB/8HUj0UTovjYv00NmiggjF2v6dM=";
};
# for some reason, darwin uses /bin/sh echo native instead of echo binary, so
# force using the echo binary
postPatch = ''
substituteInPlace tests/test-git.t --replace "echo" "${coreutils}/bin/echo"
'';
propagatedBuildInputs = with python3.pkgs; [
ipython
nbformat
];
nativeCheckInputs = [
coreutils
git
mercurial
] ++ (with python3.pkgs; [
pytest-cram
pytestCheckHook
]);
preCheck = ''
export HOME=$(mktemp -d)
export PATH=$out/bin:$PATH
git config --global init.defaultBranch main
'';
meta = {
description = "Strip output from Jupyter and IPython notebooks";
homepage = "https://github.com/kynan/nbstripout";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ jluttine ];
};
}