Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c6d5ad6

Browse files
authored
Unpin pytest-asyncio and update ruff config (ipython#1209)
1 parent 05c6153 commit c6d5ad6

16 files changed

+74
-75
lines changed

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
]
3838

3939
try:
40-
import enchant
40+
import enchant # noqa: F401
4141

4242
extensions += ["sphinxcontrib.spelling"]
4343
except ImportError:

hatch_build.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"""A custom hatch build hook for ipykernel."""
2-
import os
32
import shutil
43
import sys
54
from pathlib import Path

ipykernel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
kernel_protocol_version_info,
55
version_info,
66
)
7-
from .connect import *
7+
from .connect import * # noqa: F403

ipykernel/compiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def murmur2_x86(data, seed):
4545
return h
4646

4747

48-
convert_to_long_pathname = lambda filename: filename
48+
convert_to_long_pathname = lambda filename: filename # noqa: E731
4949

5050
if sys.platform == "win32":
5151
try:

ipykernel/datapub.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1+
# Copyright (c) IPython Development Team.
2+
# Distributed under the terms of the Modified BSD License.
3+
14
"""Publishing native (typically pickled) objects.
25
"""
36

47
import warnings
58

6-
warnings.warn(
7-
"ipykernel.datapub is deprecated. It has moved to ipyparallel.datapub",
8-
DeprecationWarning,
9-
stacklevel=2,
10-
)
11-
12-
# Copyright (c) IPython Development Team.
13-
# Distributed under the terms of the Modified BSD License.
14-
159
from traitlets import Any, CBytes, Dict, Instance
1610
from traitlets.config import Configurable
1711

@@ -26,6 +20,12 @@
2620

2721
from jupyter_client.session import Session, extract_header
2822

23+
warnings.warn(
24+
"ipykernel.datapub is deprecated. It has moved to ipyparallel.datapub",
25+
DeprecationWarning,
26+
stacklevel=2,
27+
)
28+
2929

3030
class ZMQDataPublisher(Configurable):
3131
"""A zmq data publisher."""

ipykernel/debugger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
try:
2323
# This import is required to have the next ones working...
24-
from debugpy.server import api
24+
from debugpy.server import api # noqa: F401
2525

