Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jupyter/jupyter_client
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v8.5.0
Choose a base ref
...
head repository: jupyter/jupyter_client
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2d6f52bdf5266688c51f3270cd7e47bbd17c708c
Choose a head ref
  • 5 commits
  • 29 files changed
  • 4 contributors

Commits on Oct 29, 2023

  1. Copy the full SHA
    43d008f View commit details
  2. Use ruff format (#992)

    * use ruff format
    
    * fix type
    
    * fix types
    blink1073 authored Oct 29, 2023
    Copy the full SHA
    586cbb3 View commit details

Commits on Nov 3, 2023

  1. Copy the full SHA
    79fa122 View commit details

Commits on Nov 6, 2023

  1. BUG: Fix Kwarg only in update_env (#989)

    * BUG: Fix Kwarg only in update_env
    
    closes jupyterlab/jupyterlab#15301
    
    * add typing informations
    
    * use str annotations
    Carreau authored Nov 6, 2023
    Copy the full SHA
    b61accf View commit details
  2. Unused *args in KernelManager's __init__ (#986)

    * Unused *args in KernelManager `__init__`
    
    I think that if it is unused, then it is likely a mistake from the
    caller that meant to pass a kwargs.
    
    This seem to have been ignored since 7.0.
    
    * [pre-commit.ci] auto fixes from pre-commit.com hooks
    
    for more information, see https://pre-commit.ci
    
    ---------
    
    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    Carreau and pre-commit-ci[bot] authored Nov 6, 2023
    Copy the full SHA
    2d6f52b View commit details
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -100,7 +100,7 @@ jobs:
- name: Run Linters
run: |
hatch run typing:test
hatch run lint:style
hatch run lint:build
pipx run interrogate -v .
pipx run doc8 --max-line-length=200 --ignore-path=docs/source/other/full-config.rst
22 changes: 14 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-case-conflict
- id: check-ast
@@ -36,17 +36,22 @@ repos:
- id: prettier
types_or: [yaml, html, json]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.6.1"
hooks:
- id: mypy
files: jupyter_client
stages: [manual]
args: ["--install-types", "--non-interactive"]
additional_dependencies:
["traitlets>=5.13", "ipykernel>=6.26", "jupyter_core>=5.3.2"]

- repo: https://github.com/adamchainz/blacken-docs
rev: "1.16.0"
hooks:
- id: blacken-docs
additional_dependencies: [black==23.7.0]

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.9.1
hooks:
- id: black

- repo: https://github.com/codespell-project/codespell
rev: "v2.2.6"
hooks:
@@ -61,13 +66,14 @@ repos:
- id: rst-inline-touching-normal

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.292
rev: v0.1.3
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format

- repo: https://github.com/scientific-python/cookie
rev: "2023.09.21"
rev: "2023.10.27"
hooks:
- id: sp-repo-review
additional_dependencies: ["repo-review[cli]"]
66 changes: 33 additions & 33 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -32,11 +32,11 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'myst_parser',
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.napoleon',
'sphinxcontrib_github_alt',
"myst_parser",
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
"sphinxcontrib_github_alt",
"sphinx_autodoc_typehints",
]

@@ -60,23 +60,23 @@ def filter(self, record: pylogging.LogRecord) -> bool:
myst_enable_extensions = ["html_image"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
source_suffix = ".rst"

# The encoding of source files.
# source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = 'jupyter_client'
copyright = '2015, Jupyter Development Team'
author = 'Jupyter Development Team'
project = "jupyter_client"
copyright = "2015, Jupyter Development Team"
author = "Jupyter Development Team"

github_project_url = "https://github.com/jupyter/jupyter_client"

@@ -86,14 +86,14 @@ def filter(self, record: pylogging.LogRecord) -> bool:
#
version_ns: dict = {}
here = os.path.dirname(__file__)
version_py = os.path.join(here, os.pardir, 'jupyter_client', '_version.py')
version_py = os.path.join(here, os.pardir, "jupyter_client", "_version.py")
with open(version_py) as f:
exec(compile(f.read(), version_py, 'exec'), version_ns) # noqa
exec(compile(f.read(), version_py, "exec"), version_ns) # noqa

# The short X.Y version.
version = '%i.%i' % version_ns['version_info'][:2]
version = "%i.%i" % version_ns["version_info"][:2]
# The full version, including alpha/beta/rc tags.
release = version_ns['__version__']
release = version_ns["__version__"]

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -110,7 +110,7 @@ def filter(self, record: pylogging.LogRecord) -> bool:

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
exclude_patterns = ["_build"]

# The reST default role (used for this markup: `text`) to use for all
# documents.
@@ -128,7 +128,7 @@ def filter(self, record: pylogging.LogRecord) -> bool:
# show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# A list of ignored prefixes for module index sorting.
# modindex_common_prefix = []
@@ -144,12 +144,12 @@ def filter(self, record: pylogging.LogRecord) -> bool:

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'pydata_sphinx_theme'
html_theme = "pydata_sphinx_theme"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
# html_theme_options = {}
html_theme_options = {"navigation_with_keys": False}

# Add any paths that contain custom themes here, relative to this directory.
# html_theme_path = []
@@ -236,7 +236,7 @@ def filter(self, record: pylogging.LogRecord) -> bool:
# html_search_scorer = 'scorer.js'

# Output file base name for HTML help builder.
htmlhelp_basename = 'jupyter_clientdoc'
htmlhelp_basename = "jupyter_clientdoc"

# -- Options for LaTeX output ---------------------------------------------

@@ -257,10 +257,10 @@ def filter(self, record: pylogging.LogRecord) -> bool:
latex_documents = [
(
master_doc,
'jupyter_client.tex',
'jupyter\\_client Documentation',
'Jupyter Development Team',
'manual',
"jupyter_client.tex",
"jupyter\\_client Documentation",
"Jupyter Development Team",
"manual",
),
]

@@ -289,7 +289,7 @@ def filter(self, record: pylogging.LogRecord) -> bool:

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, 'jupyter_client', 'jupyter_client Documentation', [author], 1)]
man_pages = [(master_doc, "jupyter_client", "jupyter_client Documentation", [author], 1)]

