Skip to main content

morph โ€” convert anything to anything, from the CLI

Project description

๐Ÿฆ‹ MORPH

The Universal File Converter for the Command Line.

One command. No format-specific tools to remember. No cloud upload. No API keys. Convert anything, to anything.

License: MIT Python 3.10+ Built with Typer Powered by Rich TUI: Textual

morph report.docx report.pdf
morph data.csv data.xlsx --table-style TableStyleMedium2 --header-bg 2E7D32
morph logo.png logo.svg --mode spline
morph batch '*.mp4' mp3 --workers 4
morph pack '*.png' photos/ doc.pdf archive.zip

โšก Why morph exists

ffmpeg converts media. pandoc converts documents. ImageMagick converts images. Each is an incredible piece of software, but using them together is a nightmare of different flag dialects, mental models, and obscure syntax errors.

morph doesn't reinvent codecs or file formats โ€” it orchestrates the best tool for each job behind a single, predictable, and beautiful interface.

Whether you are rendering a 3D .blend file to a .png, scraping a Wikipedia article into a Markdown file, vectorizing a .jpg into an .svg, or converting a batch of .csv files to .parquet, morph calculates the route, fetches the dependencies, and executes the job.

โœจ Features

  • One Universal Verb. morph <input> <output>. That's it. Omit the output, and morph acts as a wizard, presenting you with an interactive menu of all possible destination formats.
  • Undo. Made a mistake? Convert a massive 1,000-file directory by accident? Just type morph undo and watch it instantly delete the generated files and revert your history.
  • Smart Multi-Hop Graph Routing. No direct csv โ†’ yaml converter? morph automatically finds the csv โ†’ json โ†’ yaml route. When crossing wild paradigms (e.g. Markdown โ†’ SQLite), morph explicitly hints its logic (like extracts tabular data only).
  • Contextual Intelligence. Run morph data.csv data.xlsx --help and you'll only see flags relevant to that specific pair (like --table-style or --freeze-cols). Run it on a video file, and you'll see bitrate and framerate controls instead.
  • Output Verification. Pass the --verify flag to calculate and display the exact SHA-256 checksum of the resulting file right alongside the success message.
  • Transparent Remote Downloads. Pass any http:// link and morph handles the rest. It uses trafilatura to scrape web articles into clean Markdown, or yt-dlp to natively download high-quality media (morph <url> --audio).
  • Batch Processing Engine. morph batch '*.mp4' mp3 converts files concurrently with a live progress table, smart skip logic (--newer-only, --skip-existing), and output structure mirroring.
  • Pack Command. Run morph pack *.png output.zip to collect any number of files, globs, or directories into a single archive (zip/7z/tar.gz), with auto-stripped common paths.
  • Interactive TUI. Type morph with no arguments to launch a stunning, keyboard-driven Textual UI. Navigate your filesystem, preview conversion options, and watch live progress bars without touching your mouse.
  • Automated Dependency Management. Missing ffmpeg or pandoc? morph detects your OS and package manager (brew/apt/winget/etc.), shows you the exact install command, and asks before running it. Massive dependencies (like 3D rendering engines) are cleanly isolated as optional extras!
  • Pluggable Architecture. Drop a Python script in morph/converters/, add a @register decorator, and it's instantly live in the routing graph.
  • Local-First & Private. No cloud uploads. No API keys. Everything runs on your machine.

๐Ÿ“ฆ Installation

morph is natively distributed across all major operating systems. You do not need Python installed to use the standalone binaries!

Windows

# via Winget (Recommended)
winget install hariharen.morph

# via Scoop
scoop bucket add morph https://github.com/hariharen9/scoop-bucket.git
scoop install morph

macOS & Linux

# via Homebrew
brew tap hariharen9/homebrew-tap
brew install morph

Python Ecosystem (PyPI)

If you prefer managing via pip (or pipx), install it globally:

pipx install morphconv

Development (Source)

git clone https://github.com/hariharen9/morph.git
cd morph
pip install -e .

morph relies on native Python libraries for data, web, and archives. For massive specialized packages, morph uses optional extras to keep your base installation blazing fast. If you need them, simply install them:

pip install -e ".[3d]"   # Installs bpy (Blender) for 3D conversions
pip install -e ".[web]"  # Installs crawl4ai and playwright for heavy JS rendering

