Unify Saved Me from Manual Quote Hell

Ever had a coding style quirk that slowly drives you mad? At work, our team follows the Black code style — with one exception: single quotes over double. Seems harmless, right?

It turns out this one tiny deviation spawns a surprising amount of friction.

The “Find and Replace” Fatigue

Sure, I could manually search and replace quotes. But doing it repeatedly across files is tedious. Then I tried using Cursor to handle it, but that introduced a whole new set of headaches: large token usage, slow processing, and needing to nudge it every few steps like a stubborn robot assistant.

It was messing with my flow.

Enter Unify (and uv)

I already had uv installed, so bringing in Unify was seamless:

uv tool install --python=python3.10 unify

That --python=python3.10 bit is key—otherwise uv grabs Python 3.13 by default, which causes problems with lib2to3 (yep, still relevant!).

Traceback (most recent call last):
  File "/Users/abramowi/.local/bin/unify", line 10, in <module>
    sys.exit(main())
             ~~~~^^
  File "/Users/abramowi/.local/share/uv/tools/unify/lib/python3.13/site-packages/unify.py", line 230, in main
    return _main(sys.argv,
                 standard_out=sys.stdout,
                 standard_error=sys.stderr)
  File "/Users/abramowi/.local/share/uv/tools/unify/lib/python3.13/site-packages/unify.py", line 210, in _main
    if format_file(name, args=args, standard_out=standard_out):
       ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/abramowi/.local/share/uv/tools/unify/lib/python3.13/site-packages/unify.py", line 144, in format_file
    encoding = detect_encoding(filename)
  File "/Users/abramowi/.local/share/uv/tools/unify/lib/python3.13/site-packages/unify.py", line 125, in detect_encoding
    from lib2to3.pgen2 import tokenize as lib2to3_tokenize
ModuleNotFoundError: No module named 'lib2to3'

Unify depends on it, so an older Python version saves the day.

The One-Liner That Fixed Everything

Here’s all it takes to switch to single quotes in-place:

unify --quote "'" --in-place /path/to/file.py

And just like that, no more fiddling. No more token burn. No more nudging AI tools into submission.

Before & After

# Before
print("Hello, world!")

# After
print('Hello, world!')

Takeaway

Sometimes the best fix is a surgical one. Unify didn’t just clean up my code—it let me reclaim time and focus. If you’re stuck in quote-style purgatory, this one-liner might just be your escape route.

Leave a Reply

Your email address will not be published. Required fields are marked *