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..4922b3ff 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,57 +35,103 @@ 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: 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 --lf - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} + - name: Upload coverage to Codecov + run: | + pip install codecov coverage[toml] + codecov - - name: Install dependencies - run: | - pip install .[test] - pip install coverage - - - 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: + dependency_type: minimum + - name: Run the unit tests + run: | + hatch run test:nowarn || hatch -v 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: + dependency_type: pre + - name: Run the tests + run: | + 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: + check_links: runs-on: ubuntu-latest steps: - 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/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/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/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 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/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/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/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..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 @@ -37,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", @@ -215,8 +220,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 +364,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. @@ -512,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( @@ -550,7 +558,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..62afba3d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,45 +1,145 @@ -# 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 = { file = "LICENSE" } +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.12", + "nbformat>=5.1", + "nest_asyncio", + "traitlets>=5.3", +] + +[project.optional-dependencies] +test = [ + "ipykernel", + "ipython", + "ipywidgets", + "nbconvert>=7.0.0", + "pytest-asyncio", + "pytest-cov>=4.0", + "pytest>=7.0", + "testpath", + "xmltodict", +] +docs = [ + "autodoc-traits", + "mock", + "moto", + "myst-parser", + "sphinx-book-theme", + "sphinx>=1.7", + "nbclient[test]", +] +dev = [ + "pre-commit", +] + +[project.scripts] +jupyter-execute = "nbclient.cli:main" + +[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/_version.py" -# 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. +[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", +] + +[tool.pytest.ini_options] +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 -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 +153,27 @@ 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", +] +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', - ], -)