Skip to main content

ptjnb

Github Actions Status

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

Metadata

Release files for ptjnb 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ptjnb 0.1.1
File Size Uploaded
ptjnb-0.1.1.tar.gz 382.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ptjnb 0.1.1
File Interpreter ABI Platform
ptjnb-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 402.4 kB

Release files / ptjnb-0.1.1.tar.gz

Download URL ptjnb-0.1.1.tar.gz
Size 382.9 kB
Tags Source
SHA-256 checksum
How to use checksums
fc68d34aee098419b88a2ac278b67d8ab44156bb23c7bc4534777633e9c0dcdb
BLAKE2b-256 checksum
How to use checksums
2bc1ce69651efafadc6cbf92f427dffe802ee4933365ebb41311192216d10ef2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / ptjnb-0.1.1-py3-none-any.whl

Download URL ptjnb-0.1.1-py3-none-any.whl
Size 19.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b28df376a3a1ae7b3afeef4afb437241cadad1376a1abbe182a6cb98e331ad4
BLAKE2b-256 checksum
How to use checksums
ca603dd270f8ad319ab0f04fc144e8220ce122b6930a6466107c8463849a51d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.2.0 CPython/3.12.12

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page