A JupyterLab extension to convert plaintext files to jupyter notebooks
Project description
ptjnb
A JupyterLab extension to convert plaintext files to Jupyter notebooks
Installation
pip install ptjnb
Requirements
- JupyterLab >= 4.0.0
Usage
Right-click menu
Select a .py or .md file in the file browser → right-click → Convert to Notebook submenu → pick a parser.
If a .ipynb with the same base name already exists, a confirmation dialog asks before overwriting.
Auto-convert on startup
Add plainTextNotebookConfig to jupyter_config.json (or JupyterLite's jupyter-lite.json):
{
"jupyter-config-data": {
"plainTextNotebookConfig": {
"rules": [
{ "dir": "percent", "parser": "parsePy" },
{ "dir": "sphinx_gallery", "parser": "parseSphinxGallery" },
{ "dir": "markdown", "parser": "parseClassicMd" },
{ "dir": "myst", "parser": "parseMystMd" }
]
}
}
}
Each rule watches a directory and converts matching files on JupyterLab startup (skips files that already have a .ipynb sibling).
Supported formats
| Parser | Menu label | File type | Format |
|---|---|---|---|
parsePy |
Percent format (.py) | .py |
Jupytext percent |
parseSphinxGallery |
Sphinx Gallery (.py) | .py |
Sphinx-Gallery |
parseClassicMd |
Classic Markdown (.md) | .md |
Standard markdown — fenced code blocks become code cells |
parseMystMd |
MyST Notebook (.md) | .md |
MyST-NB {code-cell} directives |
Uninstall
pip uninstall ptjnb
Contributing
See CONTRIBUTING.md
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ptjnb-0.1.1.tar.gz.
File metadata
- Download URL: ptjnb-0.1.1.tar.gz
- Upload date:
- Size: 382.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc68d34aee098419b88a2ac278b67d8ab44156bb23c7bc4534777633e9c0dcdb
|
|
| MD5 |
dc6cc2acf57fb053feca61d71a846dec
|
|
| BLAKE2b-256 |
2bc1ce69651efafadc6cbf92f427dffe802ee4933365ebb41311192216d10ef2
|
File details
Details for the file ptjnb-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ptjnb-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b28df376a3a1ae7b3afeef4afb437241cadad1376a1abbe182a6cb98e331ad4
|
|
| MD5 |
bdad4f59483f7dd943511b28aa307a8f
|
|
| BLAKE2b-256 |
ca603dd270f8ad319ab0f04fc144e8220ce122b6930a6466107c8463849a51d7
|