Skip to content

Commit aea457a

Browse files
committed
Sync with main
2 parents 13ccad1 + f8e7b8e commit aea457a

20 files changed

+152
-98
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ci:
44

55
repos:
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v4.5.0
7+
rev: v5.0.0
88
hooks:
99
- id: check-case-conflict
1010
- id: check-ast
@@ -22,12 +22,12 @@ repos:
2222
- id: trailing-whitespace
2323

2424
- repo: https://github.com/python-jsonschema/check-jsonschema
25-
rev: 0.27.4
25+
rev: 0.31.1
2626
hooks:
2727
- id: check-github-workflows
2828

2929
- repo: https://github.com/executablebooks/mdformat
30-
rev: 0.7.17
30+
rev: 0.7.22
3131
hooks:
3232
- id: mdformat
3333
additional_dependencies:
@@ -55,13 +55,13 @@ repos:
5555
]
5656

5757
- repo: https://github.com/adamchainz/blacken-docs
58-
rev: "1.16.0"
58+
rev: "1.19.1"
5959
hooks:
6060
- id: blacken-docs
6161
additional_dependencies: [black==23.7.0]
6262

6363
- repo: https://github.com/codespell-project/codespell
64-
rev: "v2.2.6"
64+
rev: "v2.4.1"
6565
hooks:
6666
- id: codespell
6767
args: ["-L", "sur,nd"]

CHANGELOG.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959

6060
### Maintenance and upkeep improvements
6161

