nixpkgs/pkgs/applications/version-management/nbstripout/default.nix

39 lines
1.2 KiB
Nix
Raw Normal View History

2019-12-30 07:04:28 +00:00
{lib, python, git, mercurial, coreutils}:
2017-05-07 14:54:36 +00:00
2019-12-30 07:04:28 +00:00
with python.pkgs;
2017-05-07 14:54:36 +00:00
buildPythonApplication rec {
2020-03-09 14:47:57 +00:00
version = "0.3.7";
2017-05-07 14:54:36 +00:00
pname = "nbstripout";
# Mercurial should be added as a build input but because it's a Python
# application, it would mess up the Python environment. Thus, don't add it
# here, instead add it to PATH when running unit tests
2019-12-30 07:04:28 +00:00
checkInputs = [ pytest pytest-flake8 git ];
nativeBuildInputs = [ pytestrunner ];
2017-05-07 14:54:36 +00:00
propagatedBuildInputs = [ ipython nbformat ];
2019-09-07 11:43:43 +00:00
src = fetchPypi {
inherit pname version;
2020-03-09 14:47:57 +00:00
sha256 = "13w2zhw8vrfv6637bw5ygygj1dky55fvvncz11hq0abwkkzb3wb2";
2017-05-07 14:54:36 +00:00
};
2017-05-17 06:59:26 +00:00
# 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"
'';
2017-05-07 14:54:36 +00:00
# ignore flake8 tests for the nix wrapped setup.py
checkPhase = ''
PATH=$PATH:$out/bin:${mercurial}/bin pytest .
2017-05-07 14:54:36 +00:00
'';
meta = {
inherit version;
description = "Strip output from Jupyter and IPython notebooks";
homepage = "https://github.com/kynan/nbstripout";
2017-05-07 14:54:36 +00:00
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ jluttine ];
};
}