1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchPypi,
6 hatch-jupyter-builder,
7 hatchling,
8 jupyter-client,
9 markdown-it-py,
10 mdit-py-plugins,
11 nbformat,
12 notebook,
13 packaging,
14 pytest-xdist,
15 pytestCheckHook,
16 pythonOlder,
17 pyyaml,
18 tomli,
19}:
20
21buildPythonPackage rec {
22 pname = "jupytext";
23 version = "1.16.3";
24 pyproject = true;
25
26 disabled = pythonOlder "3.8";
27
28 src = fetchPypi {
29 inherit pname version;
30 hash = "sha256-HrrJkEYd2fR3/3/uyeMAP6GsyJ88FroBtz95/XbwGpg=";
31 };
32
33 build-system = [
34 hatch-jupyter-builder
35 hatchling
36 ];
37
38 dependencies = [
39 markdown-it-py
40 mdit-py-plugins
41 nbformat
42 packaging
43 pyyaml
44 ] ++ lib.optionals (pythonOlder "3.11") [ tomli ];
45
46 nativeCheckInputs = [
47 jupyter-client
48 notebook
49 pytest-xdist
50 pytestCheckHook
51 ];
52
53 preCheck = ''
54 # Tests that use a Jupyter notebook require $HOME to be writable
55 export HOME=$(mktemp -d);
56 export PATH=$out/bin:$PATH;
57 '';
58
59 disabledTestPaths = [ "tests/external" ];
60
61 disabledTests = lib.optionals stdenv.isDarwin [
62 # requires access to trash
63 "test_load_save_rename"
64 ];
65
66 pythonImportsCheck = [
67 "jupytext"
68 "jupytext.cli"
69 ];
70
71 meta = with lib; {
72 description = "Jupyter notebooks as Markdown documents, Julia, Python or R scripts";
73 homepage = "https://github.com/mwouts/jupytext";
74 changelog = "https://github.com/mwouts/jupytext/releases/tag/v${version}";
75 license = licenses.mit;
76 maintainers = teams.jupyter.members;
77 mainProgram = "jupytext";
78 };
79}