-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
When running beaker in Python3.10 with the latest version of archytas and the contexts from askem-beaker, there are errors in the newish utils.py/type_to_str() function.
Initially it fails due to the usage of a type of Union without a type argument.
│ /home/matt/tmp/type-string-error/lib/python3.10/site-packages/archytas/utils.py:59 in │
│ type_to_str │
│ │
│ 56 │ elif t is None: │
│ 57 │ │ return "None" │
│ 58 │ else: │
│ ❱ 59 │ │ raise ValueError(f"Unsupported type {t}") │
│ 60 │
│ │
│ ╭───── locals ─────╮ │
│ │ t = typing.Union │
If we fix that, either by fixing the project or surpressing the error in the function, we see the bigger issue.
New versions of Python are internally representing Optional[str] as str | None so any usage of Optional throws an error as the strings don't match.
The type string need to be normalized somehow before being compared.
Steps to reproduce:
- Download the attached askem-beaker wheel file
askem_beaker-1.2.2.zip - Create a virtualenv and install the specific versions we need to test:
pip install archytas==1.2.1 beaker-kernel==1.7.2 ./askem_beaker-1.2.2-py3-none-any.whl - Run beaker notebook in local mode in a terminal:
beaker notebook
(type-string-error) matt@mavis:~/tmp$ beaker notebook
[I 2024-10-29 11:37:48.348 BeakerServerApp] beaker_kernel.server.main | extension was successfully linked.
...
[I 2024-10-29 11:37:48.527 BeakerServerApp] Serving notebooks from local directory: /home/matt/tmp
[I 2024-10-29 11:37:48.528 BeakerServerApp] Jupyter Server 2.14.2 is running at:
[I 2024-10-29 11:37:48.528 BeakerServerApp] http://localhost:8888/
[I 2024-10-29 11:37:48.528 BeakerServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
- Open the page in the console output (probably http://localhost:8888/ but port may change if 8888 is in use)
- As soon as the page loads, you should start seeing the errors in the console. Press Ctrl-C in the console to exit.
I 2024-10-29 11:37:55.685 BeakerServerApp] Kernel started: 2b42ea86-9f74-4306-99c9-bc7f08bede80
Warning: The usage of the @toolset decorator is deprecated and the decorator will be removed in a future version.
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /usr/lib/python3.10/runpy.py:196 in _run_module_as_main │
│ │
│ 193 │ main_globals = sys.modules["__main__"].__dict__ │
...
- All contexts are checked for validity on each initial connection.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels