python312Packages.papermill: fix, cleanup (#400928)

This commit is contained in:
Gaétan Lepage
2025-04-22 23:10:15 +02:00
committed by GitHub
2 changed files with 64 additions and 44 deletions
@@ -1,14 +1,15 @@
{
lib,
buildPythonPackage,
fetchPypi,
fetchFromGitHub,
replaceVars,
bashInteractive,
flit-core,
filetype,
ipykernel,
python,
pexpect,
bashInteractive,
replaceVars,
writableTmpDirAsHomeHook,
python,
}:
buildPythonPackage rec {
@@ -16,10 +17,11 @@ buildPythonPackage rec {
version = "0.10.0";
pyproject = true;
src = fetchPypi {
pname = "bash_kernel";
inherit version;
hash = "sha256-LtWgpBbEGNHXUecVBb1siJ4SFXREtQxCh6aF2ndcKMo=";
src = fetchFromGitHub {
owner = "takluyver";
repo = "bash_kernel";
tag = version;
hash = "sha256-ugFMcQx1B1nKoO9rhb6PMllRcoZi0O4B9um8dOu5DU4=";
};
patches = [
@@ -36,9 +38,9 @@ buildPythonPackage rec {
pexpect
];
preBuild = ''
export HOME=$TMPDIR
'';
nativeBuildInputs = [
writableTmpDirAsHomeHook
];
postInstall = ''
${python.pythonOnBuildForHost.interpreter} -m bash_kernel.install --prefix $out
@@ -59,6 +61,8 @@ buildPythonPackage rec {
runHook postCheck
'';
__darwinAllowLocalNetworking = true;
meta = {
description = "Bash Kernel for Jupyter";
homepage = "https://github.com/takluyver/bash_kernel";
@@ -1,32 +1,41 @@
{
lib,
stdenv,
aiohttp,
buildPythonPackage,
fetchFromGitHub,
# build-system
setuptools,
# dependencies
ansicolors,
click,
entrypoints,
nbclient,
nbformat,
pyyaml,
requests,
tenacity,
tqdm,
pythonAtLeast,
aiohttp,
# optional-dependencies
azure-datalake-store,
azure-identity,
azure-storage-blob,
boto3,
buildPythonPackage,
click,
entrypoints,
fetchFromGitHub,
gcsfs,
pygithub,
pyarrow,
boto3,
# tests
ipykernel,
moto,
nbclient,
nbformat,
pyarrow,
pygithub,
pytest-mock,
pytestCheckHook,
pythonAtLeast,
pythonOlder,
pyyaml,
requests,
setuptools,
tenacity,
tqdm,
versionCheckHook,
writableTmpDirAsHomeHook,
}:
buildPythonPackage rec {
@@ -34,8 +43,6 @@ buildPythonPackage rec {
version = "2.6.0";
pyproject = true;
disabled = pythonOlder "3.8";
src = fetchFromGitHub {
owner = "nteract";
repo = "papermill";
@@ -46,15 +53,15 @@ buildPythonPackage rec {
build-system = [ setuptools ];
dependencies = [
click
pyyaml
nbformat
nbclient
tqdm
requests
entrypoints
tenacity
ansicolors
click
entrypoints
nbclient
nbformat
pyyaml
requests
tenacity
tqdm
] ++ lib.optionals (pythonAtLeast "3.12") [ aiohttp ];
optional-dependencies = {
@@ -75,17 +82,25 @@ buildPythonPackage rec {
moto
pytest-mock
pytestCheckHook
versionCheckHook
writableTmpDirAsHomeHook
]
++ optional-dependencies.azure
++ optional-dependencies.s3
++ optional-dependencies.gcs;
preCheck = ''
export HOME=$(mktemp -d)
'';
versionCheckProgramArg = "--version";
pythonImportsCheck = [ "papermill" ];
# Using pytestFlagsArray to prevent disabling false positives
pytestFlagsArray = [
# AssertionError: 'error' != 'display_data'
"--deselect=papermill/tests/test_execute.py::TestBrokenNotebook2::test"
# AssertionError: '\x1b[31mSystemExit\x1b[39m\x1b[31m:\x1b[39m 1\n' != '\x1b[0;31mSystemExit\x1b[0m\x1b[0;31m:\x1b[0m 1\n'
"--deselect=papermill/tests/test_execute.py::TestOutputFormatting::test_output_formatting"
];
disabledTests =
[
# pytest 8 compat
@@ -103,10 +118,11 @@ buildPythonPackage rec {
__darwinAllowLocalNetworking = true;
meta = with lib; {
meta = {
description = "Parametrize and run Jupyter and interact with notebooks";
homepage = "https://github.com/nteract/papermill";
license = licenses.bsd3;
changelog = "https://papermill.readthedocs.io/en/latest/changelog.html";
license = lib.licenses.bsd3;
maintainers = [ ];
mainProgram = "papermill";
};