For domain-specific external binaries (e.g., ffmpeg, pandoc), you don't need to install these upfront โ€” morph will intelligently prompt you to install them the first time they are needed.

To see your current system dependencies at any time:

morph deps

๐Ÿš€ Quickstart & Real-World Examples

๐Ÿ“Š Data Processing

Switch between analytical formats effortlessly.

morph data.csv data.xlsx
morph data.json data.yaml
morph database.sqlite data.csv

๐Ÿ“„ Documents & Ebooks

morph notes.md notes.docx
morph report.docx report.pdf
morph book.epub book.mobi

๐Ÿ–ผ๏ธ Images & Vectorization

Raster conversions, plus advanced raster-to-vector tracing.

# Standard image processing
morph photo.png photo.webp --quality 80 --resize 1200x
morph icon.png icon.ico

# Raster to Vector (via vtracer)
morph logo.png logo.svg --mode spline --hierarchical stacked

๐ŸŽฌ Audio & Video (via ffmpeg)

Media manipulation with real-time progress bars parsed directly from ffmpeg.

morph song.wav song.mp3 --bitrate 192k
morph clip.mp4 clip.gif --fps 10 --width 480
morph clip.mkv clip.mp3  # Extract audio

๐ŸŒ Web & Remote Files

Fetch data directly from the internet and transform it locally in one step. morph natively embeds yt-dlp to download almost any media from the web.

# Natively download video from YouTube, Twitter, etc.
morph https://youtube.com/watch?v=... video.mp4

# Extract audio only from a remote video with metadata embedded
morph https://youtube.com/watch?v=... audio.mp3 --audio

# Scrape an article into clean Markdown (via trafilatura)
morph https://en.wikipedia.org/wiki/Graph_theory graph_theory.md

# Download a remote CSV and style it as an Excel workbook natively
morph https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/latest/owid-covid-latest.csv covid.xlsx --table-style TableStyleMedium2

# Scrape a JavaScript-heavy page (requires morphconv[web])
morph https://example.com/dynamic-article doc.pdf --js

๐ŸงŠ 3D Models & Rendering (Powered by Blender/bpy)

Seamlessly convert between 3D formats, or utilize headless rendering to generate images of your models.

# Format conversion
morph character.fbx character.glb
morph scene.obj scene.blend

# Headless 3D rendering (automatically places lights and cameras)
morph character.gltf character.png

๐ŸŽ๏ธ Batch Operations

Convert hundreds of files concurrently with a beautiful terminal dashboard.

# All MP4s to MP3 using 4 parallel workers
morph batch '*.mp4' mp3 --workers 4

# Recursively convert a whole directory and mirror its structure in an output folder
morph batch ./raw_footage/ mp3 --recursive --out-dir ./audio_only/ --mirror

# Skip files that have already been converted
morph batch '*.flac' mp3 --skip-existing

During batch conversions, morph displays a live status table:

โ•ญโ”€ morph batch โ€” 8 files โ†’ mp3 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚  Status          File                    Time      Size             โ”‚
โ”‚  โœ“ done          concert_01.flac         0:00:04   8.3MB โ†’ 4.1MB   โ”‚
โ”‚  โœ“ done          concert_02.flac         0:00:03   7.9MB โ†’ 3.8MB   โ”‚
โ”‚  โ–ถ convertingโ€ฆ   concert_03.flac         0:00:01                    โ”‚
โ”‚  ยท waiting       concert_04.wav                                     โ”‚
โ”‚                                                                      โ”‚
โ”‚  Overall  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘  2/8  [0:00:07]                          โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

๐Ÿ—‚๏ธ Supported Formats

