async-kernel 0.19.0__tar.gz → 0.19.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {async_kernel-0.19.0 → async_kernel-0.19.1}/.github/workflows/ci.yml +4 -4
- {async_kernel-0.19.0 → async_kernel-0.19.1}/.github/workflows/new_release.yml +1 -1
- {async_kernel-0.19.0 → async_kernel-0.19.1}/.github/workflows/publish-docs.yml +1 -1
- {async_kernel-0.19.0 → async_kernel-0.19.1}/.github/workflows/publish-to-pypi.yml +1 -1
- {async_kernel-0.19.0 → async_kernel-0.19.1}/CHANGELOG.md +15 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/PKG-INFO +1 -1
- {async_kernel-0.19.0 → async_kernel-0.19.1}/_version.py +2 -2
- {async_kernel-0.19.0 → async_kernel-0.19.1}/hatch_build.py +6 -1
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/command.py +10 -11
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/kernelspec.py +8 -5
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/utils.py +10 -1
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/test_command.py +8 -16
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/test_kernelspec.py +5 -1
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/test_utils.py +4 -2
- {async_kernel-0.19.0 → async_kernel-0.19.1}/.github/dependabot.yaml +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/.github/release.yml +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/.github/workflows/enforce-label.yml +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/.github/workflows/pre-commit.yml +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/.gitignore +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/.pre-commit-config.yaml +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/.vscode/launch.json +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/.vscode/settings.json +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/.vscode/spellright.dict +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/CONTRIBUTING.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/IPYTHON_LICENSE +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/LICENSE +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/README.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/cliff.toml +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/about/changelog.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/about/contributing.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/about/index.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/about/license.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/index.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/javascripts/extra.js +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/notebooks/caller.ipynb +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/notebooks/concurrency.ipynb +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/notebooks/custom_kernel.ipynb +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/overrides/main.html +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/reference/caller.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/reference/comm.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/reference/command.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/reference/common.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/reference/debugger.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/reference/event_loop.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/reference/index.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/reference/interface.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/reference/ipshell.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/reference/kernel.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/reference/kernelspec.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/reference/pending.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/reference/shell.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/reference/typing.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/reference/utils.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/stylesheets/extra.css +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/thread_safety.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/usage/commands.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/docs/usage/index.md +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/mkdocs.yml +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/pyproject.toml +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/__init__.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/__main__.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/caller.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/comm.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/common.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/compat/attr_docs.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/compat/json.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/compiler.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/debugger.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/event_loop/__init__.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/event_loop/asyncio_guest.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/event_loop/qt_host.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/event_loop/run.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/event_loop/tk_host.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/interface/__init__.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/interface/base.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/interface/callable.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/interface/zmq.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/kernel.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/pending.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/py.typed +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/resources/logo-32x32.png +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/resources/logo-64x64.png +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/resources/logo-svg.svg +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/shell/__init__.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/shell/base.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/shell/ipshell.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/src/async_kernel/typing.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/__init__.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/conftest.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/references.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/test_base_interface.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/test_callable_interface.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/test_caller.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/test_comm.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/test_common.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/test_compat.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/test_debugger.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/test_debugger_static.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/test_enter_kernel.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/test_event_loop.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/test_iostream.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/test_kernel_ipshell.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/test_message_spec.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/test_pending.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/test_subclass.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/test_typing.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/test_zmq_interface.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/test_zmq_messaging.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/tests/utils.py +0 -0
- {async_kernel-0.19.0 → async_kernel-0.19.1}/uv.lock +0 -0
|
@@ -20,7 +20,7 @@ jobs:
|
|
|
20
20
|
fetch-depth: 0
|
|
21
21
|
|
|
22
22
|
- name: Install uv
|
|
23
|
-
uses: astral-sh/setup-uv@
|
|
23
|
+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
|
24
24
|
|
|
25
25
|
- name: Type checking with basedpyright
|
|
26
26
|
run: |
|
|
@@ -45,7 +45,7 @@ jobs:
|
|
|
45
45
|
uses: actions/checkout@v6
|
|
46
46
|
|
|
47
47
|
- name: Install uv
|
|
48
|
-
uses: astral-sh/setup-uv@
|
|
48
|
+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
|
49
49
|
with:
|
|
50
50
|
version-file: "pyproject.toml"
|
|
51
51
|
python-version: ${{ matrix.python-version }}
|
|
@@ -70,7 +70,7 @@ jobs:
|
|
|
70
70
|
fetch-depth: 0
|
|
71
71
|
|
|
72
72
|
- name: Install uv
|
|
73
|
-
uses: astral-sh/setup-uv@
|
|
73
|
+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
|
74
74
|
with:
|
|
75
75
|
version-file: "pyproject.toml"
|
|
76
76
|
python-version: "3.13"
|
|
@@ -99,7 +99,7 @@ jobs:
|
|
|
99
99
|
fetch-depth: 0
|
|
100
100
|
|
|
101
101
|
- name: Install uv
|
|
102
|
-
uses: astral-sh/setup-uv@
|
|
102
|
+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
|
103
103
|
with:
|
|
104
104
|
version-file: "pyproject.toml"
|
|
105
105
|
|
|
@@ -27,7 +27,7 @@ jobs:
|
|
|
27
27
|
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
|
28
28
|
|
|
29
29
|
- name: Install uv
|
|
30
|
-
uses: astral-sh/setup-uv@
|
|
30
|
+
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
|
31
31
|
with:
|
|
32
32
|
version-file: "pyproject.toml"
|
|
33
33
|
|
|
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.19.1] - 2026-05-26
|
|
9
|
+
|
|
10
|
+
### <!-- 2 --> 🐛 Fixes
|
|
11
|
+
|
|
12
|
+
- Support flags instead of boolean operational action argv syntax. [#475](https://github.com/fleming79/async-kernel/pull/475)
|
|
13
|
+
|
|
14
|
+
- Remove python verson from default kernelspec. [#474](https://github.com/fleming79/async-kernel/pull/474)
|
|
15
|
+
|
|
16
|
+
### <!-- 6 --> 🌀 Miscellaneous
|
|
17
|
+
|
|
18
|
+
- Bump setup-uv from v7 to v8.1.0. [#473](https://github.com/fleming79/async-kernel/pull/473)
|
|
19
|
+
|
|
8
20
|
## [0.19.0] - 2026-05-26
|
|
9
21
|
|
|
10
22
|
### <!-- 0 --> 🏗️ Breaking changes
|
|
@@ -21,6 +33,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
21
33
|
|
|
22
34
|
### <!-- 6 --> 🌀 Miscellaneous
|
|
23
35
|
|
|
36
|
+
- Prepare for release v0.19.0 [#472](https://github.com/fleming79/async-kernel/pull/472)
|
|
37
|
+
|
|
24
38
|
- Bump uv and basedpyright [#470](https://github.com/fleming79/async-kernel/pull/470)
|
|
25
39
|
|
|
26
40
|
- Add message to task.cancel in task_factory [#461](https://github.com/fleming79/async-kernel/pull/461)
|
|
@@ -1309,6 +1323,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
1309
1323
|
|
|
1310
1324
|
- Bump the actions group across 1 directory with 2 updates [#3](https://github.com/fleming79/async-kernel/pull/3)
|
|
1311
1325
|
|
|
1326
|
+
[0.19.1]: https://github.com/fleming79/async-kernel/compare/v0.19.0..v0.19.1
|
|
1312
1327
|
[0.19.0]: https://github.com/fleming79/async-kernel/compare/v0.18.3..v0.19.0
|
|
1313
1328
|
[0.18.3]: https://github.com/fleming79/async-kernel/compare/v0.18.2..v0.18.3
|
|
1314
1329
|
[0.18.2]: https://github.com/fleming79/async-kernel/compare/v0.18.1..v0.18.2
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: async-kernel
|
|
3
|
-
Version: 0.19.
|
|
3
|
+
Version: 0.19.1
|
|
4
4
|
Summary: A concurrent python kernel for Jupyter supporting AnyIO, AsyncIO and Trio.
|
|
5
5
|
Project-URL: Homepage, https://fleming79.github.io/async-kernel
|
|
6
6
|
Project-URL: Documentation, https://fleming79.github.io/async-kernel
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '0.19.
|
|
22
|
-
__version_tuple__ = version_tuple = (0, 19,
|
|
21
|
+
__version__ = version = '0.19.1'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 19, 1)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -22,4 +22,9 @@ class CustomHook(BuildHookInterface):
|
|
|
22
22
|
|
|
23
23
|
name = "async"
|
|
24
24
|
spec_folder = here.joinpath("data_kernelspec", name)
|
|
25
|
-
write_kernel_spec(
|
|
25
|
+
write_kernel_spec(
|
|
26
|
+
path=spec_folder,
|
|
27
|
+
name=name,
|
|
28
|
+
command=("python", "-m", "async_kernel", "start"),
|
|
29
|
+
display_name=f"Python 3 ({name})",
|
|
30
|
+
)
|
|
@@ -21,17 +21,16 @@ if TYPE_CHECKING:
|
|
|
21
21
|
__all__ = ["command_line"]
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
def
|
|
24
|
+
def to_flags_and_settings(args: list[str]) -> tuple[list[str], dict[str, Any]]:
|
|
25
25
|
"""
|
|
26
|
-
Convert `argvs` to
|
|
26
|
+
Convert `argvs` to flags and settings.
|
|
27
27
|
|
|
28
28
|
Args:
|
|
29
29
|
args: A list of arguments, the first of which must start with '-' or '--'.
|
|
30
30
|
|
|
31
31
|
Notes:
|
|
32
32
|
- There is no distinction made between '-' and '--'.
|
|
33
|
-
- Flags
|
|
34
|
-
|
|
33
|
+
- Flags are returned without '--' prefix.
|
|
35
34
|
"""
|
|
36
35
|
|
|
37
36
|
def safe_eval(val: str) -> Any:
|
|
@@ -43,7 +42,7 @@ def args_to_dict(args: list[str]) -> dict[str, Any]:
|
|
|
43
42
|
def add(k: str, v: Any) -> None:
|
|
44
43
|
settings[k.strip()] = safe_eval(v)
|
|
45
44
|
|
|
46
|
-
settings = {}
|
|
45
|
+
flags, settings = [], {}
|
|
47
46
|
args = list(args)
|
|
48
47
|
while args:
|
|
49
48
|
k = args.pop(0)
|
|
@@ -61,11 +60,10 @@ def args_to_dict(args: list[str]) -> dict[str, Any]:
|
|
|
61
60
|
v = settings.get(k, {}) | {a: safe_eval(v)}
|
|
62
61
|
add(k, v)
|
|
63
62
|
else:
|
|
64
|
-
add(k, v)
|
|
63
|
+
add(k, safe_eval(v))
|
|
65
64
|
else:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return settings
|
|
65
|
+
flags.append(k)
|
|
66
|
+
return flags, settings
|
|
69
67
|
|
|
70
68
|
|
|
71
69
|
def command_line() -> None:
|
|
@@ -189,11 +187,11 @@ Tips:
|
|
|
189
187
|
mode = mode_
|
|
190
188
|
break
|
|
191
189
|
|
|
192
|
-
settings =
|
|
190
|
+
flags, settings = to_flags_and_settings(unknownargs)
|
|
193
191
|
|
|
194
192
|
match mode:
|
|
195
193
|
case Mode.install:
|
|
196
|
-
path = write_kernel_spec(user=args.user, name=args.name, **settings)
|
|
194
|
+
path = write_kernel_spec(user=args.user, name=args.name, flags=flags, **settings)
|
|
197
195
|
print(f"Installed kernelspec {str(path)!r}")
|
|
198
196
|
|
|
199
197
|
case Mode.uninstall:
|
|
@@ -224,6 +222,7 @@ Tips:
|
|
|
224
222
|
print("async-kernel", async_kernel.__version__)
|
|
225
223
|
case Mode.start | Mode.help_all | Mode.show_config | Mode.show_config_json:
|
|
226
224
|
launcher: InterfaceStartType = import_launcher(settings.get("launcher", ""))
|
|
225
|
+
settings["--flags"] = flags
|
|
227
226
|
try:
|
|
228
227
|
launcher(settings)
|
|
229
228
|
except KeyboardInterrupt:
|
|
@@ -12,7 +12,7 @@ from pathlib import Path
|
|
|
12
12
|
from typing import TYPE_CHECKING, Any
|
|
13
13
|
|
|
14
14
|
if TYPE_CHECKING:
|
|
15
|
-
from collections.abc import Callable
|
|
15
|
+
from collections.abc import Callable, Iterable
|
|
16
16
|
|
|
17
17
|
InterfaceStartType = Callable[[dict[str, Any]], Any]
|
|
18
18
|
|
|
@@ -49,6 +49,7 @@ def make_argv(
|
|
|
49
49
|
name: str = "async",
|
|
50
50
|
launcher: str | InterfaceStartType = DEFAULT_LAUNCHER,
|
|
51
51
|
command: tuple[str, ...] = DEFAULT_COMMAND,
|
|
52
|
+
flags: Iterable[str] = (),
|
|
52
53
|
**kwargs: Any,
|
|
53
54
|
) -> list[str]:
|
|
54
55
|
"""Returns an argument vector (argv) that can be used to start a `Kernel`.
|
|
@@ -68,15 +69,13 @@ def make_argv(
|
|
|
68
69
|
- "start_kernel_zmq_interface"
|
|
69
70
|
name: The name to use for the kernel.
|
|
70
71
|
command: The command line command to call.
|
|
72
|
+
flags: Any number of flags to insert in argv. Flags will be prefixed with '--'.
|
|
71
73
|
**kwargs: Additional settings to pass when creating the kernel passed to `launcher`.
|
|
72
74
|
|
|
73
75
|
Returns:
|
|
74
76
|
list: A list of command-line arguments to launch the kernel module.
|
|
75
77
|
"""
|
|
76
|
-
argv = [
|
|
77
|
-
*command,
|
|
78
|
-
f"--connection_file={connection_file}",
|
|
79
|
-
]
|
|
78
|
+
argv = [*command, f"--connection_file={connection_file}", *(f"--{f.strip('-')}" for f in flags)]
|
|
80
79
|
for k, v in ({"launcher": launcher, "name": name} | kwargs).items():
|
|
81
80
|
argv.append(f"--{k}={v}")
|
|
82
81
|
return list(map(str, argv))
|
|
@@ -125,6 +124,7 @@ def write_kernel_spec(
|
|
|
125
124
|
metadata: dict | None = None,
|
|
126
125
|
language="python",
|
|
127
126
|
resources: Path | None = RESOURCES,
|
|
127
|
+
flags: Iterable[str] = (),
|
|
128
128
|
**kwargs: Any,
|
|
129
129
|
) -> Path:
|
|
130
130
|
"""
|
|
@@ -157,6 +157,8 @@ def write_kernel_spec(
|
|
|
157
157
|
A mapping of additional attributes to aid the client in kernel selection.
|
|
158
158
|
resources:
|
|
159
159
|
The path to the resources folder to include with the kernel spec.
|
|
160
|
+
flags:
|
|
161
|
+
Flags to insert directly into the argv string.
|
|
160
162
|
**kwargs:
|
|
161
163
|
Pass additional settings to set on the instance of the `Kernel` when it is instantiated.
|
|
162
164
|
Each setting should correspond to the dotted path to the attribute relative to the kernel.
|
|
@@ -194,6 +196,7 @@ def write_kernel_spec(
|
|
|
194
196
|
connection_file=connection_file,
|
|
195
197
|
name=name,
|
|
196
198
|
command=command,
|
|
199
|
+
flags=flags,
|
|
197
200
|
**kwargs,
|
|
198
201
|
)
|
|
199
202
|
spec: dict[str, list[Any] | Any | dict[Any, Any] | str | dict[str, bool]] = {
|
|
@@ -207,10 +207,19 @@ def apply_settings(obj: object, settings: Mapping[str, Any]) -> dict[str, Any]:
|
|
|
207
207
|
|
|
208
208
|
Returns:
|
|
209
209
|
dict: A copy of the settings that were applied.
|
|
210
|
+
|
|
211
|
+
Notes:
|
|
212
|
+
- If flags are included using the pattern `'--flags': iterable(str)`, the flags
|
|
213
|
+
are interpreted as boolean values. Generally, it is preferred to specify
|
|
214
|
+
the value in the settings explicitly.
|
|
210
215
|
"""
|
|
211
216
|
values = {}
|
|
212
217
|
for k, v in settings.items():
|
|
213
|
-
|
|
218
|
+
if k == "--flags" and v:
|
|
219
|
+
for flag in (f.strip("-") for f in v):
|
|
220
|
+
values.update(setattr_nested(obj, flag.strip("no-"), not flag.startswith("no-")))
|
|
221
|
+
else:
|
|
222
|
+
values.update(setattr_nested(obj, k, v))
|
|
214
223
|
return values
|
|
215
224
|
|
|
216
225
|
|
|
@@ -15,7 +15,7 @@ from typing_extensions import override
|
|
|
15
15
|
|
|
16
16
|
import async_kernel
|
|
17
17
|
from async_kernel import Kernel
|
|
18
|
-
from async_kernel.command import
|
|
18
|
+
from async_kernel.command import command_line, to_flags_and_settings
|
|
19
19
|
from async_kernel.interface.zmq import ZMQInterface
|
|
20
20
|
from async_kernel.kernelspec import make_argv
|
|
21
21
|
from async_kernel.typing import Backend, Hosts
|
|
@@ -46,30 +46,28 @@ def fake_kernel_dir(tmp_path, monkeypatch):
|
|
|
46
46
|
|
|
47
47
|
def test_args_to_dict():
|
|
48
48
|
unknown_args = [
|
|
49
|
+
"--quiet",
|
|
49
50
|
"--display_name='my kernel'",
|
|
50
51
|
"--dict_value",
|
|
51
52
|
"option_A=False",
|
|
52
53
|
"--dict_value",
|
|
53
54
|
"Some other value='142'",
|
|
54
55
|
"--launcher=start_kernel_zmq_interface",
|
|
55
|
-
"--
|
|
56
|
-
"--shell.timeout",
|
|
56
|
+
"--timeout",
|
|
57
57
|
"2",
|
|
58
|
-
"-quiet",
|
|
59
58
|
"--automagic",
|
|
60
|
-
"--
|
|
59
|
+
"--debug",
|
|
61
60
|
]
|
|
62
|
-
settings =
|
|
61
|
+
flags, settings = to_flags_and_settings(unknown_args)
|
|
62
|
+
assert flags == ["quiet", "automagic", "debug"]
|
|
63
63
|
assert settings == {
|
|
64
64
|
"display_name": "my kernel",
|
|
65
65
|
"dict_value": {"option_A": False, "Some other value": "142"},
|
|
66
66
|
"launcher": "start_kernel_zmq_interface",
|
|
67
|
-
"
|
|
68
|
-
"quiet": True,
|
|
69
|
-
"automagic": False,
|
|
67
|
+
"timeout": 2,
|
|
70
68
|
}
|
|
71
69
|
with pytest.raises(ValueError, match="Invalid arg detected"):
|
|
72
|
-
|
|
70
|
+
to_flags_and_settings(["no-prefix"])
|
|
73
71
|
|
|
74
72
|
|
|
75
73
|
def test_prints_help_when_no_args(monkeypatch, capsys):
|
|
@@ -177,12 +175,6 @@ def test_remove_kernelspec(monkeypatch, fake_kernel_dir, capsys, mode: Literal["
|
|
|
177
175
|
assert not (kernel_dir).exists()
|
|
178
176
|
|
|
179
177
|
|
|
180
|
-
# def test_remove_nonexistent_kernel(monkeypatch, fake_kernel_dir, capsys):
|
|
181
|
-
# monkeypatch.setattr(sys, "argv", ["prog", "uninstall", "--name='not a kernel'"])
|
|
182
|
-
# with pytest.raises(FileNotFoundError, match="A kernelspec does not exist"):
|
|
183
|
-
# command_line()
|
|
184
|
-
|
|
185
|
-
|
|
186
178
|
@pytest.mark.parametrize("config", ["--user", "-no-user", "--prefix=this$won't^work"])
|
|
187
179
|
def test_list(monkeypatch, config: str, capsys):
|
|
188
180
|
monkeypatch.setattr(sys, "argv", ["prog", "-l", config])
|
|
@@ -23,7 +23,9 @@ def test_install_kernel_spec(tmp_path: Path, monkeypatch):
|
|
|
23
23
|
kernel_path = tmp_path.joinpath("kernels", name)
|
|
24
24
|
|
|
25
25
|
command = ("python", "-m", "async_kernel", "start")
|
|
26
|
-
assert
|
|
26
|
+
assert (
|
|
27
|
+
write_kernel_spec(path=kernel_path, command=command, name=name, flags=("--debug", "--no-quiet")) == kernel_path
|
|
28
|
+
)
|
|
27
29
|
kernel_json = kernel_path.joinpath("kernel.json")
|
|
28
30
|
assert kernel_json.exists()
|
|
29
31
|
|
|
@@ -36,6 +38,8 @@ def test_install_kernel_spec(tmp_path: Path, monkeypatch):
|
|
|
36
38
|
"async_kernel",
|
|
37
39
|
"start",
|
|
38
40
|
"--connection_file={connection_file}",
|
|
41
|
+
"--debug",
|
|
42
|
+
"--no-quiet",
|
|
39
43
|
"--launcher=launch_zmq_interface",
|
|
40
44
|
f"--name={name}",
|
|
41
45
|
],
|
|
@@ -107,12 +107,14 @@ class TestUtils:
|
|
|
107
107
|
k = traitlets.Int()
|
|
108
108
|
nested = traitlets.Instance(traitlets.HasTraits)
|
|
109
109
|
nested_with_default = traitlets.Instance(cast("type[TestObj]", traitlets.HasTraits))
|
|
110
|
+
b1 = traitlets.Bool(False)
|
|
111
|
+
b2 = traitlets.Bool(True)
|
|
110
112
|
|
|
111
113
|
@traitlets.default("nested_with_default")
|
|
112
114
|
def _default_nested_with_default(self):
|
|
113
115
|
return TestObj()
|
|
114
116
|
|
|
115
117
|
test_obj = TestObj()
|
|
116
|
-
settings = {"k": 10, "nested_with_default.k": 20}
|
|
118
|
+
settings = {"k": 10, "nested_with_default.k": 20, "--flags": ["b1", "no-b2"]}
|
|
117
119
|
val = ak_utils.apply_settings(test_obj, settings)
|
|
118
|
-
assert val ==
|
|
120
|
+
assert val == {"k": 10, "nested_with_default.k": 20, "b1": True, "b2": False}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|