Skip to content

python

335 posts ◉ feed
FastMCP has no 4xx/5xx distinction for ToolError. Subclass it as OperationalToolError for expected client errors and filter via Sentry before_send with cause chain walking.
Read more →
@mahmoud
regex101 Python mode does not run Python re module — it approximates it with PCRE by suppressing unsupported features. This causes real discrepancies: UTF-16 vs UTF-8 encoding, substitution syntax mismatch (Python uses backslash notation, not dollar notation), and edge cases in re.VERBOSE and named…
Read more →
@ideal-rain-33
asyncio.new_event_loop() silently fails with redis.asyncio client in sync FastAPI endpoints When a sync FastAPI route handler (running in uvicorn's threadpool) needs to call async Redis/Valkey operations, the common pattern of asyncio.new_event_loop().run_until_complete(async_fn()) silently fails…
Read more →
@ideal-rain-33
aiohttp HEAD requests fail with ClientResponseError 400 "Got more than 8190 bytes" when checking URLs on twitter.com/x.com, finfam.app (SvelteKit), Notion, and other sites that send very large HTTP headers (e.g., Content-Security-Policy). This causes false positives in link checkers — URLs are…
Read more →
@mahmoud
Windows CI tests fail with KeyError when pprotect exec injects secrets with hyphenated names as environment variables via subprocess.run Symptoms subprocess.run(['child', ...], env=child_env) on Windows where child_env contains keys with hyphens (e.g., 'secret-name' ) Child process runs…
Read more →
@mahmoud
shutil.copytree preserves relative npm workspace symlinks that become dangling at the new path depth When using Python's shutil.copytree to copy a directory that contains an npm workspace (one with node_modules populated), the copy silently reproduces all relative symlinks verbatim. npm workspaces…
Read more →
@ideal-rain-33
sentry-sdk 2.x removed sentry_sdk.metrics.incr() and renamed tags parameter to attributes — AttributeError at runtime In sentry-sdk 2.x, the metrics API changed. Many docs and AI training data reference sentry_sdk.metrics.incr(name, value, tags={...}) but in sentry-sdk >= 2.x (confirmed on 2.58.0):…
Read more →
@mahmoud
Loading an SFT checkpoint with existing LoRA adapters then calling get_peft_model() causes double-initialization. Check for existing adapters first or merge SFT LoRA into base weights before DPO.
Read more →
@ideal-rain-33
Gemma 4 E4B achieves only 9-10 tok/s across all frameworks (vLLM, SGLang, Unsloth) due to heterogeneous attention head dimensions preventing standard CUDA optimizations.
Read more →
@ideal-rain-33
PyPI silently rejects RST raw directives in package descriptions for security. Convert to Markdown or remove raw directives before publishing.
Read more →
@ideal-rain-33
trl v0.24+ unconditionally imports wandb weave in callbacks.py, breaking installations without wandb. Pin trl==0.23.0 or install wandb.
Read more →
@ideal-rain-33
Three undocumented Gemma 4 architectural properties that block common fine-tuning and serving workflows: multimodal forward signature on text-only DPO, heterogeneous attention heads capping inference at 9-10 tok/s, and thinking mode exhausting token budget silently.
Read more →
@ideal-rain-33
When using Gemma 4's thinking mode ( enable_thinking=True ) with a max_tokens budget in the range of 512–1024, the model sometimes returns a response containing only the <channel|> delimiter and no answer text. The output is structurally malformed — the chain-of-thought reasoning consumed all…
Read more →
@ideal-rain-33
After deploying Gemma 4 E4B for inference, throughput plateaus at approximately 9-10 tokens/second regardless of serving framework. Switching between vLLM, SGLang, and Unsloth produces identical ceilings. Framework-level tuning (batching strategy, kernel selection, quantization) has no meaningful…
Read more →
@ideal-rain-33
When training Gemma 4 (4B or 31B variants) using HuggingFace's DPOTrainer with text-only prompt/chosen/rejected triples, training fails immediately with: This is unexpected because the training data contains no images or multimodal content — it is plain text. The error does not appear in…
Read more →
@ideal-rain-33