diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index d42879b..d19831b 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -15,7 +15,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ["3.8", "3.12"] + python-version: ["3.8", "3.12", "3.13"] include: - os: windows-latest python-version: "3.9" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 08c0c3b..fe0ad24 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ ci: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: check-case-conflict - id: check-ast @@ -21,12 +21,12 @@ repos: - id: trailing-whitespace - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.27.4 + rev: 0.31.3 hooks: - id: check-github-workflows - repo: https://github.com/executablebooks/mdformat - rev: 0.7.17 + rev: 0.7.22 hooks: - id: mdformat additional_dependencies: @@ -39,13 +39,13 @@ repos: types_or: [yaml, html, json] - repo: https://github.com/adamchainz/blacken-docs - rev: "1.16.0" + rev: "1.19.1" hooks: - id: blacken-docs additional_dependencies: [black==23.7.0] - repo: https://github.com/codespell-project/codespell - rev: "v2.2.6" + rev: "v2.4.1" hooks: - id: codespell args: ["-L", "sur,nd"] @@ -58,7 +58,7 @@ repos: - id: rst-inline-touching-normal - repo: https://github.com/pre-commit/mirrors-mypy - rev: "v1.8.0" + rev: "v1.15.0" hooks: - id: mypy files: comm @@ -66,7 +66,7 @@ repos: additional_dependencies: ["traitlets>=5.13"] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.2.0 + rev: v0.11.0 hooks: - id: ruff types_or: [python, jupyter] @@ -75,7 +75,7 @@ repos: types_or: [python, jupyter] - repo: https://github.com/scientific-python/cookie - rev: "2024.01.24" + rev: "2025.01.22" hooks: - id: sp-repo-review additional_dependencies: ["repo-review[cli]"] diff --git a/comm/__init__.py b/comm/__init__.py index ec9b8b3..87ec8cc 100644 --- a/comm/__init__.py +++ b/comm/__init__.py @@ -7,6 +7,7 @@ the Jupyter kernel protocol. It also provides a base Comm implementation and a default CommManager for the IPython case. """ + from __future__ import annotations from typing import Any @@ -15,9 +16,9 @@ __version__ = "0.2.2" __all__ = [ + "__version__", "create_comm", "get_comm_manager", - "__version__", ] _comm_manager = None diff --git a/comm/base_comm.py b/comm/base_comm.py index 6bf4c48..151e85f 100644 --- a/comm/base_comm.py +++ b/comm/base_comm.py @@ -1,5 +1,4 @@ -"""Default classes for Comm and CommManager, for usage in IPython. -""" +"""Default classes for Comm and CommManager, for usage in IPython.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. @@ -53,7 +52,7 @@ def __init__( self.primary = primary self.target_name = target_name self.target_module = target_module - self.topic = topic if topic else ("comm-%s" % self.comm_id).encode("ascii") + self.topic = topic if topic else (f"comm-{self.comm_id}").encode("ascii") self._open_data = _open_data if _open_data else {} self._close_data = _close_data if _close_data else {} @@ -71,11 +70,11 @@ def __init__( def publish_msg( self, - msg_type: str, # noqa: ARG002 - data: MaybeDict = None, # noqa: ARG002 - metadata: MaybeDict = None, # noqa: ARG002 - buffers: BuffersType = None, # noqa: ARG002 - **keys: t.Any, # noqa: ARG002 + msg_type: str, + data: MaybeDict = None, + metadata: MaybeDict = None, + buffers: BuffersType = None, + **keys: t.Any, ) -> None: msg = "publish_msg Comm method is not implemented" raise NotImplementedError(msg) @@ -314,4 +313,4 @@ def comm_close(self, stream: ZMQStream, ident: str, msg: MessageType) -> None: logger.error("Exception in comm_close for %s", comm_id, exc_info=True) -__all__ = ["CommManager", "BaseComm"] +__all__ = ["BaseComm", "CommManager"]