Skip to content

Commit 41c5ff9

Browse files
authored
Mkdocs and fully async message handling (#4)
* Setup mkdoc and improve documentation * Added badge for Material for MkDocs * Run notebooks for documentation - features added to kernel for timeouts, metadata and tags. Renamed CancelledError to FutureCancelledError * Update github workflows * Kernel: - code shuffle - add return types - add map_message_to_handler Job: - added received_time - removed msg_type Add docstrings. * Async shell docstring updates * Add Caller methods: - has_execution_queue - queue_call - queue_close Replace Kernel._shell_execute_request_queue with queue_call. * Switch from ExecuteMode to RunMode. Move the parameter from ExecuteContent to Job to make it generic. It could easily be moved elsewhere such as header of metadata... In Kernel change get_execute_mode to get_run_mode and make it possble for run mode to be dynamic. * Add RunMode to the message handlers and rename get_run_mode to get_handler_and_run_mode. Job.run_mode is now required. async def do_complete(self, code, cursor_pos) -> dict[str, Any]: do_history, do_inspect, do_is_complete, are all merged into the actual request handlers. * Improve RunMode Added Content (type) run_handler is now responsible for sending a reply. More docs. * Better kernel cleanup, no longer need tests.utils.clear_kernel. * Shift contextvars into utils notably, removing kernel.job. Add Kernel.concurrency_mode replacing get_handler_and_run_mode with get_run_mode and get_handler. Add more methods to utils. * Added all_concurrency_run_modes to Kernel. Rename 'direct' to 'blocking' and improve some documentation. Print some message when suppressing the error; added a metatakey 'suppress_error_message'. Added a sleep(0) to _stop_on_error_time to clear any waiting messages. * Update packages an lock file. * Provide default for socket * Update ci * Fix tests and coverage * Rename workflows.
1 parent 32008a2 commit 41c5ff9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+4583
-2693
lines changed

.github/workflows/ci.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: CI
2+
3+
on: [push]
4+
jobs:
5+
test:
6+
runs-on: ${{ matrix.os }}
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
os: [ubuntu-latest, windows-latest, macos-latest]
11+
python-version:
12+
- "3.11"
13+
- "3.12"
14+
- "3.13"
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v6
20+
with:
21+
version: "0.8.6"
22+
python-version: ${{ matrix.python-version }}
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Run tests
27+
timeout-minutes: 5
28+
run: uv run pytest -v
29+
30+
- name: Type checking with basedpyright
31+
run: uv run basedpyright
32+
33+
coverage:
34+
runs-on: ${{ matrix.os }}
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
os: [ubuntu-latest]
39+
python-version:
40+
- "3.12"
41+
- "3.13"
42+
steps:
43+
- uses: actions/checkout@v4
44+
45+
- name: Install uv
46+
uses: astral-sh/setup-uv@v6
47+
with:
48+
version: "0.8.6"
49+
python-version: ${{ matrix.python-version }}
50+
51+
- name: Run tests with coverage
52+
timeout-minutes: 5
53+
run: uv run pytest -vv --cov --cov-fail-under=100
54+
55+
pre-commit:
56+
runs-on: ubuntu-latest
57+
steps:
58+
- uses: actions/checkout@v3
59+
- uses: actions/setup-python@v4
60+
with:
61+
python-version: 3.x
62+
- uses: pre-commit/action@v3.0.1
63+
- uses: pre-commit-ci/lite-action@v1.1.0
64+
if: always()

.github/workflows/pre-commit.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/publish-docs.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish docs
2+
on:
3+
push:
4+
branches:
5+
- main
6+
permissions:
7+
contents: write
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Configure Git Credentials
14+
run: |
15+
git config user.name github-actions[bot]
16+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
17+
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v6
20+
with:
21+
version: "0.8.6"
22+
python-version: ${{ matrix.python-version }}
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Install the project
27+
run: uv sync --no-dev --group docs
28+
29+
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
30+
- uses: actions/cache@v4
31+
with:
32+
key: mkdocs-material-${{ env.cache_id }}
33+
path: ~/.cache
34+
restore-keys: |
35+
mkdocs-material-
36+
- run: mkdocs gh-deploy --force

.github/workflows/test.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,14 @@ MANIFEST
22
build
33
cover
44
dist
5+
site
56
_build
6-
docs/man/*.gz
7-
docs/source/api/generated
8-
docs/source/config/options
9-
docs/source/interactive/magics-generated.txt
10-
docs/gh-pages
11-
IPython/html/notebook/static/mathjax
12-
IPython/html/static/style/*.map
137
*.py[co]
148
__pycache__
159
*.egg-info
1610
*~
1711
*.bak
1812
.ipynb_checkpoints
19-
.tox
2013
.DS_Store
2114
\#*#
2215
.#*

.pre-commit-config.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ repos:
1414
- id: check-case-conflict
1515
- id: check-merge-conflict
1616
- id: check-toml
17+
- id: mixed-line-ending
1718
- id: check-yaml
19+
args: ["--unsafe"]
1820
- id: debug-statements
19-
exclude: async_kernel/kernel.py
2021
- id: end-of-file-fixer
21-
- id: trailing-whitespace
2222

2323
- repo: https://gitlab.com/bmares/check-json5
2424
rev: v1.0.0
2525
hooks:
2626
- id: check-json5
2727

2828
- repo: https://github.com/python-jsonschema/check-jsonschema
29-
rev: 0.33.2
29+
rev: 0.33.3
3030
hooks:
3131
- id: check-github-workflows
3232

@@ -35,7 +35,10 @@ repos:
3535
hooks:
3636
- id: mdformat
3737
additional_dependencies:
38-
[mdformat-gfm, mdformat-frontmatter, mdformat-footnote]
38+
- mdformat-gfm
39+
- mdformat-frontmatter
40+
- mdformat-footnote
41+
- mdformat-mkdocs
3942

4043
- repo: https://github.com/pre-commit/mirrors-prettier
4144
rev: "v4.0.0-alpha.8"
@@ -63,7 +66,7 @@ repos:
6366
- id: rst-inline-touching-normal
6467

6568
- repo: https://github.com/astral-sh/ruff-pre-commit
66-
rev: v0.12.8
69+
rev: v0.12.9
6770
hooks:
6871
- id: ruff
6972
types_or: [python, jupyter]

.vscode/settings.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,19 @@
44
"python.testing.pytestEnabled": true,
55
"python.analysis.typeCheckingMode": "off",
66
"editor.defaultFormatter": "charliermarsh.ruff",
7-
"basedpyright.analysis.diagnosticMode": "workspace"
7+
"basedpyright.analysis.diagnosticMode": "workspace",
8+
"yaml.schemas": {
9+
"https://squidfunk.github.io/mkdocs-material/schema.json": "mkdocs.yml"
10+
},
11+
"yaml.customTags": [
12+
"!ENV scalar",
13+
"!ENV sequence",
14+
"!relative scalar",
15+
"tag:yaml.org,2002:python/name:material.extensions.emoji.to_svg",
16+
"tag:yaml.org,2002:python/name:material.extensions.emoji.twemoji",
17+
"tag:yaml.org,2002:python/name:pymdownx.superfences.fence_code_format",
18+
"tag:yaml.org,2002:python/object/apply:pymdownx.slugs.slugify mapping"
19+
],
20+
"spellright.language": ["en"],
21+
"spellright.documentTypes": ["markdown", "latex", "plaintext"]
822
}

.vscode/spellright.dict

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
basedpyright
2+
uv
3+
Jupyter
4+
anyio
5+
asyncio
6+
zmq
7+
IPyKernel
8+
anyio's
9+
Asyc
10+
Jupyterlab

CHANGELOG.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Changes in IPython kernel
1+
# Changes in Async kernel
22

33
<!-- <START NEW CHANGELOG ENTRY> -->
44

55
## 0.0.0a1
66

77
([Full Changelog](<>))
88

9-
Kernel - Derived from an discontinued version branching from Ipython version 6.29.4.
9+
Kernel - Derived from an discontinued version branching from IPyKernel version 6.29.4.
1010

1111
### Enhancements made
1212

@@ -20,14 +20,14 @@ Kernel - Derived from an discontinued version branching from Ipython version 6.2
2020

2121
### Contributors to this release
2222

23-
<!-- ([GitHub contributors page for this release](https://github.com/ipython/ipykernel/graphs/contributors?from=2024-10-22&to=2025-03-07&type=c)) -->
23+
<!-- ([GitHub contributors page for this release](https://github.com/ipython/IPyKernel/graphs/contributors?from=2024-10-22&to=2025-03-07&type=c)) -->
2424

2525
<!-- <END NEW CHANGELOG ENTRY> -->
2626

2727
## 0.1.0a0
2828

2929
([Full Changelog](<>))
3030

31-
See Ipython [changelog](https://ipykernel.readthedocs.io/en/stable/changelog.html#id2) for all the hard work done to get here.
31+
See IPyKernel [changelog](https://ipykernel.readthedocs.io/en/stable/changelog.html#id2) for all the hard work done to get here.
3232

33-
Forked from IPykernel commit [#8322a7684b004ee95f07b2f86f61e28146a5996d](https://github.com/ipython/ipykernel/commit/8322a7684b004ee95f07b2f86f61e28146a5996d)
33+
Forked from IPyKernel commit [#8322a7684b004ee95f07b2f86f61e28146a5996d](https://github.com/ipython/ipykernel/commit/8322a7684b004ee95f07b2f86f61e28146a5996d)

0 commit comments

Comments
 (0)