nbcat 0.13.0__tar.gz → 0.13.2__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.
Files changed (40) hide show
  1. {nbcat-0.13.0 → nbcat-0.13.2}/.github/workflows/ci.yml +18 -0
  2. {nbcat-0.13.0 → nbcat-0.13.2}/PKG-INFO +4 -1
  3. {nbcat-0.13.0 → nbcat-0.13.2}/README.md +2 -0
  4. nbcat-0.13.2/docs/screenshot.png +0 -0
  5. nbcat-0.13.2/docs/screenshot2.png +0 -0
  6. {nbcat-0.13.0 → nbcat-0.13.2}/pyproject.toml +3 -2
  7. nbcat-0.13.2/src/nbcat/__init__.py +1 -0
  8. {nbcat-0.13.0 → nbcat-0.13.2}/src/nbcat/main.py +2 -1
  9. {nbcat-0.13.0 → nbcat-0.13.2}/src/nbcat/markdown.py +11 -10
  10. nbcat-0.13.2/tests/assets/sqlite.ipynb +666 -0
  11. {nbcat-0.13.0 → nbcat-0.13.2}/uv.lock +517 -471
  12. nbcat-0.13.0/.github/workflows/homebrew.yml +0 -23
  13. nbcat-0.13.0/docs/screenshot.png +0 -0
  14. nbcat-0.13.0/src/nbcat/__init__.py +0 -1
  15. {nbcat-0.13.0 → nbcat-0.13.2}/.gitignore +0 -0
  16. {nbcat-0.13.0 → nbcat-0.13.2}/LICENSE +0 -0
  17. {nbcat-0.13.0 → nbcat-0.13.2}/Makefile +0 -0
  18. {nbcat-0.13.0 → nbcat-0.13.2}/src/nbcat/enums.py +0 -0
  19. {nbcat-0.13.0 → nbcat-0.13.2}/src/nbcat/exceptions.py +0 -0
  20. {nbcat-0.13.0 → nbcat-0.13.2}/src/nbcat/image.py +0 -0
  21. {nbcat-0.13.0 → nbcat-0.13.2}/src/nbcat/pager.py +0 -0
  22. {nbcat-0.13.0 → nbcat-0.13.2}/src/nbcat/py.typed +0 -0
  23. {nbcat-0.13.0 → nbcat-0.13.2}/src/nbcat/schemas.py +0 -0
  24. {nbcat-0.13.0 → nbcat-0.13.2}/tests/assets/invalid.ipynb +0 -0
  25. {nbcat-0.13.0 → nbcat-0.13.2}/tests/assets/many_tracebacks.ipynb +0 -0
  26. {nbcat-0.13.0 → nbcat-0.13.2}/tests/assets/no_min_version.ipynb +0 -0
  27. {nbcat-0.13.0 → nbcat-0.13.2}/tests/assets/test3.ipynb +0 -0
  28. {nbcat-0.13.0 → nbcat-0.13.2}/tests/assets/test3_no_metadata.ipynb +0 -0
  29. {nbcat-0.13.0 → nbcat-0.13.2}/tests/assets/test3_no_min_version.ipynb +0 -0
  30. {nbcat-0.13.0 → nbcat-0.13.2}/tests/assets/test3_no_worksheets.ipynb +0 -0
  31. {nbcat-0.13.0 → nbcat-0.13.2}/tests/assets/test3_worksheet_with_no_cells.ipynb +0 -0
  32. {nbcat-0.13.0 → nbcat-0.13.2}/tests/assets/test4.5.ipynb +0 -0
  33. {nbcat-0.13.0 → nbcat-0.13.2}/tests/assets/test4.ipynb +0 -0
  34. {nbcat-0.13.0 → nbcat-0.13.2}/tests/assets/test4custom.ipynb +0 -0
  35. {nbcat-0.13.0 → nbcat-0.13.2}/tests/assets/test4docinfo.ipynb +0 -0
  36. {nbcat-0.13.0 → nbcat-0.13.2}/tests/assets/test4jupyter_metadata.ipynb +0 -0
  37. {nbcat-0.13.0 → nbcat-0.13.2}/tests/assets/test4jupyter_metadata_timings.ipynb +0 -0
  38. {nbcat-0.13.0 → nbcat-0.13.2}/tests/conftest.py +0 -0
  39. {nbcat-0.13.0 → nbcat-0.13.2}/tests/test_read_notebook.py +0 -0
  40. {nbcat-0.13.0 → nbcat-0.13.2}/tests/test_render_cell.py +0 -0
@@ -62,3 +62,21 @@ jobs:
62
62
  uses: softprops/action-gh-release@v2
63
63
  with:
64
64
  files: dist/*
65
+
66
+ homebrew:
67
+ needs: deploy
68
+ runs-on: ubuntu-latest
69
+ steps:
70
+ - name: Release project to Homebrew tap
71
+ uses: Justintime50/homebrew-releaser@v2
72
+ with:
73
+ homebrew_owner: akopdev
74
+ homebrew_tap: homebrew-formulas
75
+ github_token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
76
+ install: 'virtualenv_install_with_resources'
77
+ test: 'assert_match version.to_s, shell_output("#{bin}/nbcat --version")'
78
+ commit_owner: akopdev
79
+ commit_email: devnull@akop.dev
80
+ update_readme_table: true
81
+ formula_includes: 'include Language::Python::Virtualenv'
82
+ depends_on: '"python@3.13"'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nbcat
3
- Version: 0.13.0
3
+ Version: 0.13.2
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
@@ -4,6 +4,7 @@
4
4
 
5
5
  <p align="center">
6
6
  <a href="docs/screenshot.png" target="blank"><img src="docs/screenshot.png" width="400" /></a>
7
+ <a href="docs/screenshot2.png" target="blank"><img src="docs/screenshot2.png" width="400" /></a>
7
8
  </p>
8
9
 
9
10
  ## Features
@@ -11,6 +12,7 @@
11
12
  - Very fast and lightweight with minimal dependencies.
12
13
  - Preview remote notebooks without downloading them.
13
14
  - Enable paginated view mode with keyboard navigation (similar to `less`).
15
+ - Supports image rendering (some protocols in beta)
14
16
  - Supports for all Jupyter notebook versions, including old legacy formats.
15
17
 
16
18
  ## Motivation
Binary file
Binary file
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nbcat"
3
- version = "0.13.0"
3
+ version = "0.13.2"
4
4
  description = "cat for jupyter notebooks"
5
5
  authors = [
6
6
  { name = "Akop Kesheshyan", email = "devnull@akop.dev" }
@@ -17,7 +17,8 @@ dependencies = [
17
17
  "pydantic",
18
18
  "rich",
19
19
  "timg",
20
- "textual"
20
+ "textual",
21
+ "markdownify"
21
22
  ]
22
23
 
23
24
  [project.optional-dependencies]
@@ -0,0 +1 @@
1
+ __version__ = "0.13.2"
@@ -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)
@@ -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.exists():
45
- image_content = path.read_bytes()
46
- elif self.destination.startswith("http://") or self.destination.startswith("https://"):
47
- try:
48
- with requests.Session() as req:
49
- res = req.get(self.destination, timeout=5)
50
- res.raise_for_status()
51
- image_content = res.content
52
- except requests.RequestException:
53
- return super().__rich_console__(console, options)
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")