Skip to content

Commit b450496

Browse files
authored
Merge pull request #750 from blink1073/dependency-handling
2 parents 10decd2 + afbbf28 commit b450496

17 files changed

+95
-56
lines changed

.github/workflows/check-release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ on:
33
push:
44
branches: ["main"]
55
pull_request:
6-
branches: ["*"]
76

87
concurrency:
98
group: check-release-${{ github.ref }}

.github/workflows/downstream.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ name: Test downstream projects
22

33
on:
44
push:
5-
branches: "*"
5+
branches: ["main"]
66
pull_request:
7-
branches: "*"
87

98
concurrency:
109
group: downstream-${{ github.ref }}

.github/workflows/main.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: CI
22

33
on:
44
push:
5+
branches: ["main"]
56
pull_request:
67

78
concurrency:
@@ -51,7 +52,7 @@ jobs:
5152
fail-fast: false
5253
matrix:
5354
os: [ubuntu-latest, macos-latest, windows-latest]
54-
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
55+
python-version: [3.7, 3.8, 3.9, "3.10"]
5556

5657
env:
5758
OS: ${{ matrix.os }}
@@ -65,7 +66,7 @@ jobs:
6566

6667
- name: Install dependencies
6768
run: |
68-
pip install --upgrade --upgrade-strategy eager --pre -e .[test]
69+
pip install -e .[test]
6970
pip freeze
7071
7172
- name: Check types
@@ -82,3 +83,36 @@ jobs:
8283
8384
- name: Code coverage
8485
run: codecov
86+
87+
test_miniumum_verisons:
88+
name: Test Minimum Versions
89+
runs-on: ubuntu-latest
90+
steps:
91+
- uses: actions/checkout@v2
92+
- name: Base Setup
93+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
94+
with:
95+
python_version: "3.7"
96+
- name: Install miniumum versions
97+
uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1
98+
- name: Run the unit tests
99+
run: pytest -vv jupyter_client || pytest -vv jupyter_client --lf
100+
101+
test_prereleases:
102+
name: Test Prereleases
103+
runs-on: ubuntu-latest
104+
steps:
105+
- name: Checkout
106+
uses: actions/checkout@v2
107+
- name: Base Setup
108+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
109+
- name: Install the Python dependencies
110+
run: |
111+
pip install --upgrade --upgrade-strategy eager --pre -e ".[test]"
112+
- name: List installed packages
113+
run: |
114+
pip freeze
115+
pip check
116+
- name: Run the tests
117+
run: |
118+
pytest -vv jupyter_client || pytest -vv jupyter_client --lf

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
repos:
22
- repo: https://github.com/asottile/reorder_python_imports
3-
rev: v1.9.0
3+
rev: v2.7.1
44
hooks:
55
- id: reorder-python-imports
66
- repo: https://github.com/psf/black
7-
rev: 20.8b1
7+
rev: 22.1.0
88
hooks:
99
- id: black
1010
args: ["--line-length", "100"]
1111
- repo: https://github.com/pre-commit/mirrors-prettier
12-
rev: v2.2.1
12+
rev: v2.5.1
1313
hooks:
1414
- id: prettier
1515
- repo: https://gitlab.com/pycqa/flake8
16-
rev: "3.8.4"
16+
rev: "3.9.2"
1717
hooks:
1818
- id: flake8
1919
- repo: https://github.com/pre-commit/pre-commit-hooks
20-
rev: v3.4.0
20+
rev: v4.1.0
2121
hooks:
2222
- id: end-of-file-fixer
2323
- id: check-case-conflict

jupyter_client/channels.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ async def _recv(self, **kwargs) -> t.Dict[str, t.Any]:
217217
return self.session.deserialize(smsg)
218218

219219
async def get_msg(self, timeout: t.Optional[float] = None) -> t.Dict[str, t.Any]:
220-
""" Gets a message if there is one that is ready. """
220+
"""Gets a message if there is one that is ready."""
221221
assert self.socket is not None
222222
if timeout is not None:
223223
timeout *= 1000 # seconds to ms
@@ -230,7 +230,7 @@ async def get_msg(self, timeout: t.Optional[float] = None) -> t.Dict[str, t.Any]
230230
raise Empty
231231

