nbcat 0.9.0__py3-none-any.whl → 0.9.2__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 -5
- nbcat/schemas.py +2 -2
- {nbcat-0.9.0.dist-info → nbcat-0.9.2.dist-info}/METADATA +18 -39
- nbcat-0.9.2.dist-info/RECORD +11 -0
- nbcat-0.9.0.dist-info/RECORD +0 -11
- {nbcat-0.9.0.dist-info → nbcat-0.9.2.dist-info}/WHEEL +0 -0
- {nbcat-0.9.0.dist-info → nbcat-0.9.2.dist-info}/entry_points.txt +0 -0
- {nbcat-0.9.0.dist-info → nbcat-0.9.2.dist-info}/licenses/LICENSE +0 -0
nbcat/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.9.
|
1
|
+
__version__ = "0.9.2"
|
nbcat/main.py
CHANGED
@@ -84,19 +84,16 @@ def render_cell(cell: Cell) -> list[tuple[str | None, RenderableType]]:
|
|
84
84
|
return Markdown(input)
|
85
85
|
|
86
86
|
def _render_code(input: str) -> Panel:
|
87
|
-
return Panel(Syntax(input, "python",
|
87
|
+
return Panel(Syntax(input, "python", theme="ansi_dark"), box=box.SQUARE)
|
88
88
|
|
89
89
|
def _render_raw(input: str) -> Text:
|
90
90
|
return Text(input)
|
91
91
|
|
92
|
-
def _render_heading(input: str) -> Text:
|
93
|
-
return Text(input)
|
94
|
-
|
95
92
|
RENDERERS = {
|
96
93
|
CellType.MARKDOWN: _render_markdown,
|
97
94
|
CellType.CODE: _render_code,
|
98
95
|
CellType.RAW: _render_raw,
|
99
|
-
CellType.HEADING:
|
96
|
+
CellType.HEADING: _render_markdown,
|
100
97
|
}
|
101
98
|
|
102
99
|
rows: list[tuple[str | None, RenderableType]] = []
|
nbcat/schemas.py
CHANGED
@@ -70,7 +70,7 @@ class Cell(BaseModel):
|
|
70
70
|
@property
|
71
71
|
def input(self) -> str:
|
72
72
|
if self.cell_type == CellType.HEADING and self.level is not None:
|
73
|
-
return f"{'#' * self.level} {self.source}"
|
73
|
+
return f"{'#' * self.level} {''.join(self.source)}"
|
74
74
|
|
75
75
|
if isinstance(self.source, list):
|
76
76
|
return "".join(self.source)
|
@@ -87,7 +87,7 @@ class Notebook(BaseModel):
|
|
87
87
|
def handle_format_versions(cls, data: dict[str, Any]) -> dict[str, Any]:
|
88
88
|
if data.get("worksheets"):
|
89
89
|
try:
|
90
|
-
data["cells"] = data.get("worksheets")[0].get("cells", [])
|
90
|
+
data["cells"] = data.get("worksheets", [{"cells": []}])[0].get("cells", [])
|
91
91
|
except (KeyError, IndexError, TypeError) as e:
|
92
92
|
print(e)
|
93
93
|
raise InvalidNotebookFormatError(f"Invalid v3 notebook structure: {e}")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: nbcat
|
3
|
-
Version: 0.9.
|
3
|
+
Version: 0.9.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
|
@@ -43,48 +43,39 @@ Description-Content-Type: text/markdown
|
|
43
43
|
|
44
44
|
# 📦 nbcat
|
45
45
|
|
46
|
-
cat for
|
47
|
-
|
48
|
-
[](./LICENSE)
|
49
|
-
[](https://github.com/akopdev/nbcat/actions)
|
50
|
-
|
51
|
-
---
|
46
|
+
`nbcat` lets you preview Jupyter notebooks directly in your terminal. Think of it as `cat`, but for `.ipynb` files.
|
52
47
|
|
53
48
|
## 🚀 Features
|
54
49
|
|
55
|
-
-
|
56
|
-
-
|
57
|
-
-
|
58
|
-
- ⚡ Fast and lightweight
|
59
|
-
- 📦 Available on PyPI
|
60
|
-
|
61
|
-
---
|
50
|
+
- Fast and lightweight with minimal external dependencies
|
51
|
+
- Preview remote notebooks without downloading them
|
52
|
+
- Supports for all Jupyter notebook versions - including legacy formats
|
62
53
|
|
63
54
|
## 📦 Installation
|
64
55
|
|
65
|
-
|
56
|
+
From the command line using pip:
|
66
57
|
|
67
58
|
```bash
|
68
|
-
|
59
|
+
pip install nbcat
|
69
60
|
```
|
70
61
|
|
71
|
-
|
62
|
+
## 🛠️ Quickstart
|
72
63
|
|
73
64
|
```bash
|
74
|
-
|
65
|
+
$ nbcat notebook.ipynb
|
75
66
|
```
|
76
67
|
|
77
|
-
|
78
|
-
|
79
|
-
## 🛠️ Quickstart
|
68
|
+
You can pass URLs as well.
|
80
69
|
|
81
|
-
```
|
82
|
-
|
70
|
+
```bash
|
71
|
+
$ nbcat https://raw.githubusercontent.com/akopdev/nbcat/refs/heads/main/tests/assets/test4.ipynb
|
83
72
|
```
|
84
73
|
|
85
|
-
|
74
|
+
Example use case with `fzf` command that lists all `.ipynb` files and uses `nbcat` for previewing them:
|
86
75
|
|
87
|
-
|
76
|
+
```bash
|
77
|
+
find . -type f -name "*.ipynb" | fzf --preview 'nbcat {}'
|
78
|
+
```
|
88
79
|
|
89
80
|
## 🧪 Testing & Development
|
90
81
|
|
@@ -97,29 +88,17 @@ make test
|
|
97
88
|
Check code quality:
|
98
89
|
|
99
90
|
```bash
|
100
|
-
make lint
|
101
|
-
```
|
102
|
-
|
103
|
-
Format code:
|
104
|
-
|
105
|
-
```bash
|
106
|
-
make format
|
91
|
+
make format lint
|
107
92
|
```
|
108
93
|
|
109
|
-
---
|
110
|
-
|
111
94
|
## 🙌 Contributing
|
112
95
|
|
113
96
|
Contributions are welcome! Please open an issue or [pull request](https://github.com/akopdev/nbcat/pulls).
|
114
97
|
|
115
|
-
---
|
116
|
-
|
117
98
|
## 📄 License
|
118
99
|
|
119
100
|
Distributed under the MIT License. See [`LICENSE`](./LICENSE) for more information.
|
120
101
|
|
121
|
-
---
|
122
|
-
|
123
102
|
## 🔗 Useful Links
|
124
103
|
|
125
104
|
- 📘 Documentation: _coming soon_
|
@@ -128,4 +107,4 @@ Distributed under the MIT License. See [`LICENSE`](./LICENSE) for more informati
|
|
128
107
|
|
129
108
|
---
|
130
109
|
|
131
|
-
|
110
|
+
Made with ❤️ by [Akop Kesheshyan](https://github.com/akopdev)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
nbcat/__init__.py,sha256=gqT-BGoeEItda9fICQDvLbxEjWRIBhFJxPxxKvmHLUo,22
|
2
|
+
nbcat/enums.py,sha256=ZsuOwYLF0D4PVwSkS74LwoXY0y0DkeBToLBWnmiS97Y,300
|
3
|
+
nbcat/exceptions.py,sha256=Ho7LQz9K70VtIMDNtAwuAtGmb-lFKxGxSj7MN3-EpDA,321
|
4
|
+
nbcat/main.py,sha256=Cv5CLuibhuEvLFxKH3vIk7XsD_Zr2ecTKACW1hy7d8c,4981
|
5
|
+
nbcat/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
+
nbcat/schemas.py,sha256=IK1l2a4UcP6Ivh8xRBzV5BIQTbeES1b1cCH-6goEq8Q,2366
|
7
|
+
nbcat-0.9.2.dist-info/METADATA,sha256=FaJtGOMbBL_K2JrDY_sRA-r1nxdQeZysezxVny9X0rU,3376
|
8
|
+
nbcat-0.9.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
9
|
+
nbcat-0.9.2.dist-info/entry_points.txt,sha256=io_GRDsecAkYuCZALsjyea3VBq91VCoSznqlZEAJshY,42
|
10
|
+
nbcat-0.9.2.dist-info/licenses/LICENSE,sha256=7GjUnahXdd5opdvlpJdb1BisLbiXt2iOFhzIUduhdkE,1072
|
11
|
+
nbcat-0.9.2.dist-info/RECORD,,
|
nbcat-0.9.0.dist-info/RECORD
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
nbcat/__init__.py,sha256=H9NWRZb7NbeRRPLP_V1fARmLNXranorVM-OOY-8_2ug,22
|
2
|
-
nbcat/enums.py,sha256=ZsuOwYLF0D4PVwSkS74LwoXY0y0DkeBToLBWnmiS97Y,300
|
3
|
-
nbcat/exceptions.py,sha256=Ho7LQz9K70VtIMDNtAwuAtGmb-lFKxGxSj7MN3-EpDA,321
|
4
|
-
nbcat/main.py,sha256=YwFqpt_wZLwqFzlxr9Hon_9QbWYEpAaDzLDsi2t-U3s,5072
|
5
|
-
nbcat/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
-
nbcat/schemas.py,sha256=F5Wl0ZWa5j8RK4H98nDJm69h3oecEuP6wu62823Cxyg,2340
|
7
|
-
nbcat-0.9.0.dist-info/METADATA,sha256=CVTz2g79Sr9_moJraY6pkks5gXqTZMdvFMqszPBnqMY,3412
|
8
|
-
nbcat-0.9.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
9
|
-
nbcat-0.9.0.dist-info/entry_points.txt,sha256=io_GRDsecAkYuCZALsjyea3VBq91VCoSznqlZEAJshY,42
|
10
|
-
nbcat-0.9.0.dist-info/licenses/LICENSE,sha256=7GjUnahXdd5opdvlpJdb1BisLbiXt2iOFhzIUduhdkE,1072
|
11
|
-
nbcat-0.9.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|