From 55b2741eee1dfd8c7c1d587aaf008e16b80026ad Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Nov 2022 16:06:05 -0600 Subject: [PATCH 01/21] ci refactor --- .circleci/config.yml | 39 ------ .github/dependabot.yml | 8 ++ .github/workflows/check-release.yml | 19 --- .github/workflows/main.yml | 149 +++++++++++++++------- .pre-commit-config.yaml | 43 +++++-- .readthedocs.yml | 2 +- MANIFEST.in | 43 ------- codecov.yml | 9 ++ nbclient/client.py | 12 +- nbclient/tests/test_client.py | 9 +- nbclient/util.py | 4 +- pyproject.toml | 183 ++++++++++++++++++++-------- pytest.ini | 2 - requirements-dev.txt | 17 --- requirements.txt | 4 - setup.cfg | 30 ----- setup.py | 74 ----------- 17 files changed, 302 insertions(+), 345 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/dependabot.yml delete mode 100644 .github/workflows/check-release.yml delete mode 100644 MANIFEST.in create mode 100644 codecov.yml delete mode 100644 pytest.ini delete mode 100644 requirements-dev.txt delete mode 100644 requirements.txt delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index fa8d2728..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,39 +0,0 @@ -version: 2 -jobs: - build_docs: - docker: - - image: circleci/python:3.7-stretch - steps: - # Get our data and merge with upstream - - run: sudo apt-get update - - checkout - - - restore_cache: - keys: - - cache-pip - - - run: | - pip install --user .[sphinx] - - - save_cache: - key: cache-pip - paths: - - ~/.cache/pip - - # Build the docs - - run: - name: Build docs to store - command: | - cd docs - make html - - - store_artifacts: - path: docs/_build/html/ - destination: html - - -workflows: - version: 2 - default: - jobs: - - build_docs diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..f10a5bc1 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: + # Set update schedule for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every weekday + interval: "weekly" diff --git a/.github/workflows/check-release.yml b/.github/workflows/check-release.yml deleted file mode 100644 index 5d11d953..00000000 --- a/.github/workflows/check-release.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Check Release -on: - push: - branches: ["main"] - pull_request: - -permissions: - contents: write - -jobs: - check_release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - - name: Check Release - uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fbf820b8..7c84a284 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,19 +4,29 @@ on: push: branches: ["main"] pull_request: + schedule: + - cron: "0 8 * * *" + +defaults: + run: + shell: bash -eux {0} jobs: + pre_commit: + name: pre-commit + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + - uses: jupyterlab/maintainer-tools/.github/actions/pre-commit@v1 - pre-commit: - name: Run pre-commit formatters and linters + test_docs: + name: Test Docs runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.8 - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - uses: pre-commit/action@v2.0.0 + - uses: actions/checkout@v3 + - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + - run: hatch run docs:build build: name: Build, test and code coverage @@ -25,53 +35,75 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: [ '3.7', '3.8', '3.9', '3.10' ] + python-version: [ '3.7', '3.8', '3.9', '3.10', "3.11" ] exclude: - os: windows-latest python-version: 3.8 - os: windows-latest python-version: 3.9 - env: - OS: ${{ matrix.os }} - PYTHON: '3.9' - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} + - name: Checkout + uses: actions/checkout@v3 + - name: Base Setup + uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + - name: Run the tests + run: hatch run cov:test || hatch run test:test - - name: Install dependencies - run: | - pip install .[test] - pip install coverage + - name: Upload coverage to Codecov + run: | + pip install codecov + codecov - - name: Type check - run: mypy nbclient + test_minimum_versions: + name: Test Minimum Versions + timeout-minutes: 20 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + with: + python_version: "3.8" + - uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1 + with: + only_create_file: 1 + - name: Run the unit tests + run: | + export PIP_CONSTRAINT="./contraints_file.txt" + hatch run test:nowarn || hatch run test:nowarn --lf - - name: Run the tests - shell: bash - run: | - args="-vv --maxfail=2 --cov=nbclient --cov-report=xml -W always" - pytest $args || pytest $arg --lf + test_prereleases: + name: Test Prereleases + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@v3 + - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + with: + python_version: "3.11" + - name: Run the tests + run: | + PIP_PRE=1 hatch run test:nowarn || hatch run test:nowarn --lf - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 - with: - file: ./coverage.xml - flags: unittests - env_vars: OS,PYTHON - name: codecov-umbrella - fail_ci_if_error: false + make_sdist: + name: Make SDist + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v3 + - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + - uses: jupyterlab/maintainer-tools/.github/actions/make-sdist@v1 - - name: Build documentation - run: | - pip install .[sphinx] - cd docs - make html SPHINXOPTS="-W" + test_sdist: + runs-on: ubuntu-latest + needs: [make_sdist] + name: Install from SDist and Test + timeout-minutes: 20 + steps: + - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + - uses: jupyterlab/maintainer-tools/.github/actions/test-sdist@v1 + with: + package_spec: . + test_command: hatch run test:test || hatch run test:test --lf check-links: runs-on: ubuntu-latest @@ -79,3 +111,32 @@ jobs: - uses: actions/checkout@v2 - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1 + + check_release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + - name: Check Release + uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + + tests_check: # This job does nothing and is only used for the branch protection + if: always() + needs: + - build + - pre_commit + - test_docs + - test_minimum_versions + - test_prereleases + - check_links + - check_release + - test_sdist + runs-on: ubuntu-latest + steps: + - name: Decide whether the needed jobs succeeded or failed + uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4ed38b52..504fbe67 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,6 @@ ci: autoupdate_schedule: monthly autofix_prs: true - skip: [check-jsonschema] repos: @@ -39,24 +38,46 @@ repos: files: \.py$ args: [--profile=black] + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v0.990 + hooks: + - id: mypy + additional_dependencies: [jupyter_client, jupyter_core, nbformat, nbconvert] + + - repo: https://github.com/abravalheri/validate-pyproject + rev: v0.10.1 + hooks: + - id: validate-pyproject + stages: [manual] + + - repo: https://github.com/executablebooks/mdformat + rev: 0.7.16 + hooks: + - id: mdformat + + - repo: https://github.com/asottile/pyupgrade + rev: v3.2.2 + hooks: + - id: pyupgrade + args: [--py37-plus] + - repo: https://github.com/PyCQA/doc8 rev: v1.0.0 hooks: - id: doc8 args: [--max-line-length=200] - - repo: https://github.com/pycqa/flake8 - rev: 5.0.4 + + - repo: https://github.com/john-hen/Flake8-pyproject + rev: 1.1.0.post0 hooks: - - id: flake8 + - id: Flake8-pyproject + alias: flake8 additional_dependencies: ["flake8-bugbear==22.6.22", "flake8-implicit-str-concat==0.2.0"] + stages: [manual] - - repo: https://github.com/sirosen/check-jsonschema - rev: 0.18.4 + - repo: https://github.com/python-jsonschema/check-jsonschema + rev: 0.19.1 hooks: - - id: check-jsonschema - name: "Check GitHub Workflows" - files: ^\.github/workflows/ - types: [yaml] - args: ["--schemafile", "https://json.schemastore.org/github-workflow"] + - id: check-github-workflows diff --git a/.readthedocs.yml b/.readthedocs.yml index 92a11988..dc99fd00 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -19,4 +19,4 @@ python: - method: pip path: . extra_requirements: - - sphinx + - docs diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index d5da1e73..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1,43 +0,0 @@ -include LICENSE -include MANIFEST.in -include requirements.txt -include requirements-dev.txt -include *.md -include pytest.ini -include pyproject.toml -include .pre-commit-config.yaml -include nbclient/py.typed - -# Code and test files -recursive-include nbclient *.ipynb -recursive-include nbclient *.png -recursive-include nbclient *.py - -# Documentation -graft docs -exclude docs/\#* -exclude .readthedocs.yml -exclude codecov.yml - -# Examples -graft examples - -# docs subdirs we want to skip -prune docs/_build -prune docs/gh-pages -prune docs/dist - -# Patterns to exclude from any directory -global-exclude *~ -global-exclude *.pyc -global-exclude *.pyo -global-exclude .git -global-exclude .ipynb_checkpoints - -# Binder files to be excluded -exclude binder -recursive-exclude binder *.ipynb -recursive-exclude binder *.yml - -# Exclude CI/CD files -prune .circleci diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..b75c3e2d --- /dev/null +++ b/codecov.yml @@ -0,0 +1,9 @@ +coverage: + status: + project: + default: + target: auto + threshold: 1 + patch: + default: + target: 0% diff --git a/nbclient/client.py b/nbclient/client.py index ca59d0f1..866742b9 100644 --- a/nbclient/client.py +++ b/nbclient/client.py @@ -508,7 +508,7 @@ async def _async_cleanup_kernel(self) -> None: # Remove any state left over even if we failed to stop the kernel await ensure_async(self.km.cleanup_resources()) if getattr(self, "kc", None) and self.kc is not None: - await ensure_async(self.kc.stop_channels()) # type:ignore + await ensure_async(self.kc.stop_channels()) # type:ignore[func-returns-value] self.kc = None self.km = None @@ -556,7 +556,9 @@ async def async_start_new_kernel_client(self) -> KernelClient: try: self.kc = self.km.client() await ensure_async(self.kc.start_channels()) # type:ignore[func-returns-value] - await ensure_async(self.kc.wait_for_ready(timeout=self.startup_timeout)) # type:ignore + await ensure_async( + self.kc.wait_for_ready(timeout=self.startup_timeout) # type:ignore[attr-defined] + ) except Exception as e: self.log.error( "Error occurred while starting new kernel client for kernel {}: {}".format( @@ -853,7 +855,7 @@ async def _async_handle_timeout( async def _async_check_alive(self) -> None: assert self.kc is not None - if not await ensure_async(self.kc.is_alive()): # type:ignore + if not await ensure_async(self.kc.is_alive()): # type:ignore[attr-defined] self.log.error("Kernel died while waiting for execute reply.") raise DeadKernelError("Kernel died") @@ -1091,7 +1093,7 @@ def output( ) -> t.Optional[NotebookNode]: msg_type = msg['msg_type'] - out = None + out: t.Optional[NotebookNode] = None parent_msg_id = msg['parent_header'].get('msg_id') if self.output_hook_stack[parent_msg_id]: @@ -1122,7 +1124,7 @@ def output( outs.append(out) - return out # type:ignore[no-any-return] + return out def clear_output(self, outs: t.List, msg: t.Dict, cell_index: int) -> None: diff --git a/nbclient/tests/test_client.py b/nbclient/tests/test_client.py index 8efcf836..16eadf28 100644 --- a/nbclient/tests/test_client.py +++ b/nbclient/tests/test_client.py @@ -15,6 +15,7 @@ import nbformat import pytest import xmltodict +from flaky import flaky from jupyter_client import KernelClient, KernelManager from jupyter_client.kernelspec import KernelSpecManager from nbconvert.filters import strip_ansi @@ -215,8 +216,9 @@ def test_mock_wrapper(self): class NotebookClientWithParentID(NotebookClient): parent_id: str - executor = NotebookClientWithParentID({}) # type:ignore - executor.nb = {'cells': [cell_mock]} # type:ignore + nb = nbformat.v4.new_notebook() + executor = NotebookClientWithParentID(nb) + executor.nb.cells = [cell_mock] # self.kc.iopub_channel.get_msg => message_mock.side_effect[i] message_mock = iopub_messages_mock() @@ -358,6 +360,7 @@ def test_parallel_notebooks(capfd, tmpdir): assert filter_messages_on_error_output(captured.err) == "" +@flaky def test_many_parallel_notebooks(capfd): """Ensure that when many IPython kernels are run in parallel, nothing awful happens. @@ -550,7 +553,7 @@ class TestExecute(NBClientTestsBase): maxDiff = None def test_constructor(self): - NotebookClient({}) # type:ignore + NotebookClient(nbformat.v4.new_notebook()) def test_populate_language_info(self): nb = nbformat.v4.new_notebook() # Certainly has no language_info. diff --git a/nbclient/util.py b/nbclient/util.py index 0a352c2d..4d6b689d 100644 --- a/nbclient/util.py +++ b/nbclient/util.py @@ -32,9 +32,9 @@ def check_patch_tornado() -> None: import tornado.concurrent if asyncio.Future not in tornado.concurrent.FUTURES: - tornado.concurrent.FUTURES = tornado.concurrent.FUTURES + ( # type: ignore + tornado.concurrent.FUTURES = tornado.concurrent.FUTURES + ( asyncio.Future, - ) + ) # type:ignore[assignment] def just_run(coro: Awaitable) -> Any: diff --git a/pyproject.toml b/pyproject.toml index 28399677..1a5024de 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,45 +1,132 @@ -# Example configuration for Black. +[build-system] +requires = [ + "hatchling>=1.10.0", +] +build-backend = "hatchling.build" + +[project] +name = "nbclient" +dynamic = [ + "version", +] +description = "A client library for executing notebooks. Formerly nbconvert's ExecutePreprocessor." +readme = "README.md" +license = "BSD" +requires-python = ">=3.7.0" +authors = [ + { name = "Jupyter Development Team", email = "jupyter@googlegroups.com" }, +] +keywords = [ + "executor", + "jupyter", + "notebook", + "pipeline", +] +classifiers = [ + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: BSD License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", +] +dependencies = [ + "jupyter_client>=6.1.5", + "nbformat>=5.0", + "nest_asyncio", + "traitlets>=5.2.2", +] + +[project.optional-dependencies] +docs = [ + "autodoc-traits", + "mock", + "moto", + "myst-parser", + "sphinx-book-theme", + "sphinx>=1.7", +] +test = [ + "flaky", + "ipykernel", + "ipython", + "ipywidgets", + "nbconvert", + "pip>=18.1", + "pytest-asyncio", + "pytest-cov>=2.6.1", + "pytest>=4.1", + "testpath", + "xmltodict", +] +dev = [ + "pre-commit", +] + +[project.scripts] +jupyter-execute = "nbclient.cli:main" -# NOTE: you have to use single-quoted strings in TOML for regular expressions. -# It's the equivalent of r-strings in Python. Multiline strings are treated as -# verbose regular expressions by Black. Use [ ] to denote a significant space -# character. +[project.urls] +Documentation = "https://nbclient.readthedocs.io" +Funding = "https://numfocus.org/" +Homepage = "https://jupyter.org" +Source = "https://github.com/jupyter/nbclient" +Tracker = "https://github.com/jupyter/nbclient/issues" + +[tool.hatch.version] +path = "nbclient/__init__.py" + +[tool.hatch.build.targets.sdist] +include = [ + "/nbclient", +] + +[tool.hatch.envs.docs] +features = ["docs"] +[tool.hatch.envs.docs.scripts] +build = "make -C docs html SPHINXOPTS='-W'" + +[tool.hatch.envs.test] +features = ["test"] +[tool.hatch.envs.test.scripts] +test = "python -m pytest -vv {args}" +nowarn = "test -W default {args}" + +[tool.hatch.envs.cov] +features = ["test"] +dependencies = ["coverage", "pytest-cov"] +[tool.hatch.envs.cov.scripts] +test = "python -m pytest -vv --cov nbclient --cov-branch --cov-report term-missing:skip-covered {args}" +nowarn = "test -W default {args}" [tool.black] line-length = 100 -include = '\.pyi?$' -exclude = ''' -/( - \.git - | \.hg - | \.mypy_cache - | \.tox - | \.venv - | _build - | buck-out - | build - | dist - - # The following are specific to Black, you probably don't want those. - | blib2to3 - | tests/data - | profiling -)/ -''' +include = "\\.pyi?$" +exclude = "/(\n \\.git\n | \\.hg\n | \\.mypy_cache\n | \\.tox\n | \\.venv\n | _build\n | buck-out\n | build\n | dist\n\n # The following are specific to Black, you probably don't want those.\n | blib2to3\n | tests/data\n | profiling\n)/\n" skip-string-normalization = true [tool.isort] profile = "black" -known_first_party = ["nbclient"] +known_first_party = [ + "nbclient", +] + +[pytest.ini_options] +addopts = "-raXs --durations 10 --color=yes --doctest-modules" +asyncio_mode = "auto" [tool.mypy] python_version = 3.9 check_untyped_defs = true -disallow_any_generics = false # todo +disallow_any_generics = false disallow_incomplete_defs = true disallow_untyped_decorators = true no_implicit_optional = true -no_implicit_reexport = false # todo +no_implicit_reexport = false pretty = true show_error_context = true show_error_codes = true @@ -53,32 +140,26 @@ warn_unused_ignores = true [[tool.mypy.overrides]] module = [ "async_generator.*", - "jupyter_core.*", - "nbformat.*", - "nbconvert.*", "nest_asyncio.*", "testpath", - "traitlets.*", - "xmltodict" + "xmltodict", ] ignore_missing_imports = true -[tool.jupyter-releaser] -skip = ["check-links"] - -[tool.check-manifest] -ignore = [".mailmap", "*.yml", "*.yaml"] - -[tool.tbump.version] -current = "0.7.0" -regex = ''' - (?P\d+)\.(?P\d+)\.(?P\d+) - ((?Pa|b|rc|.dev)(?P\d+))? -''' - -[tool.tbump.git] -message_template = "Bump to {new_version}" -tag_template = "v{new_version}" - -[[tool.tbump.file]] -src = "nbclient/_version.py" +[tool.flake8] +ignore = "E501, W503, E402" +builtins = "c, get_config" +exclude = """ +.cache, +.github, +docs, +setup.py""" +enable-extensions = "G" +extend-ignore = """ +G001, G002, G004, G200, G201, G202, +# black adds spaces around ':' +E203,""" +per-file-ignores = """ +# B011: Do not call assert False since python -O removes these calls +# F841 local variable 'foo' is assigned to but never used +nbclient/tests/*: B011, F841""" diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 2f4c80e3..00000000 --- a/pytest.ini +++ /dev/null @@ -1,2 +0,0 @@ -[pytest] -asyncio_mode = auto diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index 9888bb23..00000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,17 +0,0 @@ -black -check-manifest -flake8 -ipykernel -ipython -ipywidgets -mypy -nbconvert -pip>=18.1 -pre-commit -pytest>=4.1 -pytest-asyncio -pytest-cov>=2.6.1 -setuptools>=60.0 -testpath -twine>=1.11.0 -xmltodict diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 2faf6984..00000000 --- a/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -jupyter_client>=6.1.5,<8 -nbformat>=5.0,<6 -nest_asyncio>=1.5.6,<2 -traitlets>=5.2.2,<6 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index a77a05c3..00000000 --- a/setup.cfg +++ /dev/null @@ -1,30 +0,0 @@ -[bdist_wheel] -universal=0 - -[check-manifest] -ignore = - .circleci* - docs/changelog.md - -[metadata] -name = nbclient -version = attr: nbclient._version.__version__ -license_file = LICENSE - -[flake8] -ignore = E501, W503, E402 -builtins = c, get_config -exclude = - .cache, - .github, - docs, - setup.py -enable-extensions = G -extend-ignore = - G001, G002, G004, G200, G201, G202, - # black adds spaces around ':' - E203, -per-file-ignores = - # B011: Do not call assert False since python -O removes these calls - # F841 local variable 'foo' is assigned to but never used - nbclient/tests/*: B011, F841 diff --git a/setup.py b/setup.py deleted file mode 100644 index 3cebf8be..00000000 --- a/setup.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python - -# Copyright (c) Jupyter Development Team. -# Distributed under the terms of the Modified BSD License. - -import os - -from setuptools import setup - -# the name of the package -name = 'nbclient' - -local_path = os.path.dirname(__file__) -here = os.path.abspath(local_path) - - -def read(path): - with open(path) as fhandle: - return fhandle.read() - - -def read_reqs(fname): - req_path = os.path.join(here, fname) - return [req.strip() for req in read(req_path).splitlines() if req.strip()] - - -long_description = read(os.path.join(os.path.dirname(__file__), "README.md")) -requirements = read(os.path.join(os.path.dirname(__file__), "requirements.txt")) -dev_reqs = read_reqs(os.path.join(os.path.dirname(__file__), 'requirements-dev.txt')) -doc_reqs = read_reqs(os.path.join(os.path.dirname(__file__), 'docs/requirements-doc.txt')) -extras_require = {"test": dev_reqs, "sphinx": doc_reqs} - -setup( - name=name, - author='Jupyter Development Team', - author_email='jupyter@googlegroups.com', - url='https://jupyter.org', - description=( - "A client library for executing notebooks. Formerly nbconvert's ExecutePreprocessor." - ), - long_description=long_description, - long_description_content_type='text/markdown', - packages=['nbclient'], - include_package_data=True, - python_requires=">=3.7.0", - install_requires=requirements, - extras_require=extras_require, - entry_points={ - 'console_scripts': [ - 'jupyter-execute = nbclient.cli:main', - ], - }, - project_urls={ - 'Documentation': 'https://nbclient.readthedocs.io', - 'Funding': 'https://numfocus.org/', - 'Source': 'https://github.com/jupyter/nbclient', - 'Tracker': 'https://github.com/jupyter/nbclient/issues', - }, - license='BSD', - platforms="Linux, Mac OS X, Windows", - keywords=['jupyter', 'pipeline', 'notebook', 'executor'], - classifiers=[ - 'Intended Audience :: Developers', - 'Intended Audience :: System Administrators', - 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: BSD License', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - ], -) From 7a93e46647666277efe35d7a49f242bb3e5062e8 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Nov 2022 16:07:33 -0600 Subject: [PATCH 02/21] add coverage config --- pyproject.toml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 1a5024de..ff3a6979 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -119,6 +119,20 @@ known_first_party = [ addopts = "-raXs --durations 10 --color=yes --doctest-modules" asyncio_mode = "auto" +[tool.coverage.report] +exclude_lines = [ + "pragma: no cover", + "def __repr__", + "if self.debug:", + "if settings.DEBUG", + "raise AssertionError", + "raise NotImplementedError", + "if 0:", + "if __name__ == .__main__.:", + "class .*\bProtocol\\):", +"@(abc\\.)?abstractmethod", +] + [tool.mypy] python_version = 3.9 check_untyped_defs = true From d4aa5b5116daee8aa312f5f14abce5e76451a090 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Nov 2022 16:16:46 -0600 Subject: [PATCH 03/21] cleanup --- .github/workflows/main.yml | 2 +- docs/conf.py | 28 ++++++++++++++-------------- pyproject.toml | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7c84a284..ffbb5d2f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -105,7 +105,7 @@ jobs: package_spec: . test_command: hatch run test:test || hatch run test:test --lf - check-links: + check_links: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/docs/conf.py b/docs/conf.py index 350aa5b1..23276fd2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -129,20 +129,20 @@ # -- Options for LaTeX output --------------------------------------------- -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # - # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). - # - # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. - # - # 'preamble': '', - # Latex figure (float) alignment - # - # 'figure_align': 'htbp', -} +# latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +# +# 'papersize': 'letterpaper', +# The font size ('10pt', '11pt' or '12pt'). +# +# 'pointsize': '10pt', +# Additional stuff for the LaTeX preamble. +# +# 'preamble': '', +# Latex figure (float) alignment +# +# 'figure_align': 'htbp', +# } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, diff --git a/pyproject.toml b/pyproject.toml index ff3a6979..3ad4c8b9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -78,7 +78,7 @@ Source = "https://github.com/jupyter/nbclient" Tracker = "https://github.com/jupyter/nbclient/issues" [tool.hatch.version] -path = "nbclient/__init__.py" +path = "nbclient/_version.py" [tool.hatch.build.targets.sdist] include = [ From 4df2f8daf031b926063b54f9883ed3cd129b1a26 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Nov 2022 16:17:31 -0600 Subject: [PATCH 04/21] cleanup --- CHANGELOG.md | 8 ++++---- README.md | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7baa0b2..976624c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,7 +42,7 @@ ### Merged PRs - Fix tests for ipywidgets 8 [#246](https://github.com/jupyter/nbclient/pull/246) ([@frenzymadness](https://github.com/frenzymadness)) -- [pre-commit.ci] pre-commit autoupdate [#236](https://github.com/jupyter/nbclient/pull/236) ([@pre-commit-ci](https://github.com/pre-commit-ci)) +- \[pre-commit.ci\] pre-commit autoupdate [#236](https://github.com/jupyter/nbclient/pull/236) ([@pre-commit-ci](https://github.com/pre-commit-ci)) ### Contributors to this release @@ -131,7 +131,7 @@ ### Merged PRs -- [pre-commit.ci] pre-commit autoupdate [#225](https://github.com/jupyter/nbclient/pull/225) ([@pre-commit-ci](https://github.com/pre-commit-ci)) +- \[pre-commit.ci\] pre-commit autoupdate [#225](https://github.com/jupyter/nbclient/pull/225) ([@pre-commit-ci](https://github.com/pre-commit-ci)) - Add error_on_interrupt trait [#224](https://github.com/jupyter/nbclient/pull/224) ([@davidbrochart](https://github.com/davidbrochart)) - Fix typo [#223](https://github.com/jupyter/nbclient/pull/223) ([@davidbrochart](https://github.com/davidbrochart)) - Add on_cell_executed hook [#222](https://github.com/jupyter/nbclient/pull/222) ([@davidbrochart](https://github.com/davidbrochart)) @@ -197,7 +197,7 @@ ### Merged PRs -- Pin ipython<8 in tests [#198](https://github.com/jupyter/nbclient/pull/198) ([@davidbrochart](https://github.com/davidbrochart)) +- Pin ipython\<8 in tests [#198](https://github.com/jupyter/nbclient/pull/198) ([@davidbrochart](https://github.com/davidbrochart)) - Clear execution metadata, prefer msg header date when recording times [#195](https://github.com/jupyter/nbclient/pull/195) ([@kevin-bates](https://github.com/kevin-bates)) - Client hooks [#188](https://github.com/jupyter/nbclient/pull/188) ([@devintang3](https://github.com/devintang3)) @@ -331,7 +331,7 @@ If you were using these versions for the couple days they were up, move to 0.5.0 ### Fixes -- Fix `OSError: [WinError 6] The handle is invalid` for windows/python<3.7 [#77](https://github.com/jupyter/nbclient/pull/77) +- Fix `OSError: [WinError 6] The handle is invalid` for windows/python\<3.7 [#77](https://github.com/jupyter/nbclient/pull/77) - Async wapper Exceptions no longer loose their caused exception information [#65](https://github.com/jupyter/nbclient/pull/65) - `extra_arguments` are now configurable by config settings [#66](https://github.com/jupyter/nbclient/pull/66) diff --git a/README.md b/README.md index 5485f905..927aed5b 100644 --- a/README.md +++ b/README.md @@ -25,14 +25,15 @@ To demo **NBClient** interactively, click this Binder badge to start the demo: In a terminal, run: - python3 -m pip install nbclient +``` +python3 -m pip install nbclient +``` ## Documentation See [ReadTheDocs](https://nbclient.readthedocs.io/en/latest/) for more in-depth details about the project and the [API Reference](https://nbclient.readthedocs.io/en/latest/reference/index.html). - ## Python Version Support This library currently supports Python 3.6+ versions. As minor Python From 2bd4185dbe6205cd8d28aa2cd513cea12d865be4 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Nov 2022 16:25:11 -0600 Subject: [PATCH 05/21] cleanup --- pyproject.toml | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3ad4c8b9..e650b4c1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ dynamic = [ ] description = "A client library for executing notebooks. Formerly nbconvert's ExecutePreprocessor." readme = "README.md" -license = "BSD" +license = { file = "LICENSE" } requires-python = ">=3.7.0" authors = [ { name = "Jupyter Development Team", email = "jupyter@googlegroups.com" }, @@ -163,17 +163,18 @@ ignore_missing_imports = true [tool.flake8] ignore = "E501, W503, E402" builtins = "c, get_config" -exclude = """ -.cache, -.github, -docs, -setup.py""" +exclude = [ + ".cache", + ".github", + "docs", +] enable-extensions = "G" -extend-ignore = """ -G001, G002, G004, G200, G201, G202, -# black adds spaces around ':' -E203,""" -per-file-ignores = """ -# B011: Do not call assert False since python -O removes these calls -# F841 local variable 'foo' is assigned to but never used -nbclient/tests/*: B011, F841""" +extend-ignore = ["G001", "G002", "G004", "G200", "G201", "G202", + # black adds spaces around ':' + "E203" +] +per-file-ignores = [ + # B011: Do not call assert False since python -O removes these calls + # F841 local variable 'foo' is assigned to but never used + "nbclient/tests/*: B011, F841" +] From fe10e6d0d4e82d3399aad3e430f0c2d496db3a11 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Nov 2022 16:34:36 -0600 Subject: [PATCH 06/21] try again --- docs/requirements-doc.txt | 6 ------ nbclient/tests/test_client.py | 4 ++++ pyproject.toml | 17 +++++++++-------- 3 files changed, 13 insertions(+), 14 deletions(-) delete mode 100644 docs/requirements-doc.txt diff --git a/docs/requirements-doc.txt b/docs/requirements-doc.txt deleted file mode 100644 index b74be9bf..00000000 --- a/docs/requirements-doc.txt +++ /dev/null @@ -1,6 +0,0 @@ -autodoc-traits -mock -moto -myst-parser -Sphinx>=1.7 -sphinx-book-theme diff --git a/nbclient/tests/test_client.py b/nbclient/tests/test_client.py index 16eadf28..7743a3dc 100644 --- a/nbclient/tests/test_client.py +++ b/nbclient/tests/test_client.py @@ -38,6 +38,10 @@ r'((Cell|Input) In \[\d+\]|), (in )?(line \d||\(\))' ) + +# Avoid warnings from pydev. +os.environ['PYDEVD_DISABLE_FILE_VALIDATION'] = '1' + hook_methods = [ "on_cell_start", "on_cell_execute", diff --git a/pyproject.toml b/pyproject.toml index e650b4c1..0afe5bfe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,14 +42,6 @@ dependencies = [ ] [project.optional-dependencies] -docs = [ - "autodoc-traits", - "mock", - "moto", - "myst-parser", - "sphinx-book-theme", - "sphinx>=1.7", -] test = [ "flaky", "ipykernel", @@ -63,6 +55,15 @@ test = [ "testpath", "xmltodict", ] +docs = [ + "autodoc-traits", + "mock", + "moto", + "myst-parser", + "sphinx-book-theme", + "sphinx>=1.7", + "nbclient[test]", +] dev = [ "pre-commit", ] From 2696def09146e743d1a7fd752da589567b1f440a Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Nov 2022 16:41:39 -0600 Subject: [PATCH 07/21] try again --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0afe5bfe..e8e8e0f5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,6 @@ test = [ "ipython", "ipywidgets", "nbconvert", - "pip>=18.1", "pytest-asyncio", "pytest-cov>=2.6.1", "pytest>=4.1", @@ -116,7 +115,7 @@ known_first_party = [ "nbclient", ] -[pytest.ini_options] +[tool.pytest.ini_options] addopts = "-raXs --durations 10 --color=yes --doctest-modules" asyncio_mode = "auto" From e051bd382b248ea4164a6a3b1f7125a361d631b9 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Nov 2022 16:44:24 -0600 Subject: [PATCH 08/21] remove min version check --- .github/workflows/main.yml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ffbb5d2f..383a6013 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -54,23 +54,6 @@ jobs: pip install codecov codecov - test_minimum_versions: - name: Test Minimum Versions - timeout-minutes: 20 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - with: - python_version: "3.8" - - uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1 - with: - only_create_file: 1 - - name: Run the unit tests - run: | - export PIP_CONSTRAINT="./contraints_file.txt" - hatch run test:nowarn || hatch run test:nowarn --lf - test_prereleases: name: Test Prereleases runs-on: ubuntu-latest @@ -129,7 +112,6 @@ jobs: - build - pre_commit - test_docs - - test_minimum_versions - test_prereleases - check_links - check_release From 88e2f7fa3ed0d5a2eed61fa74355a5bffe2d38a6 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Nov 2022 17:00:02 -0600 Subject: [PATCH 09/21] try to fix windows again --- nbclient/tests/conftest.py | 7 +++++++ nbclient/tests/test_client.py | 2 -- pyproject.toml | 1 - 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/nbclient/tests/conftest.py b/nbclient/tests/conftest.py index 7959fcbf..9053ef26 100644 --- a/nbclient/tests/conftest.py +++ b/nbclient/tests/conftest.py @@ -1,6 +1,13 @@ +import asyncio import os +import sys # This is important for ipykernel to show the same string # instead of randomly generated file names in outputs. # See: https://github.com/ipython/ipykernel/blob/360685c6/ipykernel/compiler.py#L50-L55 os.environ["IPYKERNEL_CELL_NAME"] = "" + +if os.name == "nt" and sys.version_info >= (3, 7): + asyncio.set_event_loop_policy( + asyncio.WindowsSelectorEventLoopPolicy() # type:ignore[attr-defined] + ) diff --git a/nbclient/tests/test_client.py b/nbclient/tests/test_client.py index 7743a3dc..56ad52ef 100644 --- a/nbclient/tests/test_client.py +++ b/nbclient/tests/test_client.py @@ -15,7 +15,6 @@ import nbformat import pytest import xmltodict -from flaky import flaky from jupyter_client import KernelClient, KernelManager from jupyter_client.kernelspec import KernelSpecManager from nbconvert.filters import strip_ansi @@ -364,7 +363,6 @@ def test_parallel_notebooks(capfd, tmpdir): assert filter_messages_on_error_output(captured.err) == "" -@flaky def test_many_parallel_notebooks(capfd): """Ensure that when many IPython kernels are run in parallel, nothing awful happens. diff --git a/pyproject.toml b/pyproject.toml index e8e8e0f5..7541b9fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,6 @@ dependencies = [ [project.optional-dependencies] test = [ - "flaky", "ipykernel", "ipython", "ipywidgets", From 8129479030341a2d6e15667910eb10391a2c13bd Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Nov 2022 18:52:25 -0600 Subject: [PATCH 10/21] try again --- .github/workflows/main.yml | 18 ++++++++++++++++++ nbclient/tests/conftest.py | 5 ----- nbclient/tests/test_client.py | 1 + pyproject.toml | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 383a6013..ffbb5d2f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -54,6 +54,23 @@ jobs: pip install codecov codecov + test_minimum_versions: + name: Test Minimum Versions + timeout-minutes: 20 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + with: + python_version: "3.8" + - uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1 + with: + only_create_file: 1 + - name: Run the unit tests + run: | + export PIP_CONSTRAINT="./contraints_file.txt" + hatch run test:nowarn || hatch run test:nowarn --lf + test_prereleases: name: Test Prereleases runs-on: ubuntu-latest @@ -112,6 +129,7 @@ jobs: - build - pre_commit - test_docs + - test_minimum_versions - test_prereleases - check_links - check_release diff --git a/nbclient/tests/conftest.py b/nbclient/tests/conftest.py index 9053ef26..16604592 100644 --- a/nbclient/tests/conftest.py +++ b/nbclient/tests/conftest.py @@ -6,8 +6,3 @@ # instead of randomly generated file names in outputs. # See: https://github.com/ipython/ipykernel/blob/360685c6/ipykernel/compiler.py#L50-L55 os.environ["IPYKERNEL_CELL_NAME"] = "" - -if os.name == "nt" and sys.version_info >= (3, 7): - asyncio.set_event_loop_policy( - asyncio.WindowsSelectorEventLoopPolicy() # type:ignore[attr-defined] - ) diff --git a/nbclient/tests/test_client.py b/nbclient/tests/test_client.py index 56ad52ef..d5181448 100644 --- a/nbclient/tests/test_client.py +++ b/nbclient/tests/test_client.py @@ -363,6 +363,7 @@ def test_parallel_notebooks(capfd, tmpdir): assert filter_messages_on_error_output(captured.err) == "" +@pytest.mark.skipif(os.name == 'nt', reason='warns about event loop on Windows') def test_many_parallel_notebooks(capfd): """Ensure that when many IPython kernels are run in parallel, nothing awful happens. diff --git a/pyproject.toml b/pyproject.toml index 7541b9fe..123603c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", ] dependencies = [ - "jupyter_client>=6.1.5", + "jupyter_client>=6.1.12", "nbformat>=5.0", "nest_asyncio", "traitlets>=5.2.2", From 4d3b3ebda07b8ec2de51e86e4bc5ac544183eeb4 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Nov 2022 19:02:05 -0600 Subject: [PATCH 11/21] try again --- .github/workflows/main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ffbb5d2f..62f1cf88 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -47,7 +47,7 @@ jobs: - name: Base Setup uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - name: Run the tests - run: hatch run cov:test || hatch run test:test + run: hatch run cov:test || hatch run test:test --lf - name: Upload coverage to Codecov run: | @@ -122,7 +122,6 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} - tests_check: # This job does nothing and is only used for the branch protection if: always() needs: From 2f5450357c0c760102d15febb97b0066ae2a4633 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Nov 2022 19:04:10 -0600 Subject: [PATCH 12/21] flake --- nbclient/tests/conftest.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/nbclient/tests/conftest.py b/nbclient/tests/conftest.py index 16604592..7959fcbf 100644 --- a/nbclient/tests/conftest.py +++ b/nbclient/tests/conftest.py @@ -1,6 +1,4 @@ -import asyncio import os -import sys # This is important for ipykernel to show the same string # instead of randomly generated file names in outputs. From 49c9d08a54bebd78204555d2ab092c2f3b138b22 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Nov 2022 19:04:34 -0600 Subject: [PATCH 13/21] debug --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 62f1cf88..edb53567 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,7 +69,7 @@ jobs: - name: Run the unit tests run: | export PIP_CONSTRAINT="./contraints_file.txt" - hatch run test:nowarn || hatch run test:nowarn --lf + hatch run test:nowarn || -v hatch run test:nowarn --lf test_prereleases: name: Test Prereleases From 13dfc04ff518e67382664636189f61ecdcb7fc1a Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Nov 2022 19:05:36 -0600 Subject: [PATCH 14/21] debug --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index edb53567..cf93bd4e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,7 +69,7 @@ jobs: - name: Run the unit tests run: | export PIP_CONSTRAINT="./contraints_file.txt" - hatch run test:nowarn || -v hatch run test:nowarn --lf + hatch run test:nowarn || hatch -v run test:nowarn --lf test_prereleases: name: Test Prereleases From e5099470b9de79eae470bcf37093cec3e45fdffa Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Nov 2022 19:09:39 -0600 Subject: [PATCH 15/21] fix pin --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 123603c9..2be03f98 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,7 @@ classifiers = [ ] dependencies = [ "jupyter_client>=6.1.12", - "nbformat>=5.0", + "nbformat>=5.0.2", "nest_asyncio", "traitlets>=5.2.2", ] From 288c87f90eb62c6878c3d5e390d3a15887afeafc Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Nov 2022 19:16:32 -0600 Subject: [PATCH 16/21] update minimums --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2be03f98..2fbfa99c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,8 +48,8 @@ test = [ "ipywidgets", "nbconvert", "pytest-asyncio", - "pytest-cov>=2.6.1", - "pytest>=4.1", + "pytest-cov>=4.0", + "pytest>=7.0", "testpath", "xmltodict", ] From 547db280a85e5c0f427e3653c2dffe03755a567a Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Nov 2022 19:20:23 -0600 Subject: [PATCH 17/21] bump min traitlets --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2fbfa99c..16948657 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ dependencies = [ "jupyter_client>=6.1.12", "nbformat>=5.0.2", "nest_asyncio", - "traitlets>=5.2.2", + "traitlets>=5.3", ] [project.optional-dependencies] From 87476c6bef8de34a9840e7f270026c750ce76cc1 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Nov 2022 19:25:43 -0600 Subject: [PATCH 18/21] bump min nbconvert --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 16948657..0c17bedd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,7 @@ test = [ "ipykernel", "ipython", "ipywidgets", - "nbconvert", + "nbconvert>=7.0.0", "pytest-asyncio", "pytest-cov>=4.0", "pytest>=7.0", From 8e7b415736779e23f6526772a9a04e2c5edeb607 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Nov 2022 19:26:55 -0600 Subject: [PATCH 19/21] try again --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 0c17bedd..62afba3d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,7 @@ classifiers = [ ] dependencies = [ "jupyter_client>=6.1.12", - "nbformat>=5.0.2", + "nbformat>=5.1", "nest_asyncio", "traitlets>=5.3", ] From 39fdc1e29807c3ab11c0113d8e881a572a50a8b1 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Nov 2022 19:33:40 -0600 Subject: [PATCH 20/21] add skip --- nbclient/tests/test_client.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nbclient/tests/test_client.py b/nbclient/tests/test_client.py index d5181448..86d0fd11 100644 --- a/nbclient/tests/test_client.py +++ b/nbclient/tests/test_client.py @@ -16,6 +16,7 @@ import pytest import xmltodict from jupyter_client import KernelClient, KernelManager +from jupyter_client._version import version_info from jupyter_client.kernelspec import KernelSpecManager from nbconvert.filters import strip_ansi from nbformat import NotebookNode @@ -518,6 +519,7 @@ def test_start_new_kernel_history_file_setting(): kc.stop_channels() +@pytest.mark.skipif(int(version_info[0]) < 7, reason="requires client 7+") def test_start_new_kernel_client_cleans_up_kernel_on_failure(): class FakeClient(KernelClient): def start_channels( From 46c5cd54cd43cb66bae92ac763cd417a8e250a4d Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 24 Nov 2022 10:07:03 -0600 Subject: [PATCH 21/21] use base setup dependency type --- .github/workflows/main.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cf93bd4e..4922b3ff 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -51,7 +51,7 @@ jobs: - name: Upload coverage to Codecov run: | - pip install codecov + pip install codecov coverage[toml] codecov test_minimum_versions: @@ -62,13 +62,9 @@ jobs: - uses: actions/checkout@v3 - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 with: - python_version: "3.8" - - uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1 - with: - only_create_file: 1 + dependency_type: minimum - name: Run the unit tests run: | - export PIP_CONSTRAINT="./contraints_file.txt" hatch run test:nowarn || hatch -v run test:nowarn --lf test_prereleases: @@ -79,10 +75,10 @@ jobs: - uses: actions/checkout@v3 - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 with: - python_version: "3.11" + dependency_type: pre - name: Run the tests run: | - PIP_PRE=1 hatch run test:nowarn || hatch run test:nowarn --lf + hatch run test:nowarn || hatch run test:nowarn --lf make_sdist: name: Make SDist