From cc3bccf865042d73530905922db85ff7d1534053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=BCbner?= <66410120+juhuebner@users.noreply.github.com> Date: Sun, 7 Mar 2021 12:32:41 +0100 Subject: [PATCH 01/13] _in_clude windows for python 3.8 --- .github/workflows/main.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7dd104af..8a6e9a3b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,8 +16,6 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] python-version: [ 3.6, 3.7, 3.8, 3.9 ] exclude: - - os: windows-latest - python-version: 3.8 - os: windows-latest python-version: 3.9 env: From fde60d1b81093caf5cc074145856bfe8a9fce21b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=BCbner?= <66410120+juhuebner@users.noreply.github.com> Date: Sun, 7 Mar 2021 13:29:08 +0100 Subject: [PATCH 02/13] set_event_loop_policy for windows # patch c.f. https://github.com/tornadoweb/tornado/issues/2608#issuecomment-491489432 asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # python-3.8.x --- nbclient/client.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nbclient/client.py b/nbclient/client.py index 40ec273b..53de1f09 100644 --- a/nbclient/client.py +++ b/nbclient/client.py @@ -32,6 +32,10 @@ from .output_widget import OutputWidget +# patch c.f. https://github.com/tornadoweb/tornado/issues/2608#issuecomment-491489432 +asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # python-3.8.x + + def timestamp() -> str: return datetime.datetime.utcnow().isoformat() + 'Z' From 804b5841ba070f7d7edce800207d900b84c07067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=BCbner?= <66410120+juhuebner@users.noreply.github.com> Date: Sun, 7 Mar 2021 13:33:00 +0100 Subject: [PATCH 03/13] check os.name --- nbclient/client.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nbclient/client.py b/nbclient/client.py index 53de1f09..1026cc09 100644 --- a/nbclient/client.py +++ b/nbclient/client.py @@ -1,3 +1,4 @@ +from os import name as os_name import atexit import collections import datetime @@ -32,8 +33,9 @@ from .output_widget import OutputWidget -# patch c.f. https://github.com/tornadoweb/tornado/issues/2608#issuecomment-491489432 -asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # python-3.8.x +if os_name = "nt": + # patch c.f. https://github.com/tornadoweb/tornado/issues/2608#issuecomment-491489432 + asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # python-3.8.x def timestamp() -> str: From e1ffac31399f3ecd97186cc569fd11fd95f2d159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=BCbner?= <66410120+juhuebner@users.noreply.github.com> Date: Sun, 7 Mar 2021 13:38:58 +0100 Subject: [PATCH 04/13] typo --- nbclient/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nbclient/client.py b/nbclient/client.py index 1026cc09..41a8e458 100644 --- a/nbclient/client.py +++ b/nbclient/client.py @@ -33,7 +33,7 @@ from .output_widget import OutputWidget -if os_name = "nt": +if os_name == "nt": # patch c.f. https://github.com/tornadoweb/tornado/issues/2608#issuecomment-491489432 asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # python-3.8.x From f6defdd7ec84463cfcfe601a724f84c574e767ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=BCbner?= <66410120+juhuebner@users.noreply.github.com> Date: Sun, 7 Mar 2021 13:55:00 +0100 Subject: [PATCH 05/13] added version selection and type ignore the type ignore should be made os dependent --- nbclient/client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nbclient/client.py b/nbclient/client.py index 41a8e458..3f666a97 100644 --- a/nbclient/client.py +++ b/nbclient/client.py @@ -1,4 +1,5 @@ from os import name as os_name +from sys import version_info import atexit import collections import datetime @@ -33,7 +34,7 @@ from .output_widget import OutputWidget -if os_name == "nt": +if os_name == "nt" and version_info.major == 3 and version_info.minor >= 8: # type: ignore # patch c.f. https://github.com/tornadoweb/tornado/issues/2608#issuecomment-491489432 asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # python-3.8.x From b3ee4d158fdfd1ff43d3384106fc498f9c0f16e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=BCbner?= <66410120+juhuebner@users.noreply.github.com> Date: Sun, 7 Mar 2021 14:03:15 +0100 Subject: [PATCH 06/13] included windows python 3.9 --- .github/workflows/main.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8a6e9a3b..d7f3ea35 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,9 +15,6 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] python-version: [ 3.6, 3.7, 3.8, 3.9 ] - exclude: - - os: windows-latest - python-version: 3.9 env: OS: ${{ matrix.os }} PYTHON: '3.9' From 8f59fb2edaa5ac81667a665ea294ca955403094f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=BCbner?= <66410120+juhuebner@users.noreply.github.com> Date: Sun, 7 Mar 2021 14:10:34 +0100 Subject: [PATCH 07/13] altered type ignore --- nbclient/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nbclient/client.py b/nbclient/client.py index 3f666a97..adce4ef3 100644 --- a/nbclient/client.py +++ b/nbclient/client.py @@ -34,9 +34,9 @@ from .output_widget import OutputWidget -if os_name == "nt" and version_info.major == 3 and version_info.minor >= 8: # type: ignore +if os_name == "nt" and version_info.major == 3 and version_info.minor >= 8: # patch c.f. https://github.com/tornadoweb/tornado/issues/2608#issuecomment-491489432 - asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # python-3.8.x + asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # type: ignore def timestamp() -> str: From d6167a7f8a40f85eef03a28f45fce32274f68ada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=BCbner?= <66410120+juhuebner@users.noreply.github.com> Date: Sun, 7 Mar 2021 14:26:05 +0100 Subject: [PATCH 08/13] added type ignore for version_info < (3, 7) --- nbclient/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nbclient/__init__.py b/nbclient/__init__.py index 6110e8f6..63bfe39e 100644 --- a/nbclient/__init__.py +++ b/nbclient/__init__.py @@ -13,5 +13,5 @@ def _cleanup() -> None: # the fix for python3.7: https://github.com/python/cpython/pull/15706/files if sys.platform == 'win32': if sys.version_info < (3, 7): - subprocess._cleanup = _cleanup - subprocess._active = None + subprocess._cleanup = _cleanup # type: ignore + subprocess._active = None # type:ignore From cbc5875e807ae23bb5ef2ab50ed28762387a9cb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=BCbner?= <66410120+juhuebner@users.noreply.github.com> Date: Sun, 7 Mar 2021 14:27:20 +0100 Subject: [PATCH 09/13] linting --- nbclient/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nbclient/client.py b/nbclient/client.py index adce4ef3..489af147 100644 --- a/nbclient/client.py +++ b/nbclient/client.py @@ -34,7 +34,7 @@ from .output_widget import OutputWidget -if os_name == "nt" and version_info.major == 3 and version_info.minor >= 8: +if os_name == "nt" and version_info.major == 3 and version_info.minor >= 8: # patch c.f. https://github.com/tornadoweb/tornado/issues/2608#issuecomment-491489432 asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # type: ignore From 500d59be9c6a103bd6d3ea4177d417d8bb3321a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=BCbner?= Date: Sun, 7 Mar 2021 18:20:55 +0100 Subject: [PATCH 10/13] removed /bin in tox:dist --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index e03c5862..5bf45e37 100644 --- a/tox.ini +++ b/tox.ini @@ -44,8 +44,8 @@ skip_install = true # Have to use /bin/bash or the `*` will cause that argument to get quoted by the tox command line... commands = python setup.py sdist --dist-dir={distdir} bdist_wheel --dist-dir={distdir} - /bin/bash -c 'python -m pip install -U --force-reinstall {distdir}/nbclient*.whl' - /bin/bash -c 'python -m pip install -U --force-reinstall --no-deps {distdir}/nbclient*.tar.gz' + bash -c 'python -m pip install -U --force-reinstall {distdir}/nbclient*.whl' + bash -c 'python -m pip install -U --force-reinstall --no-deps {distdir}/nbclient*.tar.gz' [testenv] # disable Python's hash randomization for tests that stringify dicts, etc From 8d5a8ce46c391d1250c058db618693cfa6bbfca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=BCbner?= Date: Sun, 7 Mar 2021 19:27:03 +0100 Subject: [PATCH 11/13] updated tox for multiple platform usage --- tox.ini | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/tox.ini b/tox.ini index 5bf45e37..37215a7a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,13 +1,15 @@ [tox] skipsdist = true -envlist = py{36,37,38, 39}, flake8, mypy, dist, manifest, docs +envlist = py{36,37,38, 39}, flake8, mypy, dist-{win, linux}, manifest, docs +requires = + tox-factor [gh-actions] python = 3.6: py36 3.7: py37 3.8: py38 - 3.9: py39, flake8, mypy, dist, manifest + 3.9: py39, flake8, mypy, dist-{win, linux}, manifest # Linters [testenv:flake8] @@ -39,13 +41,22 @@ commands = python -c 'import pathlib; print("documentation available under file://\{0\}".format(pathlib.Path(r"{toxworkdir}") / "docs_out" / "index.html"))' # Distro -[testenv:dist] +[testenv:dist-{win, linux}] skip_install = true +platform = + win: win|msys + linux-mac: linux|darwin +allowlist_externals = + win: powershell + linux: bash # Have to use /bin/bash or the `*` will cause that argument to get quoted by the tox command line... commands = python setup.py sdist --dist-dir={distdir} bdist_wheel --dist-dir={distdir} - bash -c 'python -m pip install -U --force-reinstall {distdir}/nbclient*.whl' - bash -c 'python -m pip install -U --force-reinstall --no-deps {distdir}/nbclient*.tar.gz' + win: powershell Get-ChildItem -Path {distdir} -Filter nbclient*.whl | foreach \{python -m pip install -U --force-reinstall $_.FullName\} + win: powershell Get-ChildItem -Path {distdir} -Filter nbclient*.tar.gz | foreach \{python -m pip install -U --force-reinstall --no-deps $_.FullName\} + + linux: bash -c 'python -m pip install -U --force-reinstall {distdir}/nbclient*.whl' + linux: bash -c 'python -m pip install -U --force-reinstall --no-deps {distdir}/nbclient*.tar.gz' [testenv] # disable Python's hash randomization for tests that stringify dicts, etc From 1ed7d3ae88c936c505e194de9b597922b6f27a5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=BCbner?= Date: Sun, 7 Mar 2021 19:30:03 +0100 Subject: [PATCH 12/13] updated tox --- tox.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index 37215a7a..150009f1 100644 --- a/tox.ini +++ b/tox.ini @@ -45,16 +45,16 @@ commands = skip_install = true platform = win: win|msys - linux-mac: linux|darwin + linux: linux|darwin allowlist_externals = win: powershell linux: bash -# Have to use /bin/bash or the `*` will cause that argument to get quoted by the tox command line... + commands = python setup.py sdist --dist-dir={distdir} bdist_wheel --dist-dir={distdir} win: powershell Get-ChildItem -Path {distdir} -Filter nbclient*.whl | foreach \{python -m pip install -U --force-reinstall $_.FullName\} win: powershell Get-ChildItem -Path {distdir} -Filter nbclient*.tar.gz | foreach \{python -m pip install -U --force-reinstall --no-deps $_.FullName\} - + # Have to use /bin/bash or the `*` will cause that argument to get quoted by the tox command line... linux: bash -c 'python -m pip install -U --force-reinstall {distdir}/nbclient*.whl' linux: bash -c 'python -m pip install -U --force-reinstall --no-deps {distdir}/nbclient*.tar.gz' From 67e634f67724583497d4e974d973e266b517b5d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20H=C3=BCbner?= Date: Sun, 7 Mar 2021 19:39:45 +0100 Subject: [PATCH 13/13] removed tox-factor --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 150009f1..b5a0b3b0 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,8 @@ [tox] skipsdist = true envlist = py{36,37,38, 39}, flake8, mypy, dist-{win, linux}, manifest, docs -requires = - tox-factor +# requires = +# tox-factor [gh-actions] python =