62-
- \[6.x\] Update Release Scripts [#1251](https://github.com/ipython/ipykernel/pull/1251) ([@blink1073](https://github.com/blink1073))
62+
- [6.x] Update Release Scripts [#1251](https://github.com/ipython/ipykernel/pull/1251) ([@blink1073](https://github.com/blink1073))
6363

6464
### Contributors to this release
6565

@@ -118,7 +118,7 @@
118118

119119
### Bugs fixed
120120

121-
- Fix: ipykernel_launcher, delete absolute sys.path\[0\] [#1206](https://github.com/ipython/ipykernel/pull/1206) ([@stdll00](https://github.com/stdll00))
121+
- Fix: ipykernel_launcher, delete absolute sys.path[0] [#1206](https://github.com/ipython/ipykernel/pull/1206) ([@stdll00](https://github.com/stdll00))
122122

123123
### Maintenance and upkeep improvements
124124

@@ -386,7 +386,7 @@
386386

387387
### Enhancements made
388388

389-
- Support control\<>iopub messages to e.g. unblock comm_msg from command execution [#1114](https://github.com/ipython/ipykernel/pull/1114) ([@tkrabel-db](https://github.com/tkrabel-db))
389+
- Support control\<>iopub messages to e.g. unblock comm_msg from command execution [#1114](https://github.com/ipython/ipykernel/pull/1114) ([@tkrabel-db](https://github.com/tkrabel-db))
390390
- Add outstream hook similar to display publisher [#1110](https://github.com/ipython/ipykernel/pull/1110) ([@maartenbreddels](https://github.com/maartenbreddels))
391391

392392
### Maintenance and upkeep improvements
@@ -796,10 +796,10 @@
796796

797797
### Maintenance and upkeep improvements
798798

799-
- \[pre-commit.ci\] pre-commit autoupdate [#989](https://github.com/ipython/ipykernel/pull/989) ([@pre-commit-ci](https://github.com/pre-commit-ci))
800-
- \[pre-commit.ci\] pre-commit autoupdate [#985](https://github.com/ipython/ipykernel/pull/985) ([@pre-commit-ci](https://github.com/pre-commit-ci))
799+
- [pre-commit.ci] pre-commit autoupdate [#989](https://github.com/ipython/ipykernel/pull/989) ([@pre-commit-ci](https://github.com/pre-commit-ci))
800+
- [pre-commit.ci] pre-commit autoupdate [#985](https://github.com/ipython/ipykernel/pull/985) ([@pre-commit-ci](https://github.com/pre-commit-ci))
801801
- Add python logo in svg format [#984](https://github.com/ipython/ipykernel/pull/984) ([@steff456](https://github.com/steff456))
802-
- \[pre-commit.ci\] pre-commit autoupdate [#982](https://github.com/ipython/ipykernel/pull/982) ([@pre-commit-ci](https://github.com/pre-commit-ci))
802+
- [pre-commit.ci] pre-commit autoupdate [#982](https://github.com/ipython/ipykernel/pull/982) ([@pre-commit-ci](https://github.com/pre-commit-ci))
803803

804804
### Contributors to this release
805805

@@ -817,13 +817,13 @@
817817

818818
### Maintenance and upkeep improvements
819819

820-
- \[pre-commit.ci\] pre-commit autoupdate [#978](https://github.com/ipython/ipykernel/pull/978) ([@pre-commit-ci](https://github.com/pre-commit-ci))
821-
- \[pre-commit.ci\] pre-commit autoupdate [#977](https://github.com/ipython/ipykernel/pull/977) ([@pre-commit-ci](https://github.com/pre-commit-ci))
822-
- \[pre-commit.ci\] pre-commit autoupdate [#976](https://github.com/ipython/ipykernel/pull/976) ([@pre-commit-ci](https://github.com/pre-commit-ci))
823-
- \[pre-commit.ci\] pre-commit autoupdate [#974](https://github.com/ipython/ipykernel/pull/974) ([@pre-commit-ci](https://github.com/pre-commit-ci))
824-
- \[pre-commit.ci\] pre-commit autoupdate [#971](https://github.com/ipython/ipykernel/pull/971) ([@pre-commit-ci](https://github.com/pre-commit-ci))
825-
- \[pre-commit.ci\] pre-commit autoupdate [#968](https://github.com/ipython/ipykernel/pull/968) ([@pre-commit-ci](https://github.com/pre-commit-ci))
826-
- \[pre-commit.ci\] pre-commit autoupdate [#966](https://github.com/ipython/ipykernel/pull/966) ([@pre-commit-ci](https://github.com/pre-commit-ci))
820+
- [pre-commit.ci] pre-commit autoupdate [#978](https://github.com/ipython/ipykernel/pull/978) ([@pre-commit-ci](https://github.com/pre-commit-ci))
821+
- [pre-commit.ci] pre-commit autoupdate [#977](https://github.com/ipython/ipykernel/pull/977) ([@pre-commit-ci](https://github.com/pre-commit-ci))
822+
- [pre-commit.ci] pre-commit autoupdate [#976](https://github.com/ipython/ipykernel/pull/976) ([@pre-commit-ci](https://github.com/pre-commit-ci))
823+
- [pre-commit.ci] pre-commit autoupdate [#974](https://github.com/ipython/ipykernel/pull/974) ([@pre-commit-ci](https://github.com/pre-commit-ci))
824+
- [pre-commit.ci] pre-commit autoupdate [#971](https://github.com/ipython/ipykernel/pull/971) ([@pre-commit-ci](https://github.com/pre-commit-ci))
825+
- [pre-commit.ci] pre-commit autoupdate [#968](https://github.com/ipython/ipykernel/pull/968) ([@pre-commit-ci](https://github.com/pre-commit-ci))
826+
- [pre-commit.ci] pre-commit autoupdate [#966](https://github.com/ipython/ipykernel/pull/966) ([@pre-commit-ci](https://github.com/pre-commit-ci))
827827

828828
### Contributors to this release
829829

@@ -841,9 +841,9 @@
841841

842842
### Maintenance and upkeep improvements
843843

844-
- \[pre-commit.ci\] pre-commit autoupdate [#962](https://github.com/ipython/ipykernel/pull/962) ([@pre-commit-ci](https://github.com/pre-commit-ci))
845-
- \[pre-commit.ci\] pre-commit autoupdate [#961](https://github.com/ipython/ipykernel/pull/961) ([@pre-commit-ci](https://github.com/pre-commit-ci))
846-
- \[pre-commit.ci\] pre-commit autoupdate [#960](https://github.com/ipython/ipykernel/pull/960) ([@pre-commit-ci](https://github.com/pre-commit-ci))
844+
- [pre-commit.ci] pre-commit autoupdate [#962](https://github.com/ipython/ipykernel/pull/962) ([@pre-commit-ci](https://github.com/pre-commit-ci))
845+
- [pre-commit.ci] pre-commit autoupdate [#961](https://github.com/ipython/ipykernel/pull/961) ([@pre-commit-ci](https://github.com/pre-commit-ci))
846+
- [pre-commit.ci] pre-commit autoupdate [#960](https://github.com/ipython/ipykernel/pull/960) ([@pre-commit-ci](https://github.com/pre-commit-ci))
847847

848848
### Contributors to this release
849849

@@ -863,7 +863,7 @@
863863

864864
- Back to top-level tornado IOLoop [#958](https://github.com/ipython/ipykernel/pull/958) ([@minrk](https://github.com/minrk))
865865
- Explicitly require pyzmq >= 17 [#957](https://github.com/ipython/ipykernel/pull/957) ([@minrk](https://github.com/minrk))
866-
- \[pre-commit.ci\] pre-commit autoupdate [#954](https://github.com/ipython/ipykernel/pull/954) ([@pre-commit-ci](https://github.com/pre-commit-ci))
866+
- [pre-commit.ci] pre-commit autoupdate [#954](https://github.com/ipython/ipykernel/pull/954) ([@pre-commit-ci](https://github.com/pre-commit-ci))
867867

868868
### Contributors to this release
869869

@@ -887,7 +887,7 @@
887887
### Maintenance and upkeep improvements
888888

889889
- Fix sphinx 5.0 support [#951](https://github.com/ipython/ipykernel/pull/951) ([@blink1073](https://github.com/blink1073))
890-
- \[pre-commit.ci\] pre-commit autoupdate [#950](https://github.com/ipython/ipykernel/pull/950) ([@pre-commit-ci](https://github.com/pre-commit-ci))
890+
- [pre-commit.ci] pre-commit autoupdate [#950](https://github.com/ipython/ipykernel/pull/950) ([@pre-commit-ci](https://github.com/pre-commit-ci))
891891

892892
### Contributors to this release
893893

@@ -906,18 +906,18 @@
906906

907907
### Maintenance and upkeep improvements
908908

909-
- \[pre-commit.ci\] pre-commit autoupdate [#945](https://github.com/ipython/ipykernel/pull/945) ([@pre-commit-ci](https://github.com/pre-commit-ci))
909+
- [pre-commit.ci] pre-commit autoupdate [#945](https://github.com/ipython/ipykernel/pull/945) ([@pre-commit-ci](https://github.com/pre-commit-ci))
910910
- Clean up typings [#939](https://github.com/ipython/ipykernel/pull/939) ([@blink1073](https://github.com/blink1073))
911-
- \[pre-commit.ci\] pre-commit autoupdate [#938](https://github.com/ipython/ipykernel/pull/938) ([@pre-commit-ci](https://github.com/pre-commit-ci))
911+
- [pre-commit.ci] pre-commit autoupdate [#938](https://github.com/ipython/ipykernel/pull/938) ([@pre-commit-ci](https://github.com/pre-commit-ci))
912912
- Clean up types [#933](https://github.com/ipython/ipykernel/pull/933) ([@blink1073](https://github.com/blink1073))
913-
- \[pre-commit.ci\] pre-commit autoupdate [#932](https://github.com/ipython/ipykernel/pull/932) ([@pre-commit-ci](https://github.com/pre-commit-ci))
913+
- [pre-commit.ci] pre-commit autoupdate [#932](https://github.com/ipython/ipykernel/pull/932) ([@pre-commit-ci](https://github.com/pre-commit-ci))
914914
- Switch to hatch backend [#931](https://github.com/ipython/ipykernel/pull/931) ([@blink1073](https://github.com/blink1073))
915-
- \[pre-commit.ci\] pre-commit autoupdate [#928](https://github.com/ipython/ipykernel/pull/928) ([@pre-commit-ci](https://github.com/pre-commit-ci))
916-
- \[pre-commit.ci\] pre-commit autoupdate [#926](https://github.com/ipython/ipykernel/pull/926) ([@pre-commit-ci](https://github.com/pre-commit-ci))
915+
- [pre-commit.ci] pre-commit autoupdate [#928](https://github.com/ipython/ipykernel/pull/928) ([@pre-commit-ci](https://github.com/pre-commit-ci))
916+
- [pre-commit.ci] pre-commit autoupdate [#926](https://github.com/ipython/ipykernel/pull/926) ([@pre-commit-ci](https://github.com/pre-commit-ci))
917917
- Allow enforce PR label workflow to add labels [#921](https://github.com/ipython/ipykernel/pull/921) ([@blink1073](https://github.com/blink1073))
918-
- \[pre-commit.ci\] pre-commit autoupdate [#920](https://github.com/ipython/ipykernel/pull/920) ([@pre-commit-ci](https://github.com/pre-commit-ci))
919-
- \[pre-commit.ci\] pre-commit autoupdate [#919](https://github.com/ipython/ipykernel/pull/919) ([@pre-commit-ci](https://github.com/pre-commit-ci))
920-
- \[pre-commit.ci\] pre-commit autoupdate [#917](https://github.com/ipython/ipykernel/pull/917) ([@pre-commit-ci](https://github.com/pre-commit-ci))
918+
- [pre-commit.ci] pre-commit autoupdate [#920](https://github.com/ipython/ipykernel/pull/920) ([@pre-commit-ci](https://github.com/pre-commit-ci))
919+
- [pre-commit.ci] pre-commit autoupdate [#919](https://github.com/ipython/ipykernel/pull/919) ([@pre-commit-ci](https://github.com/pre-commit-ci))
920+
- [pre-commit.ci] pre-commit autoupdate [#917](https://github.com/ipython/ipykernel/pull/917) ([@pre-commit-ci](https://github.com/pre-commit-ci))
921921

922922
### Contributors to this release
923923

@@ -942,7 +942,7 @@
942942
- Add basic mypy support [#913](https://github.com/ipython/ipykernel/pull/913) ([@blink1073](https://github.com/blink1073))
943943
- Clean up pre-commit [#911](https://github.com/ipython/ipykernel/pull/911) ([@blink1073](https://github.com/blink1073))
944944
- Update setup.py [#909](https://github.com/ipython/ipykernel/pull/909) ([@tlinhart](https://github.com/tlinhart))
945-
- \[pre-commit.ci\] pre-commit autoupdate [#906](https://github.com/ipython/ipykernel/pull/906) ([@pre-commit-ci](https://github.com/pre-commit-ci))
945+
- [pre-commit.ci] pre-commit autoupdate [#906](https://github.com/ipython/ipykernel/pull/906) ([@pre-commit-ci](https://github.com/pre-commit-ci))
946946

947947
### Contributors to this release
948948

@@ -1360,7 +1360,7 @@
13601360

13611361
- Add watchfd keyword to InProcessKernel OutStream initialization [#727](https://github.com/ipython/ipykernel/pull/727) ([@rayosborn](https://github.com/rayosborn))
13621362
- Fix typo in eventloops.py [#711](https://github.com/ipython/ipykernel/pull/711) ([@selasley](https://github.com/selasley))
1363-
- \[bugfix\] fix in setup.py (comma before appnope) [#709](https://github.com/ipython/ipykernel/pull/709) ([@jstriebel](https://github.com/jstriebel))
1363+
- [bugfix] fix in setup.py (comma before appnope) [#709](https://github.com/ipython/ipykernel/pull/709) ([@jstriebel](https://github.com/jstriebel))
13641364

13651365
### Maintenance and upkeep improvements
13661366

ipykernel/_version.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""
22
store the current version info of the server.
33
"""
4+
from __future__ import annotations
5+
46
import re
57

68
# Version string must appear intact for hatch versioning

ipykernel/connect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ def connect_qtconsole(
133133

134134

135135
__all__ = [
136-
"write_connection_file",
136+
"connect_qtconsole",
137137
"get_connection_file",
138138
"get_connection_info",
139-
"connect_qtconsole",
139+
"write_connection_file",
140140
]

ipykernel/embed.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,4 @@ def embed_kernel(module=None, local_ns=None, **kwargs):
5555
app.kernel.user_ns = local_ns
5656
app.shell.set_completer_frame() # type:ignore[union-attr]
5757
app.start()
58+
app.close()

ipykernel/inprocess/channels.py

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

33
# Copyright (c) IPython Development Team.
44
# Distributed under the terms of the Modified BSD License.
5+
from __future__ import annotations
56

67
from jupyter_client.channelsabc import HBChannelABC
78

ipykernel/iostream.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,8 @@ def fileno(self):
398398
"""
399399
Things like subprocess will peak and write to the fileno() of stderr/stdout.
400400
"""
401-
if getattr(self, "_original_stdstream_copy", None) is not None:
402-
return self._original_stdstream_copy
401+
if getattr(self, "_original_stdstream_fd", None) is not None:
402+
return self._original_stdstream_fd
403403
msg = "fileno"
404404
raise io.UnsupportedOperation(msg)
405405

@@ -501,11 +501,13 @@ def __init__(
501501
self._local = local()
502502

503503
if (
504-
watchfd
505-
and (
506-
(sys.platform.startswith("linux") or sys.platform.startswith("darwin"))
507-
# Pytest set its own capture. Don't redirect from within pytest.
508-
and ("PYTEST_CURRENT_TEST" not in os.environ)
504+
(
505+
watchfd
506+
and (
507+
(sys.platform.startswith("linux") or sys.platform.startswith("darwin"))
508+
# Pytest set its own capture. Don't redirect from within pytest.
509+
and ("PYTEST_CURRENT_TEST" not in os.environ)
510+
)
509511
)
510512
# allow forcing watchfd (mainly for tests)
511513
or watchfd == "force"
@@ -527,10 +529,7 @@ def __init__(
527529
# echo on the _copy_ we made during
528530
# this is the actual terminal FD now
529531
echo = io.TextIOWrapper(
530-
io.FileIO(
531-
self._original_stdstream_copy,
532-
"w",
533-
)
532+
io.FileIO(self._original_stdstream_copy, "w", closefd=False)
534533
)
535534
self.echo = echo
536535
else:
@@ -595,9 +594,10 @@ def close(self):
595594
self._should_watch = False
596595
# thread won't wake unless there's something to read
597596
# writing something after _should_watch will not be echoed
598-
os.write(self._original_stdstream_fd, b"\0")
599-
if self.watch_fd_thread is not None:
597+
if self.watch_fd_thread is not None and self.watch_fd_thread.is_alive():
598+
os.write(self._original_stdstream_fd, b"\0")
600599
self.watch_fd_thread.join()
600+
self.echo = None
601601
# restore original FDs
602602
os.dup2(self._original_stdstream_copy, self._original_stdstream_fd)
603603
os.close(self._original_stdstream_copy)

0 commit comments

Comments
 (0)