2626
from _pydevd_bundle import pydevd_frame_utils # isort: skip
2727
from _pydevd_bundle.pydevd_suspended_frames import ( # isort: skip

ipykernel/eventloops.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -484,24 +484,24 @@ def set_qt_api_env_from_gui(gui):
484484
else:
485485
if gui == "qt5":
486486
try:
487-
import PyQt5
487+
import PyQt5 # noqa: F401
488488

489489
os.environ["QT_API"] = "pyqt5"
490490
except ImportError:
491491
try:
492-
import PySide2
492+
import PySide2 # noqa: F401
493493

494494
os.environ["QT_API"] = "pyside2"
495495
except ImportError:
496496
os.environ["QT_API"] = "pyqt5"
497497
elif gui == "qt6":
498498
try:
499-
import PyQt6
499+
import PyQt6 # noqa: F401
500500

501501
os.environ["QT_API"] = "pyqt6"
502502
except ImportError:
503503
try:
504-
import PySide6
504+
import PySide6 # noqa: F401
505505

506506
os.environ["QT_API"] = "pyside6"
507507
except ImportError:
@@ -516,7 +516,7 @@ def set_qt_api_env_from_gui(gui):
516516

517517
# Do the actual import now that the environment variable is set to make sure it works.
518518
try:
519-
from IPython.external.qt_for_kernel import QtCore, QtGui
519+
pass
520520
except Exception as e:
521521
# Clear the environment variable for the next attempt.
522522
if "QT_API" in os.environ:

ipykernel/gui/gtk3embed.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@
1414
import sys
1515
import warnings
1616

17-
warnings.warn(
18-
"The Gtk3 event loop for ipykernel is deprecated", category=DeprecationWarning, stacklevel=2
19-
)
20-
2117
# Third-party
2218
import gi
2319

2420
gi.require_version("Gdk", "3.0")
2521
gi.require_version("Gtk", "3.0")
26-
from gi.repository import GObject, Gtk
22+
from gi.repository import GObject, Gtk # noqa: E402
23+
24+
warnings.warn(
25+
"The Gtk3 event loop for ipykernel is deprecated", category=DeprecationWarning, stacklevel=2
26+
)
2727

2828
# -----------------------------------------------------------------------------
2929
# Classes and functions

ipykernel/gui/gtkembed.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
import sys
1515
import warnings
1616

17-
warnings.warn(
18-
"The Gtk3 event loop for ipykernel is deprecated", category=DeprecationWarning, stacklevel=2
19-
)
20-
2117
# Third-party
2218
import gobject
2319
import gtk
2420

21+
warnings.warn(
22+
"The Gtk3 event loop for ipykernel is deprecated", category=DeprecationWarning, stacklevel=2
23+
)
24+
2525
# -----------------------------------------------------------------------------
2626
# Classes and functions
2727
# -----------------------------------------------------------------------------

ipykernel/ipkernel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ async def do_execute(
381381
should_run_async = shell.should_run_async
382382
accepts_params = _accepts_parameters(run_cell, ["cell_id"])
383383
else:
384-
should_run_async = lambda cell: False # noqa: ARG005
384+
should_run_async = lambda cell: False # noqa: ARG005, E731
385385
# older IPython,
386386
# use blocking run_cell and wrap it in coroutine
387387

ipykernel/kernelspec.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from jupyter_client.kernelspec import KernelSpecManager
1919
from traitlets import Unicode
20+
from traitlets.config import Application
2021

2122
try:
2223
from .debugger import _is_debugpy_available
@@ -171,8 +172,6 @@ def install(
171172

172173
# Entrypoint
173174

174-
from traitlets.config import Application
175-
176175

177176
class InstallIPythonKernelSpecApp(Application):
178177
"""Dummy app wrapping argparse"""

ipykernel/pickleutil.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,23 @@
22

33
# Copyright (c) IPython Development Team.
44
# Distributed under the terms of the Modified BSD License.
5-
import typing
6-
import warnings
7-
8-
warnings.warn(
9-
"ipykernel.pickleutil is deprecated. It has moved to ipyparallel.",
10-
DeprecationWarning,
11-
stacklevel=2,
12-
)
13-
145
import copy
156
import pickle
167
import sys
8+
import typing
9+
import warnings
1710
from types import FunctionType
1811

1912
# This registers a hook when it's imported
20-
from ipyparallel.serialize import codeutil
2113
from traitlets.log import get_logger
2214
from traitlets.utils.importstring import import_item
2315

16+
warnings.warn(
17+
"ipykernel.pickleutil is deprecated. It has moved to ipyparallel.",
18+
DeprecationWarning,
19+
stacklevel=2,
20+
)
21+
2422
buffer = memoryview
2523
class_type = type
2624

ipykernel/pylab/backend_inline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import warnings
77

8-
from matplotlib_inline.backend_inline import * # type:ignore[import-untyped] # analysis: ignore
8+
from matplotlib_inline.backend_inline import * # type:ignore[import-untyped] # noqa: F403 # analysis: ignore
99

1010
warnings.warn(
1111
"`ipykernel.pylab.backend_inline` is deprecated, directly "

ipykernel/pylab/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import warnings
77

8-
from matplotlib_inline.config import * # type:ignore[import-untyped] # analysis: ignore
8+
from matplotlib_inline.config import * # type:ignore[import-untyped] # noqa: F403 # analysis: ignore
99

1010
warnings.warn(
1111
"`ipykernel.pylab.config` is deprecated, directly use `matplotlib_inline.config`",

ipykernel/serialize.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,8 @@
33
# Copyright (c) IPython Development Team.
44
# Distributed under the terms of the Modified BSD License.
55

6-
import warnings
7-
8-
warnings.warn(
9-
"ipykernel.serialize is deprecated. It has moved to ipyparallel.serialize",
10-
DeprecationWarning,
11-
stacklevel=2,
12-
)
13-
146
import pickle
7+
import warnings
158
from itertools import chain
169

1710
try:
@@ -41,6 +34,12 @@
4134

4235
from jupyter_client.session import MAX_BYTES, MAX_ITEMS
4336

37+
warnings.warn(
38+
"ipykernel.serialize is deprecated. It has moved to ipyparallel.serialize",
39+
DeprecationWarning,
40+
stacklevel=2,
41+
)
42+
4443
# -----------------------------------------------------------------------------
4544
# Serialization Functions
4645
# -----------------------------------------------------------------------------

pyproject.toml

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ test = [
5353
"flaky",
5454
"ipyparallel",
5555
"pre-commit",
56-
"pytest-asyncio==0.23.4",
56+
"pytest-asyncio>=0.23.5",
5757
"pytest-timeout"
5858
]
5959
cov = [
@@ -209,29 +209,29 @@ omit = [
209209
line-length = 100
210210

211211
[tool.ruff.lint]
212-
select = [
213-
"B", # flake8-bugbear
214-
"I", # isort
215-
"ARG", # flake8-unused-arguments
216-
"C4", # flake8-comprehensions
217-
"EM", # flake8-errmsg
218-
"ICN", # flake8-import-conventions
219-
"G", # flake8-logging-format
220-
"PGH", # pygrep-hooks
221-
"PIE", # flake8-pie
222-
"PL", # pylint
223-
"PT", # flake8-pytest-style
224-
"PTH", # flake8-use-pathlib
225-
"RET", # flake8-return
226-
"RUF", # Ruff-specific
227-
"SIM", # flake8-simplify
228-
"T20", # flake8-print
229-
"UP", # pyupgrade
230-
"YTT", # flake8-2020
231-
"EXE", # flake8-executable
232-
"NPY", # NumPy specific rules
233-
"PD", # pandas-vet
234-
"PYI", # flake8-pyi
212+
extend-select = [
213+
"B", # flake8-bugbear
214+
"I", # isort
215+
"ARG", # flake8-unused-arguments
216+
"C4", # flake8-comprehensions
217+
"EM", # flake8-errmsg
218+
"ICN", # flake8-import-conventions
219+
"G", # flake8-logging-format
220+
"PGH", # pygrep-hooks
221+
"PIE", # flake8-pie
222+
"PL", # pylint
223+
"PT", # flake8-pytest-style
224+
"PTH", # flake8-use-pathlib
225+
"RET", # flake8-return
226+
"RUF", # Ruff-specific
227+
"SIM", # flake8-simplify
228+
"T20", # flake8-print
229+
"UP", # pyupgrade
230+
"YTT", # flake8-2020
231+
"EXE", # flake8-executable
232+
"NPY", # NumPy specific rules
233+
"PD", # pandas-vet
234+
"PYI", # flake8-pyi
235235
]
236236
ignore = [
237237
"PLR", # Design related pylint codes
@@ -265,6 +265,9 @@ unfixable = [
265265
"T201",
266266
# Don't touch noqa lines
267267
"RUF100",
268+
# Don't touch imports
269+
"F401",
270+
"F403"
268271
]
269272

270273
[tool.ruff.lint.per-file-ignores]
@@ -277,6 +280,7 @@ unfixable = [
277280
# B018 Found useless expression. Either assign it to a variable or remove it.
278281
# S603 `subprocess` call: check for execution of untrusted input
279282
"tests/*" = ["B011", "C408", "T201", "B007", "EM", "PTH", "PLW", "PLC1901", "B018", "S603", "ARG", "RET", "PGH"]
283+
"*/__init__.py" = ["F401"]
280284

281285
[tool.interrogate]
282286
ignore-init-module=true

0 commit comments

Comments
 (0)