natsukium 2023-12-21 15:10:17 +09:00
parent fb9a578db7
commit f493827520
No known key found for this signature in database
GPG Key ID: 9EA45A31DB994C53

View File

@ -1,86 +1,66 @@
{ lib
, stdenv
, buildPythonPackage
, fetchFromGitHub
, gitpython
, isort
, fetchPypi
, hatch-jupyter-builder
, hatchling
, jupyter-client
, jupyter-packaging
, jupyterlab
, markdown-it-py
, mdit-py-plugins
, nbformat
, notebook
, packaging
, pytest-xdist
, pytestCheckHook
, pythonOlder
, pyyaml
, setuptools
, toml
, wheel
}:
buildPythonPackage rec {
pname = "jupytext";
version = "1.15.2";
format = "pyproject";
version = "1.16.0";
pyproject = true;
disabled = pythonOlder "3.6";
disabled = pythonOlder "3.8";
src = fetchFromGitHub {
owner = "mwouts";
repo = pname;
rev = "refs/tags/v${version}";
hash = "sha256-GvMoz2BsYWk0atrT3xmSnbV7AuO5RJoM/bOJlZ5YIn4=";
src = fetchPypi {
inherit pname version;
hash = "sha256-lMfmd3XpDheSw5q3/KTgRZv3w1ZWEj6Nwunhs+lTuvg=";
};
# Follow https://github.com/mwouts/jupytext/pull/1119 to see if the patch
# relaxing jupyter_packaging version can be cleaned up.
#
# Follow https://github.com/mwouts/jupytext/pull/1077 to see when the patch
# relaxing jupyterlab version can be cleaned up.
#
postPatch = ''
substituteInPlace pyproject.toml \
--replace 'jupyter_packaging~=' 'jupyter_packaging>=' \
--replace 'jupyterlab>=3,<=4' 'jupyterlab>=3'
'';
nativeBuildInputs = [
jupyter-packaging
jupyterlab
setuptools
wheel
hatch-jupyter-builder
hatchling
];
propagatedBuildInputs = [
markdown-it-py
mdit-py-plugins
nbformat
packaging
pyyaml
toml
];
nativeCheckInputs = [
gitpython
isort
jupyter-client
notebook
pytest-xdist
pytestCheckHook
];
preCheck = ''
# Tests that use a Jupyter notebook require $HOME to be writable
export HOME=$(mktemp -d);
export PATH=$out/bin:$PATH;
'';
pytestFlagsArray = [
# Pre-commit tests expect the source directory to be a Git repository
"--ignore-glob='tests/test_pre_commit_*.py'"
disabledTestPaths = [
"tests/external"
];
disabledTests = [
"test_apply_black_through_jupytext" # we can't do anything about ill-formatted notebooks
] ++ lib.optionals stdenv.isDarwin [
disabledTests = lib.optionals stdenv.isDarwin [
# requires access to trash
"test_load_save_rename"
];
@ -93,8 +73,9 @@ buildPythonPackage rec {
meta = with lib; {
description = "Jupyter notebooks as Markdown documents, Julia, Python or R scripts";
homepage = "https://github.com/mwouts/jupytext";
changelog = "https://github.com/mwouts/jupytext/releases/tag/${src.rev}";
changelog = "https://github.com/mwouts/jupytext/releases/tag/v${version}";
license = licenses.mit;
maintainers = teams.jupyter.members;
mainProgram = "jupytext";
};
}