Skip to content

Commit

Permalink
Add notebook language metadata to types
Browse files Browse the repository at this point in the history
  • Loading branch information
flying-sheep committed Nov 29, 2023
1 parent 9729de3 commit 3c8a32b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
"[jsonc][yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
},
"python.analysis.typeCheckingMode": "basic",
"python.analysis.typeCheckingMode": "strict",
"python.testing.pytestEnabled": true,
}
22 changes: 21 additions & 1 deletion src/prelude_runner/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,37 @@ class Stream(Protocol):
text: str


class CodeCell(Cell):
class CodeCell(Cell, Protocol):
"""A code cell."""

cell_type: Literal["code"]
# TODO: add other output types # noqa: TD003
outputs: list[Stream | Any]


class KernelSpec(TypedDict):
"""Kernel specification metadata."""

name: str
language: str
display_name: str


class LanguageInfo(TypedDict):
"""Language metadata."""

name: str
version: str
mimetype: str
file_extension: str
codemirror_mode: dict[str, str]
pygments_lexer: str


class NotebookMetadata(TypedDict):
"""Common metadata for all notebooks."""

kernelspec: KernelSpec
language_info: dict[str, str]


Expand Down

0 comments on commit 3c8a32b

Please sign in to comment.