Skip to content

Commit 9b434e9

Browse files
authored
Add more ci checks (#1063)
* add more ci checks * fixes * lint * lint
1 parent 40c5567 commit 9b434e9

39 files changed

+307
-15
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
run: |
7777
hatch run typing:test
7878
hatch run lint:style
79-
pipx run 'validate-pyproject[all]' pyproject.toml
79+
pipx run interrogate -vv .
8080
pipx run doc8 --max-line-length=200
8181
8282
check_release:
@@ -89,7 +89,7 @@ jobs:
8989
token: ${{ secrets.GITHUB_TOKEN }}
9090

9191
test_docs:
92-
runs-on: ubuntu-latest
92+
runs-on: windows-latest
9393
steps:
9494
- uses: actions/checkout@v3
9595
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

.pre-commit-config.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,19 @@ repos:
55
- repo: https://github.com/pre-commit/pre-commit-hooks
66
rev: v4.4.0
77
hooks:
8-
- id: end-of-file-fixer
98
- id: check-case-conflict
9+
- id: check-ast
10+
- id: check-docstring-first
1011
- id: check-executables-have-shebangs
11-
- id: requirements-txt-fixer
1212
- id: check-added-large-files
1313
- id: check-case-conflict
14+
- id: check-merge-conflict
15+
- id: check-json
1416
- id: check-toml
1517
- id: check-yaml
16-
- id: forbid-new-submodules
17-
- id: check-builtin-literals
18+
- id: debug-statements
19+
exclude: ipykernel/kernelapp.py
20+
- id: end-of-file-fixer
1821
- id: trailing-whitespace
1922

2023
- repo: https://github.com/python-jsonschema/check-jsonschema
@@ -33,7 +36,7 @@ repos:
3336
- id: black
3437

3538
- repo: https://github.com/charliermarsh/ruff-pre-commit
36-
rev: v0.0.177
39+
rev: v0.0.189
3740
hooks:
3841
- id: ruff
3942
args: ["--fix"]

docs/conf.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@
3636
"sphinxcontrib_github_alt",
3737
]
3838

39+
try:
40+
import enchant # noqa
41+
42+
extensions += ["sphinxcontrib.spelling"]
43+
except ImportError:
44+
pass
45+
46+
3947
github_project_url = "https://github.com/ipython/ipykernel"
4048

4149
# Add any paths that contain templates here, relative to this directory.

examples/embedding/inprocess_qtconsole.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""An in-process qt console app."""
12
import os
23
import sys
34

@@ -8,6 +9,7 @@
89

910

1011
def print_process_id():
12+
"""Print the process id."""
1113
print("Process ID is:", os.getpid())
1214

1315

@@ -42,6 +44,7 @@ def init_asyncio_patch():
4244

4345

4446
def main():
47+
"""The main entry point."""
4548
# Print the ID of the main process
4649
print_process_id()
4750

examples/embedding/inprocess_terminal.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""An in-process terminal example."""
12
import os
23
import sys
34

@@ -8,6 +9,7 @@
89

910

1011
def print_process_id():
12+
"""Print the process id."""
1113
print("Process ID is:", os.getpid())
1214

1315

@@ -42,6 +44,7 @@ def init_asyncio_patch():
4244

4345

4446
def main():
47+
"""The main function."""
4548
print_process_id()
4649

4750
# Create an in-process kernel

examples/embedding/internal_ipkernel.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""An internal ipykernel example."""
12
# -----------------------------------------------------------------------------
23
# Imports
34
# -----------------------------------------------------------------------------
@@ -26,8 +27,10 @@ def mpl_kernel(gui):
2627

2728

2829
class InternalIPKernel:
30+
"""An internal ipykernel class."""
31+
2932
def init_ipkernel(self, backend):
30-
# Start IPython kernel with GUI event loop and mpl support
33+
"""Start IPython kernel with GUI event loop and mpl support."""
3134
self.ipkernel = mpl_kernel(backend)
3235
# To create and track active qt consoles
3336
self.consoles = []
@@ -41,6 +44,7 @@ def init_ipkernel(self, backend):
4144
# self.namespace['ipkernel'] = self.ipkernel # dbg
4245

4346
def print_namespace(self, evt=None):
47+
"""Print the namespace."""
4448
print("\n***Variables in User namespace***")
4549
for k, v in self.namespace.items():
4650
if not k.startswith("_"):
@@ -52,8 +56,10 @@ def new_qt_console(self, evt=None):
5256
return connect_qtconsole(self.ipkernel.abs_connection_file, profile=self.ipkernel.profile)
5357

5458
def count(self, evt=None):
59+
"""Get the app counter value."""
5560
self.namespace["app_counter"] += 1
5661

5762
def cleanup_consoles(self, evt=None):
63+
"""Clean up the consoles."""
5864
for c in self.consoles:
5965
c.kill()

examples/embedding/ipkernel_qtapp.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,17 @@
2626
# Functions and classes
2727
# -----------------------------------------------------------------------------
2828
class SimpleWindow(Qt.QWidget, InternalIPKernel):
29+
"""A custom Qt widget for IPykernel."""
30+
2931
def __init__(self, app):
32+
"""Initialize the widget."""
3033
Qt.QWidget.__init__(self)
3134
self.app = app
3235
self.add_widgets()
3336
self.init_ipkernel("qt")
3437

3538
def add_widgets(self):
39+
"""Add the widget."""
3640
self.setGeometry(300, 300, 400, 70)
3741
self.setWindowTitle("IPython in your app")
3842

examples/embedding/ipkernel_wxapp.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class MyFrame(wx.Frame, InternalIPKernel):
3636
"""
3737

3838
def __init__(self, parent, title):
39+
"""Initialize the frame."""
3940
wx.Frame.__init__(self, parent, -1, title, pos=(150, 150), size=(350, 285))
4041

4142
# Create the menubar
@@ -99,7 +100,10 @@ def OnTimeToClose(self, evt):
99100

100101

101102
class MyApp(wx.App):
103+
"""A custom wx app."""
104+
102105
def OnInit(self):
106+
"""Initialize app."""
103107
frame = MyFrame(None, "Simple wxPython App")
104108
self.SetTopWindow(frame)
105109
frame.Show(True)

hatch_build.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""A custom hatch build hook for ipykernel."""
12
import os
23
import shutil
34
import sys
@@ -6,7 +7,10 @@
67

78

89
class CustomHook(BuildHookInterface):
10+
"""The IPykernel build hook."""
11+
912
def initialize(self, version, build_data):
13+
"""Initialize the hook."""
1014
here = os.path.abspath(os.path.dirname(__file__))
1115
sys.path.insert(0, here)
1216
from ipykernel.kernelspec import make_ipkernel_cmd, write_kernel_spec

ipykernel/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""The cli entry point for ipykernel."""
12
if __name__ == "__main__":
23
from ipykernel import kernelapp as app
34

0 commit comments

Comments
 (0)