Unverified Commit e1b21eaa authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

python312Packages.papermill: fix, cleanup (#400928)

parents 4fdf00c2 8965dab3
Loading
Loading
Loading
Loading
+15 −11
Original line number Diff line number Diff line
{
  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";
+46 −30
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  aiohttp,
  ansicolors,
  azure-datalake-store,
  azure-identity,
  azure-storage-blob,
  boto3,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  setuptools,

  # dependencies
  ansicolors,
  click,
  entrypoints,
  fetchFromGitHub,
  gcsfs,
  ipykernel,
  moto,
  nbclient,
  nbformat,
  pyarrow,
  pygithub,
  pytest-mock,
  pytestCheckHook,
  pythonAtLeast,
  pythonOlder,
  pyyaml,
  requests,
  setuptools,
  tenacity,
  tqdm,
  pythonAtLeast,
  aiohttp,

  # optional-dependencies
  azure-datalake-store,
  azure-identity,
  azure-storage-blob,
  gcsfs,
  pygithub,
  pyarrow,
  boto3,

  # tests
  ipykernel,
  moto,
  pytest-mock,
  pytestCheckHook,
  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 = [
    ansicolors
    click
    pyyaml
    nbformat
    entrypoints
    nbclient
    tqdm
    nbformat
    pyyaml
    requests
    entrypoints
    tenacity
    ansicolors
    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";
  };