A quick way to convert file formats.
Do you find yourself bookmarking various online converters or having several tools to convert common file types? I did, and it didn't spark joy.
sleepyconvert is a tool that handles this in a minimal syntax.
Quickly convert file formats to and from:
- data
csvparquetjsonpklxlsx
- img
pngjpg/jpeg
- doc
htmlpdfmd
For some data files, you can optionally compress (gzip) the output.
ℹ️ Note that this tool presumes format by file extension. If you leave out extensions, or give csv data a
.jsonextension for funsies, then you're being silly.
ℹ️ Due to how document file formats vary, not all functionality can be preserved from one type to another, and formatting 1-1-ness may vary.
pip install sleepyconvert
pip install --upgrade sleepyconvert
python -m sleepyconvert --help
python -m sleepyconvert data data.csv data.parquet --compress
python -m sleepyconvert img photo.png photo.jpg
python -m sleepyconvert doc photo.html photo.pdfSet a function in your shell environment to run a script like:
alias convert='python -m sleepyconvert'Presuming you've named said macro convert, print the help message:
convert --help
convert data data.csv data.parquet
convert img photo.png photo.jpg
convert doc photo.html photo.pdfIf you have thoughts on how to make the tool more pragmatic, submit a PR 😊.
To add support for more data/file types:
- append extension name to
supported_<mode>_formatsinsleepyconvert_toolchain.params.py - add detection logic branch to the
mainfunction insleepyconvert_toolchain/commands.py - update this readme
See License for the full license text.
