Skip to main content

Convert between Markdown (.md) and Jupyter Notebook (.ipynb) formats

Project description

Jupyter Switch

PyPI version License: MIT

A powerful, lightweight and intuitive tool to seamlessly convert between Markdown (.md) and Jupyter Notebook (.ipynb) formats.

✨ Features

  • 🚀 Automatic detection: Automatically detects whether the input file is .md or .ipynb and converts accordingly
  • 🔄 Bidirectional conversion: Convert from Markdown to Jupyter Notebook and vice versa
  • 🛡️ Backup protection: Automatically creates backups when output files already exist
  • 📋 Preserves structure: Maintains code blocks, markdown content, and cell structure
  • 🔧 MCP integration: Works as an MCP server tool for AI assistants

🤖 MCP Tool Usage (Recommended for AI Assistants)

This package provides an MCP (Model Context Protocol) server that can be used with AI assistants like Claude.

Installation as MCP Server

Add to your MCP settings configuration:

{
  "mcpServers": {
    "jupyter-switch": {
      "command": "uvx",
      "args": ["--from", "jupyter-switch", "jupyter-switch-mcp"]
    }
  }
}

Available Tool

  • switch_file: Converts between .md and .ipynb formats automatically based on input file extension

Recommended Workflow for .ipynb Editing

  1. Convert to Markdown: Use the switch_file tool to convert .ipynb.md for easier editing
  2. Edit: Modify the .md file with your preferred editor
  3. Convert back: Use the tool again to convert .md.ipynb when done

Example

"Translate this notebook to French, using jupyter-switch"

📦 CLI Usage

Installation

Install the package using pip:

pip install jupyter-switch

Usage

The main command is jupyter-switch:

# Convert a Markdown file to Jupyter Notebook
jupyter-switch example.md

# Convert a Jupyter Notebook to Markdown
jupyter-switch example.ipynb

Install with uv (Recommended) ⚡️

uvx will automatically install the package and run the command.

# Convert README.md to README.ipynb
uvx jupyter-switch README.md

# Convert notebook.ipynb to notebook.md
uvx jupyter-switch notebook.ipynb

The tool will automatically:

  • Detect the input file format
  • Generate the appropriate output filename
  • Create a backup if the output file already exists
  • Convert the content while preserving structure

Help 🆘

jupyter-switch --help
jupyter-switch --version

Conversion Details 🔄

Markdown to Jupyter Notebook

  • Python code blocks (python...) become code cells
  • All other content becomes markdown cells
  • Adds appropriate notebook metadata and structure

Jupyter Notebook to Markdown

  • Code cells become Python code blocks
  • Markdown cells are preserved as-is
  • Cell outputs are ignored during conversion

Requirements 🐍

  • Python >= 3.10

License 📄

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jupyter_switch-0.1.3.tar.gz (35.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jupyter_switch-0.1.3-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file jupyter_switch-0.1.3.tar.gz.

File metadata

  • Download URL: jupyter_switch-0.1.3.tar.gz
  • Upload date:
  • Size: 35.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jupyter_switch-0.1.3.tar.gz
Algorithm Hash digest
SHA256 98201c3e699a75bd31e7266b4e7f4ca1d61ea66c32f524b17255e9984ed17ec6
MD5 5b469147ebd2e21f3774ea22b267fe1d
BLAKE2b-256 3778b964c9d261ed1eb95421ccdeb1bf05a527667faf77c9b253e40967102941

See more details on using hashes here.

Provenance

The following attestation bundles were made for jupyter_switch-0.1.3.tar.gz:

Publisher: release.yml on zc277584121/jupyter-switch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jupyter_switch-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: jupyter_switch-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jupyter_switch-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b078b9fd2b681340b6cc7c5eb34ed21c562d993d11a2c926277a2d53c8436d7d
MD5 c2616315c5785e94d6ca7a0f0d00f900
BLAKE2b-256 93f60dc23bb30fcea0954d8a58e9117650b47d00029fa45c7f8b8b57856a2325

See more details on using hashes here.

Provenance

The following attestation bundles were made for jupyter_switch-0.1.3-py3-none-any.whl:

Publisher: release.yml on zc277584121/jupyter-switch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page