# If true, show URL addresses after external links.
# man_show_urls = False
@@ -303,12 +303,12 @@ def filter(self, record: pylogging.LogRecord) -> bool:
texinfo_documents = [
(
master_doc,
'jupyter_client',
'jupyter_client Documentation',
"jupyter_client",
"jupyter_client Documentation",
author,
'jupyter_client',
'One line description of project.',
'Miscellaneous',
"jupyter_client",
"One line description of project.",
"Miscellaneous",
),
]

@@ -326,10 +326,10 @@ def filter(self, record: pylogging.LogRecord) -> bool:


# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'ipython': ('http://ipython.readthedocs.io/en/stable/', None)}
intersphinx_mapping = {"ipython": ("http://ipython.readthedocs.io/en/stable/", None)}


def setup(app: object) -> None:
HERE = osp.abspath(osp.dirname(__file__))
dest = osp.join(HERE, 'changelog.md')
shutil.copy(osp.join(HERE, '..', 'CHANGELOG.md'), dest)
dest = osp.join(HERE, "changelog.md")
shutil.copy(osp.join(HERE, "..", "CHANGELOG.md"), dest)
8 changes: 4 additions & 4 deletions jupyter_client/_version.py
Original file line number Diff line number Diff line change
@@ -5,12 +5,12 @@
__version__ = "8.5.0"

