Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / python-modules / jupytext / default.nix
blobe5bc170509d22d0c756e669bc84200c94bddb612
1 { lib
2 , stdenv
3 , buildPythonPackage
4 , fetchFromGitHub
5 , gitpython
6 , isort
7 , jupyter-client
8 , jupyter-packaging
9 , jupyterlab
10 , markdown-it-py
11 , mdit-py-plugins
12 , nbformat
13 , notebook
14 , pytestCheckHook
15 , pythonOlder
16 , pyyaml
17 , setuptools
18 , toml
19 , wheel
22 buildPythonPackage rec {
23   pname = "jupytext";
24   version = "1.15.2";
25   format = "pyproject";
27   disabled = pythonOlder "3.6";
29   src = fetchFromGitHub {
30     owner = "mwouts";
31     repo = pname;
32     rev = "refs/tags/v${version}";
33     hash = "sha256-GvMoz2BsYWk0atrT3xmSnbV7AuO5RJoM/bOJlZ5YIn4=";
34   };
36   # Follow https://github.com/mwouts/jupytext/pull/1119 to see if the patch
37   # relaxing jupyter_packaging version can be cleaned up.
38   #
39   # Follow https://github.com/mwouts/jupytext/pull/1077 to see when the patch
40   # relaxing jupyterlab version can be cleaned up.
41   #
42   postPatch = ''
43     substituteInPlace pyproject.toml \
44       --replace 'jupyter_packaging~=' 'jupyter_packaging>=' \
45       --replace 'jupyterlab>=3,<=4' 'jupyterlab>=3'
46   '';
48   nativeBuildInputs = [
49     jupyter-packaging
50     jupyterlab
51     setuptools
52     wheel
53   ];
55   propagatedBuildInputs = [
56     markdown-it-py
57     mdit-py-plugins
58     nbformat
59     pyyaml
60     toml
61   ];
63   nativeCheckInputs = [
64     gitpython
65     isort
66     jupyter-client
67     notebook
68     pytestCheckHook
69   ];
71   preCheck = ''
72     # Tests that use a Jupyter notebook require $HOME to be writable
73     export HOME=$(mktemp -d);
74   '';
76   pytestFlagsArray = [
77     # Pre-commit tests expect the source directory to be a Git repository
78     "--ignore-glob='tests/test_pre_commit_*.py'"
79   ];
81   disabledTests = [
82     "test_apply_black_through_jupytext" # we can't do anything about ill-formatted notebooks
83   ] ++ lib.optionals stdenv.isDarwin [
84     # requires access to trash
85     "test_load_save_rename"
86   ];
88   pythonImportsCheck = [
89     "jupytext"
90     "jupytext.cli"
91   ];
93   meta = with lib; {
94     description = "Jupyter notebooks as Markdown documents, Julia, Python or R scripts";
95     homepage = "https://github.com/mwouts/jupytext";
96     changelog = "https://github.com/mwouts/jupytext/releases/tag/${src.rev}";
97     license = licenses.mit;
98     maintainers = teams.jupyter.members;
99   };