diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7dd104af..d7f3ea35 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,11 +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.8 - - os: windows-latest - python-version: 3.9 env: OS: ${{ matrix.os }} PYTHON: '3.9' 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 diff --git a/nbclient/client.py b/nbclient/client.py index 40ec273b..7774632b 100644 --- a/nbclient/client.py +++ b/nbclient/client.py @@ -1,3 +1,5 @@ +from os import name as os_name +from sys import version_info import atexit import collections import datetime @@ -32,6 +34,11 @@ from .output_widget import OutputWidget +if os_name == "nt" and version_info >= (3, 8): + # patch c.f. https://github.com/tornadoweb/tornado/issues/2608#issuecomment-491489432 + asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) # type: ignore + + def timestamp() -> str: return datetime.datetime.utcnow().isoformat() + 'Z' diff --git a/tox.ini b/tox.ini index e03c5862..b5a0b3b0 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 -# Have to use /bin/bash or the `*` will cause that argument to get quoted by the tox command line... +platform = + win: win|msys + linux: linux|darwin +allowlist_externals = + win: powershell + linux: bash + 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' + 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' [testenv] # disable Python's hash randomization for tests that stringify dicts, etc