Compare commits

..
2 Commits
2 changed files with 14 additions and 6 deletions
+9 -1
View File
@@ -296,7 +296,10 @@ def patch_log_config(log_config, *, access_log: bool = True): # noqa: ANN001, A
routine INFO lines, an emoji-level-prefix Formatter in place of
uvicorn's stock ``default`` formatter (a user-supplied one wins), a root
logger entry so ``logging.info()`` et al. print through the default
handler, and a no-prefix ``kanta`` logger entry (likewise).
handler, and a no-prefix ``kanta`` logger entry (likewise). The
``watchfiles.main`` logger is lifted to WARNING so its INFO "N changes
detected" line is dropped while the WARNING "Reloading..." line (logged
to ``uvicorn.error``) still shows; a user-supplied level wins.
With ``access_log``, additionally rewires the ``access`` formatter to
our Formatter and attaches its handler to our ``fastapi_vue.access``
logger. We must not
@@ -343,6 +346,11 @@ def patch_log_config(log_config, *, access_log: bool = True): # noqa: ANN001, A
if "default" not in root_handlers:
root_handlers.append("default")
# watchfiles logs "N changes detected" to its own logger at INFO; only the
# WARNING "Reloading..." line (uvicorn.error) should show.
with suppress(Exception):
config.setdefault("loggers", {}).setdefault("watchfiles.main", {}).setdefault("level", "WARNING")
# kanta-style output (diffs, colored headers) prints without prefixes,
# like our access log. A user-supplied "kanta" logger entry wins.
with suppress(Exception):
+5 -5
View File
@@ -1596,11 +1596,11 @@ def cmd_setup(args: argparse.Namespace) -> int:
print("✅ Created .gitignore")
# === Add dependencies using uv ===
# Pin fastapi-vue to the same major.minor as this setup tool (both are released
# from the same tags). Patch/dev releases may deviate, which also keeps this
# resolvable when running a development version of fastapi-vue-setup.
mm = re.match(r"(\d+)\.(\d+)", version)
fastapi_vue_req = f"fastapi-vue~={mm[1]}.{mm[2]}.0" if mm else "fastapi-vue"
# Pin fastapi-vue to the same major.minor.patch as this setup tool (both are
# released from the same tags). This makes freshly set up projects request the
# matching patch release directly, while `~=` still allows compatible updates.
mmp = re.match(r"(\d+)\.(\d+)\.(\d+)", version)
fastapi_vue_req = f"fastapi-vue~={mmp[1]}.{mmp[2]}.{mmp[3]}" if mmp else "fastapi-vue"
if dry:
print(f"📦 Would add: fastapi[standard], {fastapi_vue_req}")
else: