Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update typing for traitlets 5.13 #995

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ 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:
Expand Down
4 changes: 2 additions & 2 deletions jupyter_client/ioloop/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions jupyter_client/kernelspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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."
)

Expand Down
25 changes: 7 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,27 +98,16 @@ test = "python -m pytest -vv --cov jupyter_client --cov-branch --cov-report term
nowarn = "test -W default {args}"

[tool.hatch.envs.typing]
features = ["test"]
dependencies = ["mypy~=1.6", "traitlets>=5.11.2", "ipykernel>=6.26", "jupyter_core>=5.3.2"]
dependencies = ["pre-commit"]
detached = true
[tool.hatch.envs.typing.scripts]
test = "mypy --install-types --non-interactive {args}"
test = "pre-commit run --all-files --hook-stage manual mypy"

[tool.hatch.envs.lint]
dependencies = [
"mdformat>0.7",
"ruff==0.1.3",
]
dependencies = ["pre-commit"]
detached = true
[tool.hatch.envs.lint.scripts]
style = [
"ruff {args:.}",
"ruff format {args:.}",
"mdformat --check {args:docs *.md}"
]
fmt = [
"ruff --fix {args:.}",
"ruff format {args:.}",
"mdformat {args:docs *.md}"
]
build = ["pre-commit run --all-files ruff"]

[tool.pytest.ini_options]
minversion = "6.0"
Expand Down Expand Up @@ -289,4 +278,4 @@ fail-under=90
exclude = ["docs", "test"]

[tool.repo-review]
ignore = ["PY007", "PP308", "GH102", "PC140"]
ignore = ["PY007", "PP308", "GH102"]
Loading