Skip to content

Commit 501a1ad

Browse files
ianthomas23gregory-shkloverblussCarreauminrk
authored
Backports from anyio (old main) branch to main branch (#1402)
Co-authored-by: Gregory Shklover <[email protected]> Co-authored-by: bluss <[email protected]> Co-authored-by: M Bussonnier <[email protected]> Co-authored-by: Min RK <[email protected]> Co-authored-by: David Brochart <[email protected]> Co-authored-by: Stephen Macke <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 7b89b87 commit 501a1ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+375
-1190
lines changed

.github/workflows/downstream.yml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
uses: jupyterlab/maintainer-tools/.github/actions/downstream-test@v1
3939
with:
4040
package_name: ipywidgets
41-
test_command: pytest -vv -raXxs -k \"not deprecation_fa_icons and not tooltip_deprecation and not on_submit_deprecation\" -W default --durations 10 --color=yes
41+
test_command: pytest -vv -raXxs -W default --durations 10 --color=yes
4242

4343
jupyter_client:
4444
runs-on: ubuntu-latest
@@ -56,6 +56,7 @@ jobs:
5656

5757
ipyparallel:
5858
runs-on: ubuntu-latest
59+
timeout-minutes: 20
5960
steps:
6061
- name: Checkout
6162
uses: actions/checkout@v4
@@ -147,20 +148,3 @@ jobs:
147148
run: |
148149
cd ${GITHUB_WORKSPACE}/../spyder-kernels
149150
xvfb-run --auto-servernum ${pythonLocation}/bin/python -m pytest -x -vv -s --full-trace --color=yes spyder_kernels
150-
151-
downstream_check: # This job does nothing and is only used for the branch protection
152-
if: always()
153-
needs:
154-
- nbclient
155-
- ipywidgets
156-
- jupyter_client
157-
- ipyparallel
158-
- jupyter_kernel_test
159-
- spyder_kernels
160-
- qtconsole
161-
runs-on: ubuntu-latest
162-
steps:
163-
- name: Decide whether the needed jobs succeeded or failed
164-
uses: re-actors/alls-green@release/v1
165-
with:
166-
jobs: ${{ toJSON(needs) }}

.github/workflows/nightly.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: nightly build and upload
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: "0 0 * * *"
6+
7+
defaults:
8+
run:
9+
shell: bash -eux {0}
10+
11+
jobs:
12+
build:
13+
runs-on: "ubuntu-latest"
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
python-version: ["3.12"]
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Base Setup
23+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
24+
25+
- name: Build
26+
run: |
27+
python -m pip install build
28+
python -m build
29+
- name: Upload wheel
30+
uses: scientific-python/upload-nightly-action@82396a2ed4269ba06c6b2988bb4fd568ef3c3d6b # 0.6.1
31+
with:
32+
artifacts_path: dist
33+
anaconda_nightly_upload_token: ${{secrets.UPLOAD_TOKEN}}

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ci:
2-
autoupdate_schedule: monthly
32
autoupdate_commit_msg: "chore: update pre-commit hooks"
3+
autoupdate_schedule: weekly
44

55
repos:
66
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -40,7 +40,7 @@ repos:
4040
types_or: [yaml, html, json]
4141

4242
- repo: https://github.com/pre-commit/mirrors-mypy
43-
rev: "v1.8.0"
43+
rev: "v1.16.1"
4444
hooks:
4545
- id: mypy
4646
files: ipykernel
@@ -74,7 +74,7 @@ repos:
7474
- id: rst-inline-touching-normal
7575

7676
- repo: https://github.com/astral-sh/ruff-pre-commit
77-
rev: v0.2.0
77+
rev: v0.11.4
7878
hooks:
7979
- id: ruff
8080
types_or: [python, jupyter]

examples/embedding/inprocess_qtconsole.py

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,25 @@
11
"""An in-process qt console app."""
2+
23
import os
3-
import sys
44

55
import tornado
66
from IPython.lib import guisupport
77
from qtconsole.inprocess import QtInProcessKernelManager
88
from qtconsole.rich_ipython_widget import RichIPythonWidget
99

10+
assert tornado.version_info >= (6, 1)
11+
1012

1113
def print_process_id():
1214
"""Print the process id."""
1315
print("Process ID is:", os.getpid())
1416

1517

16-
def init_asyncio_patch():
17-
"""set default asyncio policy to be compatible with tornado
18-
Tornado 6 (at least) is not compatible with the default
19-
asyncio implementation on Windows
20-
Pick the older SelectorEventLoopPolicy on Windows
21-
if the known-incompatible default policy is in use.
22-
do this as early as possible to make it a low priority and overridable
23-
ref: https://github.com/tornadoweb/tornado/issues/2608
24-
FIXME: if/when tornado supports the defaults in asyncio,
25-
remove and bump tornado requirement for py38
26-
"""
27-
if (
28-
sys.platform.startswith("win")
29-
and sys.version_info >= (3, 8)
30-
and tornado.version_info < (6, 1)
31-
):
32-
import asyncio
33-
34-
try:
35-
from asyncio import WindowsProactorEventLoopPolicy, WindowsSelectorEventLoopPolicy
36-
except ImportError:
37-
pass
38-
# not affected
39-
else:
40-
if type(asyncio.get_event_loop_policy()) is WindowsProactorEventLoopPolicy:
41-
# WindowsProactorEventLoopPolicy is not compatible with tornado 6
42-
# fallback to the pre-3.8 default of Selector
43-
asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())
44-
45-
4618
def main():
4719
"""The main entry point."""
4820
# Print the ID of the main process
4921
print_process_id()
5022

51-
init_asyncio_patch()
5223
app = guisupport.get_app_qt4()
5324

5425
# Create an in-process kernel

examples/embedding/inprocess_terminal.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""An in-process terminal example."""
2+
23
import os
34
import sys
45

examples/embedding/ipkernel_wxapp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
1717
Ref: Modified from wxPython source code wxPython/samples/simple/simple.py
1818
"""
19+
1920
# -----------------------------------------------------------------------------
2021
# Imports
2122
# -----------------------------------------------------------------------------

hatch_build.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""A custom hatch build hook for ipykernel."""
2+
23
import shutil
34
import sys
45
from pathlib import Path

ipykernel/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""The cli entry point for ipykernel."""
2+
23
if __name__ == "__main__":
34
from ipykernel import kernelapp as app
45

ipykernel/_version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
store the current version info of the server.
33
"""
4+
45
import re
56

67
# Version string must appear intact for hatch versioning

ipykernel/comm/comm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def publish_msg(self, msg_type, data=None, metadata=None, buffers=None, **keys):
4949
class Comm(BaseComm, traitlets.config.LoggingConfigurable):
5050
"""Class for communicating between a Frontend and a Kernel"""
5151

52-
kernel = Instance("ipykernel.kernelbase.Kernel", allow_none=True) # type:ignore[assignment]
52+
kernel = Instance("ipykernel.kernelbase.Kernel", allow_none=True)
5353
comm_id = Unicode()
5454
primary = Bool(True, help="Am I the primary or secondary Comm?")
5555

0 commit comments

Comments
 (0)