{"id":23955564,"url":"https://github.com/tnwei/nbread","last_synced_at":"2025-04-22T23:50:15.482Z","repository":{"id":129158836,"uuid":"583816236","full_name":"tnwei/nbread","owner":"tnwei","description":"Snappy previews of Jupyter notebooks from the command line, with ranger integration","archived":false,"fork":false,"pushed_at":"2024-06-17T13:58:15.000Z","size":42,"stargazers_count":8,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-22T23:50:08.087Z","etag":null,"topics":["data-science","jupyter","python","ranger"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tnwei.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-31T02:52:07.000Z","updated_at":"2025-04-21T05:33:07.000Z","dependencies_parsed_at":"2025-01-06T15:39:55.862Z","dependency_job_id":null,"html_url":"https://github.com/tnwei/nbread","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tnwei%2Fnbread","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tnwei%2Fnbread/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tnwei%2Fnbread/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tnwei%2Fnbread/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tnwei","download_url":"https://codeload.github.com/tnwei/nbread/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250343909,"owners_count":21415037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-science","jupyter","python","ranger"],"created_at":"2025-01-06T15:35:40.023Z","updated_at":"2025-04-22T23:50:15.464Z","avatar_url":"https://github.com/tnwei.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nbread\n\nSnappy previews of Jupyter notebooks from the command line, with ranger integration.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"800\" src=\"https://raw.githubusercontent.com/tnwei/nbread/main/nbread-cast.svg\"\u003e\n\u003c/p\u003e\n\n## Use case\n\n+ Read notebooks using just the terminal, don't need to spin up a Jupyter Notebook / Lab instance\n+ Read superlarge notebooks without chugging Jupyter Notebook / Lab\n\n## Usage\n\nRun `nbread notebook.ipynb` for notebook preview in terminal. \n\n```bash\n$ nbread --help\nusage: nbread [-h] [--paging PAGING] filename\n\npositional arguments:\n  filename\n\noptional arguments:\n  -h, --help       show this help message and exit\n  --paging PAGING  Specify when to use the pager [auto/never/always], defaults to auto\n```\n\n## Setup\n\nInstallation: `pipx install git+https://github.com/tnwei/nbread`. \n\n## Ranger integration\n\nUse `ranger` as normal, and see Jupyter notebook previews in place of the underlying JSON plain text!\n\nDo the following for `ranger` integration:\n\nIf your `~/.config/ranger/` dir is empty, run `ranger --copy-config=all` to populate it w/ the defaults.\n\nEnabling panel preview when a notebook is highlighted: modify `handle_extension()` in `~/.config/ranger/scope.sh`:\n\n```bash\nhandle_extension(){\n    case \"${FILE_EXTENSION_LOWER}\" in\n        ### INSERT START\n        ipynb)\n        ¦   # Jupyter notebook previewer\n            nbread \"${FILE_PATH}\" \u0026\u0026 { dump | trim; exit 5; } || exit 2;;\n        ### INSERT END\n\n        # Archive extensions:\n```\n\nEnabling fullscreen preview in terminal when a notebook is selected: add the following to `~/.config/ranger/rifle.conf`:\n\n```\n### INSERT START\n# Jupyter notebooks\next ipynb  = nbread \"$1\" --pager\n### INSERT END\n```\n\nLast tested on ranger 1.9.3, requires `less` installed.\n\n## Appreciation\n\nCode heavily based on [Textualize/rich-cli](https://github.com/Textualize/rich-cli)'s notebook pretty printing. This is pretty much `rich \u003cnotebook.ipynb\u003e` with some speed tweaks and standalone packaging for convenience.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftnwei%2Fnbread","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftnwei%2Fnbread","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftnwei%2Fnbread/lists"}