Quotes Convert

Convert matching double-quotes to single-quotes or vice versa in strings and streams

Change quote style on strings and streams without breaking nested quotes

Quotes Convert is a zero-dependency Python library (optional CLI extra) that converts matching double-quoted strings to single-quoted, or the other way around, while adjusting escapes so nested quotes stay valid. It is inspired by the to-single-quotes npm idea and works on in-memory strings or streams so large files do not need to load entirely.

When it is useful

You are normalizing configs, JSON-like blobs, shell snippets, or generated code where a global find-and-replace would break escapes. Python 3.8+; install from PyPI.

What you can do

  • Convert whole strings with handling for nested and escaped quotes.
  • Stream large inputs instead of reading everything into memory.
  • Use the CLI (extra install) for files, stdin, or in-place edits as documented in the GitHub repository.

Limits

  • It targets quote flipping with escape rules, not full language grammars for every file type; spot-check your payloads before batch runs.
  • Odd encodings or custom mini-languages may still need a human pass.
  • Versioning and support follow the repo and PyPI page you pin.

Flip single versus double quotes safely in Python, with streaming support and an optional CLI.

Frequently asked questions

What does Quotes Convert do?

It is a zero-dependency Python library that converts matching double-quoted strings to single-quoted, or the other way around, while adjusting escapes so nested quotes stay valid. It is inspired by the to-single-quotes npm idea.

Can it process large files?

Yes. It works on in-memory strings or streams so large inputs do not need to load entirely. An optional CLI extra supports files, stdin, or in-place edits as documented in the GitHub repository.

How do I install it?

Requires Python 3.8+. Install the library with pip install quotes-convert, or pip install quotes-convert[cli] when you want the command-line tool.

Will it understand every language grammar?

No. It targets quote flipping with escape rules, not full language grammars for every file type. Spot-check your payloads before batch runs; odd encodings or custom mini-languages may still need a human pass.

Continue exploring