nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, GitPython
5, isort
6, jupyter-client
7, jupyter-packaging
8, jupyterlab
9, markdown-it-py
10, mdit-py-plugins
11, nbformat
12, notebook
13, pytestCheckHook
14, pythonOlder
15, pyyaml
16, toml
17}:
18
19buildPythonPackage rec {
20 pname = "jupytext";
21 version = "1.13.8";
22 format = "pyproject";
23
24 disabled = pythonOlder "3.6";
25
26 src = fetchFromGitHub {
27 owner = "mwouts";
28 repo = pname;
29 rev = "refs/tags/v${version}";
30 sha256 = "sha256-ebe5sQJxA8QE6eJp6vPUyMaEvZUPqzCmQ6damzo1BVo=";
31 };
32
33 buildInputs = [
34 jupyter-packaging
35 jupyterlab
36 ];
37
38 propagatedBuildInputs = [
39 markdown-it-py
40 mdit-py-plugins
41 nbformat
42 pyyaml
43 toml
44 ];
45
46 checkInputs = [
47 GitPython
48 isort
49 jupyter-client
50 notebook
51 pytestCheckHook
52 ];
53
54 postPatch = ''
55 # https://github.com/mwouts/jupytext/pull/885
56 substituteInPlace setup.py \
57 --replace "markdown-it-py~=1.0" "markdown-it-py>=1.0.0,<3.0.0"
58 '';
59
60 preCheck = ''
61 # Tests that use a Jupyter notebook require $HOME to be writable
62 export HOME=$(mktemp -d);
63 '';
64
65 pytestFlagsArray = [
66 # Pre-commit tests expect the source directory to be a Git repository
67 "--ignore-glob='tests/test_pre_commit_*.py'"
68 ];
69
70 disabledTests = [
71 "test_apply_black_through_jupytext" # we can't do anything about ill-formatted notebooks
72 ];
73
74 pythonImportsCheck = [
75 "jupytext"
76 "jupytext.cli"
77 ];
78
79 meta = with lib; {
80 description = "Jupyter notebooks as Markdown documents, Julia, Python or R scripts";
81 homepage = "https://github.com/mwouts/jupytext";
82 license = licenses.mit;
83 maintainers = with maintainers; [ timokau ];
84 };
85}