Commit 5ac5bf7f authored by Gaetan Lepage's avatar Gaetan Lepage
Browse files

python312Packages.jupyter-console: clean and fix on darwin

parent c53153d5
Loading
Loading
Loading
Loading
+34 −20
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchPypi,
  pythonOlder,
  fetchFromGitHub,

  # build-system
  hatchling,

  # dependencies
  ipykernel,
  exceptiongroup,
  ipython,
  jupyter-client,
  jupyter-core,
@@ -13,6 +15,8 @@
  pygments,
  pyzmq,
  traitlets,

  # tests
  flaky,
  pexpect,
  pytestCheckHook,
@@ -21,27 +25,29 @@
buildPythonPackage rec {
  pname = "jupyter-console";
  version = "6.6.3";
  format = "pyproject";
  pyproject = true;

  disabled = pythonOlder "3.7";

  src = fetchPypi {
    pname = "jupyter_console";
    inherit version;
    hash = "sha256-VmpL8xyHrb+t8izfhG4wabWace1dpx1rpNiqrRSlNTk=";
  src = fetchFromGitHub {
    owner = "jupyter";
    repo = "jupyter_console";
    rev = "refs/tags/v${version}";
    hash = "sha256-jdSeZCspcjEQVBpJyxVnwJ5SAq+SS1bW9kqp/F/zwCQ=";
  };

  nativeBuildInputs = [ hatchling ];

  postPatch = ''
    # use wrapped executable in tests
  postPatch =
    # Use wrapped executable in tests
    let
      binPath = "${placeholder "out"}/bin/jupyter-console";
    in
    ''
      substituteInPlace jupyter_console/tests/test_console.py \
      --replace "args = ['-m', 'jupyter_console', '--colors=NoColor']" "args = ['--colors=NoColor']" \
      --replace "cmd = sys.executable" "cmd = '${placeholder "out"}/bin/jupyter-console'" \
      --replace "check_output([sys.executable, '-m', 'jupyter_console'," "check_output(['${placeholder "out"}/bin/jupyter-console',"
        --replace-fail "'-m', 'jupyter_console', " "" \
        --replace-fail "sys.executable" "'${binPath}'"
    '';

  propagatedBuildInputs = [
  build-system = [ hatchling ];

  dependencies = [
    ipykernel
    ipython
    jupyter-client
@@ -50,7 +56,7 @@ buildPythonPackage rec {
    pygments
    pyzmq
    traitlets
  ] ++ lib.optionals (pythonOlder "3.11") [ exceptiongroup ];
  ];

  pythonImportsCheck = [ "jupyter_console" ];

@@ -64,6 +70,14 @@ buildPythonPackage rec {
    export HOME=$TMPDIR
  '';

  disabledTests = [
    # Flaky: pexpect.exceptions.TIMEOUT: Timeout exceeded
    "test_console_starts"
    "test_display_text"
  ];

  __darwinAllowLocalNetworking = true;

  meta = {
    description = "Jupyter terminal console";
    mainProgram = "jupyter-console";