Domain Formats Backend
Data csv, xlsx, json, yaml, toml, parquet, feather, ods, xml, html, sqlite Native (pandas / tomlkit)
Documents md, html, docx, odt, rtf, epub, latex, rst, txt, pptx, adoc, org, opml, man pandoc
Legacy Office doc, xls, ppt LibreOffice (soffice)
Notebooks ipynb nbconvert (executes & renders outputs)
PDF pdf (real text, layout, tables, generation) pymupdf / pdfplumber / pdf2docx
Images (Raster) png, jpg/jpeg, webp, bmp, gif, tiff, ico, heic, avif, icns Pillow / cairosvg
Vectorization png/jpg/etc. โ†’ svg vtracer
3D Models obj, stl, fbx, gltf, glb, blend, any โ†’ png (Render) bpy (Blender)
Web Extraction url โ†’ md, txt, xml, html trafilatura / crawl4ai
Audio mp3, wav, flac, ogg, aac, m4a, opus, wma ffmpeg
Video mp4, mkv, mov, webm, avi, flv, wmv, mpeg ffmpeg
Subtitles srt, vtt, ass, ssa, sub, sami pysubs2
Ebooks epub, mobi, azw3 ebook-convert
Fonts ttf, otf, woff, woff2 fontTools
OCR png, jpg, webp, pdf, etc. โ†’ txt tesseract
Archives zip, 7z, tar, tar.gz, tar.bz2, tar.xz, rar* Python stdlib / py7zr / rarfile

* Note: RAR is an extract-only format (RAR creation requires proprietary tools).


๐Ÿ› ๏ธ Architecture & Under the Hood

The magic of morph lies in its modular graph architecture.

morph/
โ”œโ”€โ”€ cli.py                # Command dispatch (run, batch, formats, history, deps)
โ”œโ”€โ”€ registry.py           # BFS Routing graph & registration logic
โ”œโ”€โ”€ tui.py                # Textual keyboard-driven TUI
โ””โ”€โ”€ converters/
    โ”œโ”€โ”€ __init__.py       # Auto-discovers all modules
    โ”œโ”€โ”€ documents.py      # pandoc engine
    โ”œโ”€โ”€ images.py         # Pillow engine
    โ”œโ”€โ”€ models_3d.py      # Blender/bpy engine
    โ”œโ”€โ”€ web.py            # trafilatura / crawl4ai engine
    โ””โ”€โ”€ vtracer_converter.py  # Raster-to-SVG vectorization

Adding a new conversion is trivial

Drop a file in morph/converters/ and use the @register decorator. No central registry, no CLI parsers to update.

from pathlib import Path
from ..registry import ConversionResult, OptionSpec, register

@register("foo", "bar", backend="mytool", family="image")
def foo_to_bar(input_path: Path, output_path: Path, **kwargs) -> ConversionResult:
    # Do the conversion...
    return ConversionResult(output=output_path)

Because of morph's graph routing, once foo โ†’ bar is registered, if a path exists from bar โ†’ baz, morph immediately knows how to convert foo โ†’ baz.


๐Ÿ“œ History & Transparency

Every conversion is automatically logged. You can review your execution history at any time.

morph history
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ When     โ”‚ From โ”‚ To   โ”‚ File           โ”‚ Mode   โ”‚ Status     โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 2m ago   โ”‚ md   โ”‚ docx โ”‚ README.md      โ”‚ single โ”‚ โœ“ 1.8s     โ”‚
โ”‚ 1h ago   โ”‚ mp4  โ”‚ mp3  โ”‚ intro.mp4      โ”‚ batch  โ”‚ โœ“ 4.2s     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿค Contributing

PRs are highly encouraged! If you are adding a new conversion, simply add the file in the converters/ directory.

โš–๏ธ License

Released under the 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

morphconv-1.0.4.tar.gz (85.5 kB view details)

Uploaded Source

Built Distribution

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

morphconv-1.0.4-py3-none-any.whl (93.5 kB view details)

Uploaded Python 3

File details

Details for the file morphconv-1.0.4.tar.gz.

File metadata

  • Download URL: morphconv-1.0.4.tar.gz
  • Upload date:
  • Size: 85.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for morphconv-1.0.4.tar.gz
Algorithm Hash digest
SHA256 24b92998a1f2cabe390bb03d740468ebd3ae3640ebf834c3eca8c5dacaac2f2a
MD5 d0f3d4b7d9c9370310b38580fa420d5e
BLAKE2b-256 a6421d56561fef90d7dc1cbb9568a2fc00f7d7ae15c819f831ce4af33483dff7

See more details on using hashes here.

File details

Details for the file morphconv-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: morphconv-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 93.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for morphconv-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 55b00b6e0619c77d29b6b1de9dd34944974bbedbd2bb7206b580066aca1a34dc
MD5 d2c3a46b0b0a9e7915df8c9f69f5af1f
BLAKE2b-256 c6e66b352330c66083ad955005781cbf1c8ee89dc35da284f69b0e45c384b773

See more details on using hashes here.

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