fix: improve mrt init UX — fix db_url quoting bug, clearer prompts and next steps#54
Merged
Conversation
- pre-commit section: add args example for Alembic and Django, note on pre-commit autoupdate, update rev from v1.3.0 to v1.2.0 - Remove (v1.3.0) version labels from section headers for unreleased features - Update 'What's new' section to reflect v1.2.0 accurately Closes #35
…d next steps
Three issues fixed:
1. db_url quoting bug: when a user typed a literal URL (e.g. sqlite:///test.db),
it was written as db_url=sqlite:///test.db without quotes — invalid Python.
Now correctly written as db_url="sqlite:///test.db".
2. Confusing default prompt: the old default was the raw Python expression
os.environ.get("TEST_DATABASE_URL", "sqlite:///test.db") which is unclear
for first-time users. Default is now simply sqlite:///test.db with a tip
explaining the env var pattern for CI.
3. Weak next steps: the completion message now shows numbered steps, static
analysis command, and a docs link — so users know exactly what to do next.
Also removes unnecessary 'import os' from generated conftest when a literal
URL is used (os is only imported when the url expr references os.environ).
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problems
Three UX issues with
mrt init:1. db_url quoting bug (silent broken conftest)
When a user typed a literal URL, it was written without quotes:
2. Confusing default prompt
The old default value was the raw Python expression
os.environ.get("TEST_DATABASE_URL", "sqlite:///test.db")— a first-time user has no idea whether to type a URL or a Python expression.New default is simply
sqlite:///test.dbwith a tip printed above explaining the env var pattern for CI.3. Weak next steps
After init completed, users only saw one line. Now shows:
Bonus:
import osis no longer added to generated conftest when a literal URL is used.Before / After