Skip to content

Commit

Permalink
Adopt sp-repo-review (#139)
Browse files Browse the repository at this point in the history
* adopt sp-repo-review

* address lint

* address typing

* address typing
  • Loading branch information
blink1073 authored Sep 10, 2023
1 parent fb9fa86 commit ffd26d8
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 83 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Tests
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"

Expand Down Expand Up @@ -121,8 +122,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Run Linters
run: |
- name: Run Linters
run: |
hatch run typing:test
hatch run lint:style
pipx run 'validate-pyproject[all]' pyproject.toml
Expand Down
46 changes: 39 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
ci:
autoupdate_schedule: monthly
autoupdate_commit_msg: "chore: update pre-commit hooks"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: check-case-conflict
- id: check-ast
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: requirements-txt-fixer
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-json
- id: check-toml
- id: check-yaml
- id: debug-statements
- id: forbid-new-submodules
- id: check-builtin-literals
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
Expand All @@ -30,14 +32,44 @@ repos:
additional_dependencies:
[mdformat-gfm, mdformat-frontmatter, mdformat-footnote]

- repo: https://github.com/psf/black
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.2"
hooks:
- id: prettier
types_or: [yaml, html, json]

- repo: https://github.com/adamchainz/blacken-docs
rev: "1.16.0"
hooks:
- id: blacken-docs
additional_dependencies: [black==23.7.0]

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.7.0
hooks:
- id: black

- repo: https://github.com/codespell-project/codespell
rev: "v2.2.5"
hooks:
- id: codespell
args: ["-L", "sur,nd"]

- repo: https://github.com/pre-commit/pygrep-hooks
rev: "v1.10.0"
hooks:
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.287
hooks:
- id: ruff
args: ["--fix"]
exclude: scripts
args: ["--fix", "--show-fixes"]

- repo: https://github.com/scientific-python/cookie
rev: "2023.08.23"
hooks:
- id: sp-repo-review
additional_dependencies: ["repo-review[cli]"]
18 changes: 8 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Example
import unittest
import jupyter_kernel_test
class MyKernelTests(jupyter_kernel_test.KernelTests):
# Required --------------------------------------
Expand All @@ -59,27 +60,24 @@ Example
# Samples of code which generate a result value (ie, some text
# displayed as Out[n])
code_execute_result = [
{'code': '6*7', 'result': '42'}
]
code_execute_result = [{"code": "6*7", "result": "42"}]
# Samples of code which should generate a rich display output, and
# the expected MIME type
code_display_data = [
{'code': 'show_image()', 'mime': 'image/png'}
]
code_display_data = [{"code": "show_image()", "mime": "image/png"}]
# You can also write extra tests. We recommend putting your kernel name
# in the method name, to avoid clashing with any tests that
# jupyter_kernel_test adds in the future.
def test_mykernel_stderr(self):
self.flush_channels()
reply, output_msgs = self.execute_helper(code='print_err "oops"')
self.assertEqual(output_msgs[0]['header']['msg_type'], 'stream')
self.assertEqual(output_msgs[0]['content']['name'], 'stderr')
self.assertEqual(output_msgs[0]['content']['text'], 'oops\n')
self.assertEqual(output_msgs[0]["header"]["msg_type"], "stream")
self.assertEqual(output_msgs[0]["content"]["name"], "stderr")
self.assertEqual(output_msgs[0]["content"]["text"], "oops\n")
if __name__ == '__main__':
if __name__ == "__main__":
unittest.main()
--------
Expand Down
Loading

0 comments on commit ffd26d8

Please sign in to comment.