ipymini 0.1.26__tar.gz → 0.1.28__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.
- {ipymini-0.1.26 → ipymini-0.1.28}/PKG-INFO +2 -2
- {ipymini-0.1.26 → ipymini-0.1.28}/ipymini/__init__.py +3 -1
- {ipymini-0.1.26 → ipymini-0.1.28}/ipymini/term/display.py +27 -9
- {ipymini-0.1.26 → ipymini-0.1.28}/ipymini/term/ipython_capture.py +1 -2
- {ipymini-0.1.26 → ipymini-0.1.28}/ipymini.egg-info/PKG-INFO +2 -2
- {ipymini-0.1.26 → ipymini-0.1.28}/ipymini.egg-info/requires.txt +1 -1
- {ipymini-0.1.26 → ipymini-0.1.28}/pyproject.toml +1 -1
- {ipymini-0.1.26 → ipymini-0.1.28}/LICENSE +0 -0
- {ipymini-0.1.26 → ipymini-0.1.28}/README.md +0 -0
- {ipymini-0.1.26 → ipymini-0.1.28}/ipymini/__main__.py +0 -0
- {ipymini-0.1.26 → ipymini-0.1.28}/ipymini/debug/__init__.py +0 -0
- {ipymini-0.1.26 → ipymini-0.1.28}/ipymini/debug/cells.py +0 -0
- {ipymini-0.1.26 → ipymini-0.1.28}/ipymini/debug/dap.py +0 -0
- {ipymini-0.1.26 → ipymini-0.1.28}/ipymini/kernel.py +0 -0
- {ipymini-0.1.26 → ipymini-0.1.28}/ipymini/shell/__init__.py +0 -0
- {ipymini-0.1.26 → ipymini-0.1.28}/ipymini/shell/comms.py +0 -0
- {ipymini-0.1.26 → ipymini-0.1.28}/ipymini/shell/ops.py +0 -0
- {ipymini-0.1.26 → ipymini-0.1.28}/ipymini/shell/shell.py +0 -0
- {ipymini-0.1.26 → ipymini-0.1.28}/ipymini/shell/sighelp.py +0 -0
- {ipymini-0.1.26 → ipymini-0.1.28}/ipymini/term/__init__.py +0 -0
- {ipymini-0.1.26 → ipymini-0.1.28}/ipymini/term/io.py +0 -0
- {ipymini-0.1.26 → ipymini-0.1.28}/ipymini/term/streams.py +0 -0
- {ipymini-0.1.26 → ipymini-0.1.28}/ipymini.egg-info/SOURCES.txt +0 -0
- {ipymini-0.1.26 → ipymini-0.1.28}/ipymini.egg-info/dependency_links.txt +0 -0
- {ipymini-0.1.26 → ipymini-0.1.28}/ipymini.egg-info/entry_points.txt +0 -0
- {ipymini-0.1.26 → ipymini-0.1.28}/ipymini.egg-info/top_level.txt +0 -0
- {ipymini-0.1.26 → ipymini-0.1.28}/setup.cfg +0 -0
- {ipymini-0.1.26 → ipymini-0.1.28}/setup.py +0 -0
- {ipymini-0.1.26 → ipymini-0.1.28}/share/jupyter/kernels/py/kernel.json +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ipymini
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.28
|
|
4
4
|
Summary: A small, readable Jupyter kernel for Python with strong IPython parity.
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
7
|
License-File: LICENSE
|
|
8
8
|
Requires-Dist: comm>=0.2.3
|
|
9
|
-
Requires-Dist: fastcore>=2.2.
|
|
9
|
+
Requires-Dist: fastcore>=2.2.37
|
|
10
10
|
Requires-Dist: ipython>=8.18
|
|
11
11
|
Requires-Dist: kernmini>=0.1.23
|
|
12
12
|
Provides-Extra: dev
|
|
@@ -1,22 +1,40 @@
|
|
|
1
1
|
import contextvars, sys
|
|
2
2
|
|
|
3
|
+
from pathlib import PurePath
|
|
3
4
|
from IPython.core.displayhook import DisplayHook
|
|
4
5
|
from IPython.core.displaypub import DisplayPublisher
|
|
6
|
+
from IPython.core.formatters import DisplayFormatter
|
|
7
|
+
from IPython.display import DisplayObject, TextDisplayObject
|
|
8
|
+
from fastcore.basics import patch
|
|
9
|
+
from fastcore.xtras import truncstr
|
|
5
10
|
|
|
6
11
|
|
|
7
12
|
def full_metadata(obj, metadata):
|
|
8
13
|
return {**metadata, "full": True} if getattr(obj, "full", False) else metadata
|
|
9
14
|
|
|
10
15
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
_previous_format = DisplayFormatter.format
|
|
17
|
+
|
|
18
|
+
@patch
|
|
19
|
+
def format(self:DisplayFormatter, obj, include=None, exclude=None):
|
|
20
|
+
data,meta = _previous_format(self, obj, include=include, exclude=exclude)
|
|
21
|
+
return data,full_metadata(obj, meta)
|
|
22
|
+
|
|
23
|
+
@patch
|
|
24
|
+
def __repr__(self:DisplayObject):
|
|
25
|
+
s = self.data or self.url or self.filename
|
|
26
|
+
if s is None: return object.__repr__(self)
|
|
27
|
+
return f"{type(self).__name__}({s if isinstance(s, str) else truncstr(str(s), 30)})"
|
|
28
|
+
|
|
29
|
+
# IPython's `DisplayObject.__init__` fetches `data` as a URL when it starts with `http`, and loads it as a file when one of that name exists
|
|
30
|
+
@patch
|
|
31
|
+
def __init__(self:TextDisplayObject, data=None, url=None, filename=None, metadata=None):
|
|
32
|
+
if isinstance(data, PurePath): data = str(data)
|
|
33
|
+
self.url,self.filename,self.data = url,filename,data
|
|
34
|
+
if metadata is not None: self.metadata = metadata
|
|
35
|
+
elif self.metadata is None: self.metadata = {}
|
|
36
|
+
self.reload()
|
|
37
|
+
self._check_data()
|
|
20
38
|
|
|
21
39
|
|
|
22
40
|
class MiniDisplayPublisher(DisplayPublisher):
|
|
@@ -2,7 +2,7 @@ import contextvars, logging
|
|
|
2
2
|
from contextlib import contextmanager
|
|
3
3
|
from typing import Callable
|
|
4
4
|
|
|
5
|
-
from .display import MiniDisplayHook, MiniDisplayPublisher
|
|
5
|
+
from .display import MiniDisplayHook, MiniDisplayPublisher
|
|
6
6
|
from .io import thread_local_io
|
|
7
7
|
from .streams import MiniStream, coalesce_streams
|
|
8
8
|
|
|
@@ -12,7 +12,6 @@ log = logging.getLogger("ipymini.term")
|
|
|
12
12
|
class IPythonCapture:
|
|
13
13
|
def __init__(self, shell, request_input: Callable[[str, bool], str]):
|
|
14
14
|
self.shell = shell
|
|
15
|
-
enable_full_metadata(shell.display_formatter)
|
|
16
15
|
self.request_input = request_input
|
|
17
16
|
self.display_sender = None
|
|
18
17
|
self.display_live = contextvars.ContextVar("ipymini.display_live", default=False)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ipymini
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.28
|
|
4
4
|
Summary: A small, readable Jupyter kernel for Python with strong IPython parity.
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
7
7
|
License-File: LICENSE
|
|
8
8
|
Requires-Dist: comm>=0.2.3
|
|
9
|
-
Requires-Dist: fastcore>=2.2.
|
|
9
|
+
Requires-Dist: fastcore>=2.2.37
|
|
10
10
|
Requires-Dist: ipython>=8.18
|
|
11
11
|
Requires-Dist: kernmini>=0.1.23
|
|
12
12
|
Provides-Extra: dev
|
|
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
|