nbcat 0.13.0__py3-none-any.whl → 0.13.1__py3-none-any.whl
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.
- nbcat/__init__.py +1 -1
- nbcat/main.py +2 -1
- nbcat/markdown.py +11 -10
- {nbcat-0.13.0.dist-info → nbcat-0.13.1.dist-info}/METADATA +4 -1
- nbcat-0.13.1.dist-info/RECORD +14 -0
- nbcat-0.13.0.dist-info/RECORD +0 -14
- {nbcat-0.13.0.dist-info → nbcat-0.13.1.dist-info}/WHEEL +0 -0
- {nbcat-0.13.0.dist-info → nbcat-0.13.1.dist-info}/entry_points.txt +0 -0
- {nbcat-0.13.0.dist-info → nbcat-0.13.1.dist-info}/licenses/LICENSE +0 -0
nbcat/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.13.
|
1
|
+
__version__ = "0.13.1"
|
nbcat/main.py
CHANGED
@@ -5,6 +5,7 @@ from pathlib import Path
|
|
5
5
|
import argcomplete
|
6
6
|
import requests
|
7
7
|
from argcomplete.completers import FilesCompleter
|
8
|
+
from markdownify import markdownify
|
8
9
|
from pydantic import ValidationError
|
9
10
|
from rich.console import Console, Group, RenderableType
|
10
11
|
from rich.padding import Padding
|
@@ -85,7 +86,7 @@ def render_cell(cell: Cell) -> RenderableType:
|
|
85
86
|
"""
|
86
87
|
|
87
88
|
def _render_markdown(input: str) -> Markdown:
|
88
|
-
return Markdown(input, code_theme="ansi_dark")
|
89
|
+
return Markdown(markdownify(input), code_theme="ansi_dark")
|
89
90
|
|
90
91
|
def _render_code(input: str, language: str = "python") -> Syntax:
|
91
92
|
return Syntax(input, language, theme="ansi_dark", padding=(1, 2), dedent=True)
|
nbcat/markdown.py
CHANGED
@@ -41,16 +41,17 @@ class ImageItem(md.ImageItem):
|
|
41
41
|
def __rich_console__(self, console: Console, options: ConsoleOptions) -> RenderResult:
|
42
42
|
image_content = None
|
43
43
|
path = Path(self.destination)
|
44
|
-
if path.
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
44
|
+
if path.suffix in [".png", ".jpeg", ".jpg"]:
|
45
|
+
if path.exists():
|
46
|
+
image_content = path.read_bytes()
|
47
|
+
elif self.destination.startswith("http://") or self.destination.startswith("https://"):
|
48
|
+
try:
|
49
|
+
with requests.Session() as req:
|
50
|
+
res = req.get(self.destination, timeout=5)
|
51
|
+
res.raise_for_status()
|
52
|
+
image_content = res.content
|
53
|
+
except requests.RequestException:
|
54
|
+
return super().__rich_console__(console, options)
|
54
55
|
if image_content:
|
55
56
|
# TODO: This part can be improved by changing Image class to accept file objects
|
56
57
|
image = base64.b64encode(image_content).decode("utf-8")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: nbcat
|
3
|
-
Version: 0.13.
|
3
|
+
Version: 0.13.1
|
4
4
|
Summary: cat for jupyter notebooks
|
5
5
|
Project-URL: Homepage, https://github.com/akopdev/nbcat
|
6
6
|
Project-URL: Repository, https://github.com/akopdev/nbcat
|
@@ -30,6 +30,7 @@ License: MIT License
|
|
30
30
|
License-File: LICENSE
|
31
31
|
Requires-Python: >=3.9
|
32
32
|
Requires-Dist: argcomplete
|
33
|
+
Requires-Dist: markdownify
|
33
34
|
Requires-Dist: pydantic
|
34
35
|
Requires-Dist: requests
|
35
36
|
Requires-Dist: rich
|
@@ -49,6 +50,7 @@ Description-Content-Type: text/markdown
|
|
49
50
|
|
50
51
|
<p align="center">
|
51
52
|
<a href="docs/screenshot.png" target="blank"><img src="docs/screenshot.png" width="400" /></a>
|
53
|
+
<a href="docs/screenshot2.png" target="blank"><img src="docs/screenshot2.png" width="400" /></a>
|
52
54
|
</p>
|
53
55
|
|
54
56
|
## Features
|
@@ -56,6 +58,7 @@ Description-Content-Type: text/markdown
|
|
56
58
|
- Very fast and lightweight with minimal dependencies.
|
57
59
|
- Preview remote notebooks without downloading them.
|
58
60
|
- Enable paginated view mode with keyboard navigation (similar to `less`).
|
61
|
+
- Supports image rendering (some protocols in beta)
|
59
62
|
- Supports for all Jupyter notebook versions, including old legacy formats.
|
60
63
|
|
61
64
|
## Motivation
|
@@ -0,0 +1,14 @@
|
|
1
|
+
nbcat/__init__.py,sha256=Zg3oo58_HXe_ieb_PwWnYkKGH2zTvu6G2jly-7GnPGo,23
|
2
|
+
nbcat/enums.py,sha256=Fn8PIcLl_uY4nQIs1EUvmKTwfhNUIZgmhRFiCSJk9wk,411
|
3
|
+
nbcat/exceptions.py,sha256=Ho7LQz9K70VtIMDNtAwuAtGmb-lFKxGxSj7MN3-EpDA,321
|
4
|
+
nbcat/image.py,sha256=hGZZK5mtij7ckWAvQwzim3thqGC92pLW5ZU5CYbRv_Q,995
|
5
|
+
nbcat/main.py,sha256=pTOt0Kt7WJqf7H--JmXtvBgFJG-bBu6WsBG4KFl9wAE,6727
|
6
|
+
nbcat/markdown.py,sha256=fbYBy36rR0SKqvNI6Yj75Xv2snwFRmhbCJIC1wCX2Hg,3055
|
7
|
+
nbcat/pager.py,sha256=Yu0XIh5MvhvT-cmULYVxo6s2Ufjf2CQ-NDS5fcMQ-IM,3184
|
8
|
+
nbcat/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
|
+
nbcat/schemas.py,sha256=a7GoKgPTHgun199-J-sZq-ahkdQwvyRaCdQVg1gC798,3135
|
10
|
+
nbcat-0.13.1.dist-info/METADATA,sha256=qU0l9XpIN1Beqb3sI5-1s4UvHjSgHHTDFp05RAu9fZc,4443
|
11
|
+
nbcat-0.13.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
12
|
+
nbcat-0.13.1.dist-info/entry_points.txt,sha256=io_GRDsecAkYuCZALsjyea3VBq91VCoSznqlZEAJshY,42
|
13
|
+
nbcat-0.13.1.dist-info/licenses/LICENSE,sha256=7GjUnahXdd5opdvlpJdb1BisLbiXt2iOFhzIUduhdkE,1072
|
14
|
+
nbcat-0.13.1.dist-info/RECORD,,
|
nbcat-0.13.0.dist-info/RECORD
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
nbcat/__init__.py,sha256=DgpLNbv0e1LIEOOe54Db8_390i9pelMEFEnsBsNmyhA,23
|
2
|
-
nbcat/enums.py,sha256=Fn8PIcLl_uY4nQIs1EUvmKTwfhNUIZgmhRFiCSJk9wk,411
|
3
|
-
nbcat/exceptions.py,sha256=Ho7LQz9K70VtIMDNtAwuAtGmb-lFKxGxSj7MN3-EpDA,321
|
4
|
-
nbcat/image.py,sha256=hGZZK5mtij7ckWAvQwzim3thqGC92pLW5ZU5CYbRv_Q,995
|
5
|
-
nbcat/main.py,sha256=FSXD7SobpjhwDvOKAS1C-Lntmv9mPJhDUugjq8dBzAA,6678
|
6
|
-
nbcat/markdown.py,sha256=GkPNfzBhNLMl89pVcj14U6ytYUVk3yNB0G1zGYRRJ04,2962
|
7
|
-
nbcat/pager.py,sha256=Yu0XIh5MvhvT-cmULYVxo6s2Ufjf2CQ-NDS5fcMQ-IM,3184
|
8
|
-
nbcat/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
|
-
nbcat/schemas.py,sha256=a7GoKgPTHgun199-J-sZq-ahkdQwvyRaCdQVg1gC798,3135
|
10
|
-
nbcat-0.13.0.dist-info/METADATA,sha256=rspE5gM8qznr1ZNL9REUdPBJho1QRlDRcXSTl2ngSH8,4265
|
11
|
-
nbcat-0.13.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
12
|
-
nbcat-0.13.0.dist-info/entry_points.txt,sha256=io_GRDsecAkYuCZALsjyea3VBq91VCoSznqlZEAJshY,42
|
13
|
-
nbcat-0.13.0.dist-info/licenses/LICENSE,sha256=7GjUnahXdd5opdvlpJdb1BisLbiXt2iOFhzIUduhdkE,1072
|
14
|
-
nbcat-0.13.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|