Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-jupyter-client for openSUSE:Factory checked in at 2023-09-25 20:03:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-jupyter-client (Old) and /work/SRC/openSUSE:Factory/.python-jupyter-client.new.1770 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-jupyter-client" Mon Sep 25 20:03:17 2023 rev:19 rq:1113300 version:8.3.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-jupyter-client/python-jupyter-client.changes 2023-07-04 15:22:23.626210616 +0200 +++ /work/SRC/openSUSE:Factory/.python-jupyter-client.new.1770/python-jupyter-client.changes 2023-09-25 20:58:30.342022570 +0200 @@ -1,0 +2,8 @@ +Sun Sep 24 17:51:57 UTC 2023 - Ben Greiner <c...@bnavigator.de> + +- Update to 8.3.1 + * Support external kernels #961 (@davidbrochart) + * Make cache_ports configurable with default value of False. #956 + (@jkitchin) + +------------------------------------------------------------------- Old: ---- jupyter_client-8.3.0.tar.gz New: ---- jupyter_client-8.3.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-jupyter-client.spec ++++++ --- /var/tmp/diff_new_pack.BECxlU/_old 2023-09-25 20:58:31.514064911 +0200 +++ /var/tmp/diff_new_pack.BECxlU/_new 2023-09-25 20:58:31.518065056 +0200 @@ -26,7 +26,7 @@ %endif Name: python-jupyter-client%{psuffix} -Version: 8.3.0 +Version: 8.3.1 Release: 0 Summary: Jupyter protocol implementation and client libraries License: BSD-3-Clause ++++++ jupyter_client-8.3.0.tar.gz -> jupyter_client-8.3.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_client-8.3.0/.pre-commit-config.yaml new/jupyter_client-8.3.1/.pre-commit-config.yaml --- old/jupyter_client-8.3.0/.pre-commit-config.yaml 2020-02-02 01:00:00.000000000 +0100 +++ new/jupyter_client-8.3.1/.pre-commit-config.yaml 2020-02-02 01:00:00.000000000 +0100 @@ -20,7 +20,7 @@ - id: trailing-whitespace - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.23.1 + rev: 0.23.3 hooks: - id: check-github-workflows @@ -30,12 +30,12 @@ - id: mdformat - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 23.7.0 hooks: - id: black - - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.270 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.0.281 hooks: - id: ruff args: ["--fix"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_client-8.3.0/CHANGELOG.md new/jupyter_client-8.3.1/CHANGELOG.md --- old/jupyter_client-8.3.0/CHANGELOG.md 2020-02-02 01:00:00.000000000 +0100 +++ new/jupyter_client-8.3.1/CHANGELOG.md 2020-02-02 01:00:00.000000000 +0100 @@ -2,6 +2,28 @@ <!-- <START NEW CHANGELOG ENTRY> --> +## 8.3.1 + +([Full Changelog](https://github.com/jupyter/jupyter_client/compare/v8.3.0...b4f7d947fae55a4fe59a27df0830a9a78dcd4e12)) + +### Enhancements made + +- Support external kernels [#961](https://github.com/jupyter/jupyter_client/pull/961) ([@davidbrochart](https://github.com/davidbrochart)) + +### Bugs fixed + +- Make cache_ports configurable with default value of False. [#956](https://github.com/jupyter/jupyter_client/pull/956) ([@jkitchin](https://github.com/jkitchin)) + +### Maintenance and upkeep improvements + +### Contributors to this release + +([GitHub contributors page for this release](https://github.com/jupyter/jupyter_client/graphs/contributors?from=2023-06-23&to=2023-08-29&type=c)) + +[@blink1073](https://github.com/search?q=repo%3Ajupyter%2Fjupyter_client+involves%3Ablink1073+updated%3A2023-06-23..2023-08-29&type=Issues) | [@davidbrochart](https://github.com/search?q=repo%3Ajupyter%2Fjupyter_client+involves%3Adavidbrochart+updated%3A2023-06-23..2023-08-29&type=Issues) | [@jkitchin](https://github.com/search?q=repo%3Ajupyter%2Fjupyter_client+involves%3Ajkitchin+updated%3A2023-06-23..2023-08-29&type=Issues) | [@kevin-bates](https://github.com/search?q=repo%3Ajupyter%2Fjupyter_client+involves%3Akevin-bates+updated%3A2023-06-23..2023-08-29&type=Issues) | [@pre-commit-ci](https://github.com/search?q=repo%3Ajupyter%2Fjupyter_client+involves%3Apre-commit-ci+updated%3A2023-06-23..2023-08-29&type=Issues) | [@tmaxwell-anthropic](https://github.com/search?q=repo%3Ajupyter%2Fjupyter_client+involves%3Atmaxwell-anthropic+updated%3A2023-06-23..2023-08-29&type=Issues) + +<!-- <END NEW CHANGELOG ENTRY> --> + ## 8.3.0 ([Full Changelog](https://github.com/jupyter/jupyter_client/compare/v8.2.0...bddb8854a4aa3324e128e0497539e17246fbf630)) @@ -18,8 +40,6 @@ [@fecet](https://github.com/search?q=repo%3Ajupyter%2Fjupyter_client+involves%3Afecet+updated%3A2023-04-13..2023-06-23&type=Issues) | [@pre-commit-ci](https://github.com/search?q=repo%3Ajupyter%2Fjupyter_client+involves%3Apre-commit-ci+updated%3A2023-04-13..2023-06-23&type=Issues) -<!-- <END NEW CHANGELOG ENTRY> --> - ## 8.2.0 ([Full Changelog](https://github.com/jupyter/jupyter_client/compare/v8.1.0...dbf6b81fa5ab606eaedc5e8d0843debce18e8746)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_client-8.3.0/PKG-INFO new/jupyter_client-8.3.1/PKG-INFO --- old/jupyter_client-8.3.0/PKG-INFO 2020-02-02 01:00:00.000000000 +0100 +++ new/jupyter_client-8.3.1/PKG-INFO 2020-02-02 01:00:00.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: jupyter_client -Version: 8.3.0 +Version: 8.3.1 Summary: Jupyter protocol implementation and client libraries Project-URL: Homepage, https://jupyter.org Project-URL: Documentation, https://jupyter-client.readthedocs.io/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_client-8.3.0/jupyter_client/_version.py new/jupyter_client-8.3.1/jupyter_client/_version.py --- old/jupyter_client-8.3.0/jupyter_client/_version.py 2020-02-02 01:00:00.000000000 +0100 +++ new/jupyter_client-8.3.1/jupyter_client/_version.py 2020-02-02 01:00:00.000000000 +0100 @@ -2,7 +2,7 @@ import re from typing import List, Union -__version__ = "8.3.0" +__version__ = "8.3.1" # Build up version_info tuple for backwards compatibility pattern = r'(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_client-8.3.0/jupyter_client/connect.py new/jupyter_client-8.3.1/jupyter_client/connect.py --- old/jupyter_client-8.3.0/jupyter_client/connect.py 2020-02-02 01:00:00.000000000 +0100 +++ new/jupyter_client-8.3.1/jupyter_client/connect.py 2020-02-02 01:00:00.000000000 +0100 @@ -114,7 +114,7 @@ else: N = 1 for _ in range(ports_needed): - while os.path.exists(f"{ip}-{str(N)}"): + while os.path.exists(f"{ip}-{N!s}"): N += 1 ports.append(N) N += 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_client-8.3.0/jupyter_client/manager.py new/jupyter_client-8.3.1/jupyter_client/manager.py --- old/jupyter_client-8.3.0/jupyter_client/manager.py 2020-02-02 01:00:00.000000000 +0100 +++ new/jupyter_client-8.3.1/jupyter_client/manager.py 2020-02-02 01:00:00.000000000 +0100 @@ -85,7 +85,8 @@ out = await method(self, *args, **kwargs) # Add a small sleep to ensure tests can capture the state before done await asyncio.sleep(0.01) - self._ready.set_result(None) + if self.owns_kernel: + self._ready.set_result(None) return out except Exception as e: self._ready.set_exception(e) @@ -105,6 +106,7 @@ def __init__(self, *args, **kwargs): """Initialize a kernel manager.""" + self._owns_kernel = kwargs.pop("owns_kernel", True) super().__init__(**kwargs) self._shutdown_status = _ShutdownStatus.Unset self._attempted_start = False @@ -178,12 +180,14 @@ @property def kernel_spec(self) -> t.Optional[kernelspec.KernelSpec]: - if self._kernel_spec is None and self.kernel_name != "": # noqa + if self._kernel_spec is None and self.kernel_name != "": self._kernel_spec = self.kernel_spec_manager.get_kernel_spec(self.kernel_name) return self._kernel_spec cache_ports: Bool = Bool( - help="True if the MultiKernelManager should cache ports for this KernelManager instance" + False, + config=True, + help="True if the MultiKernelManager should cache ports for this KernelManager instance", ) @default("cache_ports") # type:ignore[misc] @@ -493,6 +497,9 @@ Will this kernel be restarted after it is shutdown. When this is True, connection files will not be cleaned up. """ + if not self.owns_kernel: + return + self.shutting_down = True # Used by restarter to prevent race condition # Stop monitoring for restarting while we shutdown. self.stop_restarter() @@ -557,6 +564,10 @@ restart_kernel = run_sync(_async_restart_kernel) @property + def owns_kernel(self) -> bool: + return self._owns_kernel + + @property def has_kernel(self) -> bool: """Has a kernel process been started that we are actively managing.""" return self.provisioner is not None and self.provisioner.has_process @@ -644,6 +655,9 @@ async def _async_is_alive(self) -> bool: """Is the kernel process still running?""" + if not self.owns_kernel: + return True + if self.has_kernel: assert self.provisioner is not None ret = await self.provisioner.poll() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_client-8.3.0/jupyter_client/multikernelmanager.py new/jupyter_client-8.3.1/jupyter_client/multikernelmanager.py --- old/jupyter_client-8.3.0/jupyter_client/multikernelmanager.py 2020-02-02 01:00:00.000000000 +0100 +++ new/jupyter_client-8.3.1/jupyter_client/multikernelmanager.py 2020-02-02 01:00:00.000000000 +0100 @@ -2,20 +2,23 @@ # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import asyncio +import json import os import socket import typing as t import uuid from functools import wraps +from pathlib import Path import zmq from traitlets import Any, Bool, Dict, DottedObjectName, Instance, Unicode, default, observe from traitlets.config.configurable import LoggingConfigurable from traitlets.utils.importstring import import_item +from .connect import KernelConnectionInfo from .kernelspec import NATIVE_KERNEL_NAME, KernelSpecManager from .manager import KernelManager -from .utils import ensure_async, run_sync +from .utils import ensure_async, run_sync, utcnow class DuplicateKernelError(Exception): @@ -105,9 +108,14 @@ return zmq.Context() connection_dir = Unicode("") + external_connection_dir = Unicode(None, allow_none=True) _kernels = Dict() + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.kernel_id_to_connection_file = {} + def __del__(self): """Handle garbage collection. Destroy context if applicable.""" if self._created_context and self.context and not self.context.closed: @@ -123,6 +131,51 @@ def list_kernel_ids(self) -> t.List[str]: """Return a list of the kernel ids of the active kernels.""" + if self.external_connection_dir is not None: + external_connection_dir = Path(self.external_connection_dir) + if external_connection_dir.is_dir(): + connection_files = [p for p in external_connection_dir.iterdir() if p.is_file()] + + # remove kernels (whose connection file has disappeared) from our list + k = list(self.kernel_id_to_connection_file.keys()) + v = list(self.kernel_id_to_connection_file.values()) + for connection_file in list(self.kernel_id_to_connection_file.values()): + if connection_file not in connection_files: + kernel_id = k[v.index(connection_file)] + del self.kernel_id_to_connection_file[kernel_id] + del self._kernels[kernel_id] + + # add kernels (whose connection file appeared) to our list + for connection_file in connection_files: + if connection_file in self.kernel_id_to_connection_file.values(): + continue + try: + connection_info: KernelConnectionInfo = json.loads( + connection_file.read_text() + ) + except Exception: # noqa: S112 + continue + self.log.debug("Loading connection file %s", connection_file) + if not ("kernel_name" in connection_info and "key" in connection_info): + continue + # it looks like a connection file + kernel_id = self.new_kernel_id() + self.kernel_id_to_connection_file[kernel_id] = connection_file + km = self.kernel_manager_factory( + parent=self, + log=self.log, + owns_kernel=False, + ) + km.load_connection_info(connection_info) + km.last_activity = utcnow() + km.execution_state = "idle" + km.connections = 1 + km.kernel_id = kernel_id + km.kernel_name = connection_info["kernel_name"] + km.ready.set_result(None) + + self._kernels[kernel_id] = km + # Create a copy so we can iterate over kernels in operations # that delete keys. return list(self._kernels.keys()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_client-8.3.0/jupyter_client/utils.py new/jupyter_client-8.3.1/jupyter_client/utils.py --- old/jupyter_client-8.3.0/jupyter_client/utils.py 2020-02-02 01:00:00.000000000 +0100 +++ new/jupyter_client-8.3.1/jupyter_client/utils.py 2020-02-02 01:00:00.000000000 +0100 @@ -4,6 +4,7 @@ - vendor functions from ipython_genutils that should be retired at some point. """ import os +from datetime import datetime, timedelta, tzinfo from jupyter_core.utils import ensure_async, run_sync # noqa: F401 # noqa: F401 @@ -83,3 +84,35 @@ if os.name == "nt": s = s.replace("IPYTHON_TEMP", "$\\") return s + + +# constant for zero offset +ZERO = timedelta(0) + + +class tzUTC(tzinfo): # noqa + """tzinfo object for UTC (zero offset)""" + + def utcoffset(self, d): + """Compute utcoffset.""" + return ZERO + + def dst(self, d): + """Compute dst.""" + return ZERO + + +UTC = tzUTC() # type:ignore + + +def utc_aware(unaware): + """decorator for adding UTC tzinfo to datetime's utcfoo methods""" + + def utc_method(*args, **kwargs): + dt = unaware(*args, **kwargs) + return dt.replace(tzinfo=UTC) + + return utc_method + + +utcnow = utc_aware(datetime.utcnow) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_client-8.3.0/pyproject.toml new/jupyter_client-8.3.1/pyproject.toml --- old/jupyter_client-8.3.0/pyproject.toml 2020-02-02 01:00:00.000000000 +0100 +++ new/jupyter_client-8.3.1/pyproject.toml 2020-02-02 01:00:00.000000000 +0100 @@ -111,7 +111,7 @@ dependencies = [ "black[jupyter]==23.3.0", "mdformat>0.7", - "ruff==0.0.270", + "ruff==0.0.276", ] [tool.hatch.envs.lint.scripts] style = [ @@ -249,6 +249,8 @@ "S110", # PLW0603 Using the global statement to update "PLW0603", + # Mutable class attributes should be annotated with `typing.ClassVar` + "RUF012", ] unfixable = [ # Don't touch print statements diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_client-8.3.0/tests/test_adapter.py new/jupyter_client-8.3.1/tests/test_adapter.py --- old/jupyter_client-8.3.0/tests/test_adapter.py 2020-02-02 01:00:00.000000000 +0100 +++ new/jupyter_client-8.3.1/tests/test_adapter.py 2020-02-02 01:00:00.000000000 +0100 @@ -20,7 +20,7 @@ def test_code_to_line_no_code(): line, pos = code_to_line("", 0) - assert line == "" # noqa + assert line == "" assert pos == 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jupyter_client-8.3.0/tests/test_jsonutil.py new/jupyter_client-8.3.1/tests/test_jsonutil.py --- old/jupyter_client-8.3.0/tests/test_jsonutil.py 2020-02-02 01:00:00.000000000 +0100 +++ new/jupyter_client-8.3.1/tests/test_jsonutil.py 2020-02-02 01:00:00.000000000 +0100 @@ -34,7 +34,7 @@ def test_parse_date_invalid(): assert jsonutil.parse_date(None) is None - assert jsonutil.parse_date("") == "" # noqa + assert jsonutil.parse_date("") == "" assert jsonutil.parse_date("invalid-date") == "invalid-date"