232232
async def get_msgs(self) -> t.List[t.Dict[str, t.Any]]:
233-
""" Get all messages that are currently ready. """
233+
"""Get all messages that are currently ready."""
234234
msgs = []
235235
while True:
236236
try:
@@ -240,7 +240,7 @@ async def get_msgs(self) -> t.List[t.Dict[str, t.Any]]:
240240
return msgs
241241

242242
async def msg_ready(self) -> bool:
243-
""" Is there a message that has been received? """
243+
"""Is there a message that has been received?"""
244244
assert self.socket is not None
245245
return bool(await self.socket.poll(timeout=0))
246246

jupyter_client/session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ def _new_auth(self) -> None:
465465

466466
digest_history = Set()
467467
digest_history_size = Integer(
468-
2 ** 16,
468+
2**16,
469469
config=True,
470470
help="""The maximum number of digests to remember.
471471
@@ -504,7 +504,7 @@ def _unpack_changed(self, change):
504504

505505
# thresholds:
506506
copy_threshold = Integer(
507-
2 ** 16,
507+
2**16,
508508
config=True,
509509
help="Threshold (in bytes) beyond which a buffer should be sent without copying.",
510510
)

jupyter_client/ssh/tunnel.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
class SSHException(Exception): # type: ignore
2929
pass
3030

31-
3231
else:
3332
from .forward import forward_tunnel
3433

jupyter_client/tests/test_connect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def test_write_connection_file():
8484

8585

8686
def test_load_connection_file_session():
87-
"""test load_connection_file() after """
87+
"""test load_connection_file() after"""
8888
session = Session()
8989
app = DummyConsoleApp(session=Session())
9090
app.initialize(argv=[])
@@ -101,7 +101,7 @@ def test_load_connection_file_session():
101101

102102

103103
def test_load_connection_file_session_with_kn():
104-
"""test load_connection_file() after """
104+
"""test load_connection_file() after"""
105105
session = Session()
106106
app = DummyConsoleApp(session=Session())
107107
app.initialize(argv=[])

jupyter_client/tests/test_kernelmanager.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,17 @@ def test_signal_kernel_subprocesses(self, name, install, expected):
164164
kc.stop_channels()
165165
km.shutdown_kernel()
166166

167-
assert km._shutdown_status == expected
167+
if expected == _ShutdownStatus.ShutdownRequest:
168+
expected = [expected, _ShutdownStatus.SigtermRequest]
169+
else:
170+
expected = [expected]
171+
172+
assert km._shutdown_status in expected
168173

169174
@pytest.mark.asyncio
170175
@pytest.mark.skipif(sys.platform == "win32", reason="Windows doesn't support signals")
171176
@pytest.mark.parametrize(*parameters)
172177
async def test_async_signal_kernel_subprocesses(self, name, install, expected):
173-
# ipykernel doesn't support 3.6 and this test uses async shutdown_request
174-
if expected == _ShutdownStatus.ShutdownRequest and sys.version_info < (3, 7):
175-
pytest.skip()
176178
install()
177179
km, kc = await start_new_async_kernel(kernel_name=name)
178180
assert km._shutdown_status == _ShutdownStatus.Unset
@@ -181,7 +183,12 @@ async def test_async_signal_kernel_subprocesses(self, name, install, expected):
181183
kc.stop_channels()
182184
await km.shutdown_kernel()
183185

184-
assert km._shutdown_status == expected
186+
if expected == _ShutdownStatus.ShutdownRequest:
187+
expected = [expected, _ShutdownStatus.SigtermRequest]
188+
else:
189+
expected = [expected]
190+
191+
assert km._shutdown_status in expected
185192

186193

187194
class TestKernelManager:

jupyter_client/tests/test_manager.py

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

1111

1212
def test_connection_file_real_path():
13-
""" Verify realpath is used when formatting connection file """
13+
"""Verify realpath is used when formatting connection file"""
1414
with mock.patch("os.path.realpath") as patched_realpath:
1515
patched_realpath.return_value = "foobar"
1616
km = KernelManager(

0 commit comments

Comments
 (0)