# Build up version_info tuple for backwards compatibility
pattern = r'(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)'
pattern = r"(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)"
match = re.match(pattern, __version__)
if match:
parts: List[Union[int, str]] = [int(match[part]) for part in ['major', 'minor', 'patch']]
if match['rest']:
parts.append(match['rest'])
parts: List[Union[int, str]] = [int(match[part]) for part in ["major", "minor", "patch"]]
if match["rest"]:
parts.append(match["rest"])
else:
parts = []
version_info = tuple(parts)
2 changes: 1 addition & 1 deletion jupyter_client/channels.py
Original file line number Diff line number Diff line change
@@ -290,7 +290,7 @@ def __init__(self, socket: zmq.asyncio.Socket, session: Session, loop: t.Any = N
Unused here, for other implementations
"""
if not isinstance(socket, zmq.asyncio.Socket):
msg = 'Socket must be asyncio' # type:ignore[unreachable]
msg = "Socket must be asyncio" # type:ignore[unreachable]
raise ValueError(msg)
super().__init__(socket, session)

4 changes: 1 addition & 3 deletions jupyter_client/consoleapp.py
Original file line number Diff line number Diff line change
@@ -94,9 +94,7 @@ class JupyterConsoleApp(ConnectionFileMixin):

name: t.Union[str, Unicode] = "jupyter-console-mixin"

description: t.Union[
str, Unicode
] = """
description: t.Union[str, Unicode] = """
The Jupyter Console Mixin.
This class contains the common portions of console client (QtConsole,
4 changes: 2 additions & 2 deletions jupyter_client/ioloop/manager.py
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ def start_restarter(self) -> None:
"""Start the restarter."""
if self.autorestart and self.has_kernel:
if self._restarter is None:
self._restarter = self.restarter_class( # type:ignore[operator]
self._restarter = self.restarter_class(
kernel_manager=self, loop=self.loop, parent=self, log=self.log
)
self._restarter.start()
@@ -99,7 +99,7 @@ def start_restarter(self) -> None:
"""Start the restarter."""
if self.autorestart and self.has_kernel:
if self._restarter is None:
self._restarter = self.restarter_class( # type:ignore[operator]
self._restarter = self.restarter_class(
kernel_manager=self, loop=self.loop, parent=self, log=self.log
)
self._restarter.start()
12 changes: 6 additions & 6 deletions jupyter_client/jsonutil.py
Original file line number Diff line number Diff line change
@@ -108,10 +108,10 @@ def json_default(obj: Any) -> Any:
"""default function for packing objects in JSON."""
if isinstance(obj, datetime):
obj = _ensure_tzinfo(obj)
return obj.isoformat().replace('+00:00', 'Z')
return obj.isoformat().replace("+00:00", "Z")

if isinstance(obj, bytes):
return b2a_base64(obj, newline=False).decode('ascii')
return b2a_base64(obj, newline=False).decode("ascii")

if isinstance(obj, Iterable):
return list(obj)
@@ -157,10 +157,10 @@ def json_clean(obj: Any) -> Any:
if isinstance(obj, bytes):
# unanmbiguous binary data is base64-encoded
# (this probably should have happened upstream)
return b2a_base64(obj, newline=False).decode('ascii')
return b2a_base64(obj, newline=False).decode("ascii")

if isinstance(obj, container_to_list) or (
hasattr(obj, '__iter__') and hasattr(obj, next_attr_name)
hasattr(obj, "__iter__") and hasattr(obj, next_attr_name)
):
obj = list(obj)

@@ -175,8 +175,8 @@ def json_clean(obj: Any) -> Any:
nkeys_collapsed = len(set(map(str, obj)))
if nkeys != nkeys_collapsed:
msg = (
'dict cannot be safely converted to JSON: '
'key collision would lead to dropped values'
"dict cannot be safely converted to JSON: "
"key collision would lead to dropped values"
)
raise ValueError(msg)
# If all OK, proceed by making the new dict that will be json-safe
8 changes: 4 additions & 4 deletions jupyter_client/kernelspec.py
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@
class KernelSpec(HasTraits):
"""A kernel spec model object."""

argv = List()
argv: List[str] = List()
name = Unicode()
mimetype = Unicode()
display_name = Unicode()
@@ -160,7 +160,7 @@ def _user_kernel_dir_default(self) -> str:
By default, all installed kernels are allowed.
""",
)
kernel_dirs = List(
kernel_dirs: List[str] = List(
help="List of kernel directories to search. Later ones take priority over earlier."
)

@@ -241,7 +241,7 @@ def _get_kernel_spec_by_name(self, kernel_name: str, resource_dir: str) -> Kerne
pass
else:
if resource_dir == RESOURCES:
kdict = get_kernel_dict() # type:ignore[no-untyped-call]
kdict = get_kernel_dict()
kspec = self.kernel_spec_class(resource_dir=resource_dir, **kdict)
if not kspec:
kspec = self.kernel_spec_class.from_resource_dir(resource_dir)
@@ -415,7 +415,7 @@ def install_native_kernel_spec(self, user: bool = False) -> None:
)
from ipykernel.kernelspec import install

install(self, user=user) # type:ignore[no-untyped-call]
install(self, user=user)


def find_kernel_specs() -> dict[str, str]:
4 changes: 1 addition & 3 deletions jupyter_client/kernelspecapp.py
Original file line number Diff line number Diff line change
@@ -266,9 +266,7 @@ def start(self) -> None: # pragma: no cover
print("ipykernel not available, can't install its spec.", file=sys.stderr)
self.exit(1)
try:
kernelspec.install(
self.kernel_spec_manager, user=self.user
) # type:ignore[no-untyped-call]
kernelspec.install(self.kernel_spec_manager, user=self.user)
except OSError as e:
if e.errno == errno.EACCES:
print(e, file=sys.stderr)
Loading