nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 132 lines 2.7 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 nodejs, 7 yarn-berry_3, 8 9 # build-system 10 hatch-jupyter-builder, 11 hatchling, 12 jupyterlab, 13 14 # dependencies 15 markdown-it-py, 16 mdit-py-plugins, 17 nbformat, 18 packaging, 19 pyyaml, 20 pythonOlder, 21 tomli, 22 23 # tests 24 addBinToPathHook, 25 jupyter-client, 26 notebook, 27 pytest-asyncio, 28 pytest-xdist, 29 pytestCheckHook, 30 versionCheckHook, 31 writableTmpDirAsHomeHook, 32}: 33 34buildPythonPackage rec { 35 pname = "jupytext"; 36 version = "1.18.1"; 37 pyproject = true; 38 39 src = fetchFromGitHub { 40 owner = "mwouts"; 41 repo = "jupytext"; 42 tag = "v${version}"; 43 hash = "sha256-D7Ps/lHF3F/7Jm4ozcjO8YsTPA1GQPqZVpPod/riGvA="; 44 }; 45 46 patches = [ 47 ./fix-yarn-lock-typescript.patch 48 ]; 49 50 nativeBuildInputs = [ 51 nodejs 52 yarn-berry_3.yarnBerryConfigHook 53 ]; 54 55 missingHashes = ./missing-hashes.json; 56 57 offlineCache = yarn-berry_3.fetchYarnBerryDeps { 58 inherit src missingHashes; 59 patches = [ 60 ./fix-yarn-lock-typescript-offline-cache.patch 61 ]; 62 sourceRoot = "${src.name}/jupyterlab"; 63 hash = "sha256-k2lQnlSmCghIkp6VwNmq5KpSHS5tEbnFnsM+xqo3Ebw="; 64 }; 65 66 env.HATCH_BUILD_HOOKS_ENABLE = true; 67 68 preConfigure = '' 69 pushd jupyterlab 70 ''; 71 72 preBuild = '' 73 popd 74 ''; 75 76 build-system = [ 77 hatch-jupyter-builder 78 hatchling 79 jupyterlab 80 ]; 81 82 dependencies = [ 83 markdown-it-py 84 mdit-py-plugins 85 nbformat 86 packaging 87 pyyaml 88 ] 89 ++ lib.optionals (pythonOlder "3.11") [ tomli ]; 90 91 nativeCheckInputs = [ 92 addBinToPathHook 93 jupyter-client 94 notebook 95 pytest-asyncio 96 pytest-xdist 97 pytestCheckHook 98 versionCheckHook 99 # Tests that use a Jupyter notebook require $HOME to be writable 100 writableTmpDirAsHomeHook 101 ]; 102 103 preCheck = '' 104 substituteInPlace tests/functional/contents_manager/test_async_and_sync_contents_manager_are_in_sync.py \ 105 --replace-fail "from black import FileMode, format_str" "" \ 106 --replace-fail "format_str(sync_code, mode=FileMode())" "sync_code" 107 ''; 108 109 disabledTestPaths = [ 110 # Requires the `git` python module 111 "tests/external" 112 ]; 113 114 disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [ 115 # requires access to trash 116 "test_load_save_rename" 117 ]; 118 119 pythonImportsCheck = [ 120 "jupytext" 121 "jupytext.cli" 122 ]; 123 124 meta = { 125 description = "Jupyter notebooks as Markdown documents, Julia, Python or R scripts"; 126 homepage = "https://github.com/mwouts/jupytext"; 127 changelog = "https://github.com/mwouts/jupytext/blob/${src.tag}/CHANGELOG.md"; 128 license = lib.licenses.mit; 129 teams = [ lib.teams.jupyter ]; 130 mainProgram = "jupytext"; 131 }; 132}