jackerhack@fediverser.communick.devBtoPython@fediverser.communick.dev•Ruff adds black-compatible formattingEnglish
1·
1 year agoI use Black with quote normalisation disabled. My projects have a rule about string quotes:
-
Single quotes for symbols that must be an exact match for a symbol elsewhere. Dict hashes, equality match, etc. These will be in API contracts (think JSON APIs), so any change will require care.
-
Double quotes for user-facing strings, including friendly error/warning messages and i18n strings. These are meant to be periodically revised to improve usability.
-
Exceptions are allowed when a string contains quote characters. Backslash escapes are uglier.
Quote normalisation makes it harder for developers to recognise the purpose of a string.
SQLAlchemy + Alembic, nicely wrapped in Flask-SQLAlchemy and Flask-Migrate. Flask-SQLAlchemy is not compatible with type annotations, so you’ll need a workaround. Here’s mine.