Saurabh Kumar

#python

Python ecosystem, packaging, runtime

Includesdjango

Writing

TIL notes

  • django-bolt decides where your code runs by reading it

    django-bolt serves Django from a Rust server, with one Python worker thread per process. In an independent benchmark it ran 1.6 to 1.7x django-ninja on real database endpoints. The catch: a slow sync handler must move to a thread pool, or every request in that process waits. Bolt decides at startup by scanning each handler’s source for ORM calls like .objects.get.

    The scan reads only the handler. return Order.objects.get(id=id) goes to the pool. return services.get_order(id) runs the same query inline on the worker thread, and the whole process stalls until it returns. A codebase with a service layer hits this on nearly every route. The way out is async handlers: async def puts the waiting in the signature, so it can’t hide one call down.

    A scan of one function sees what’s written there, not what it calls. A fact that has to cross calls belongs in the signature, which is Ron Minsky’s argument for types.

  • Ron Minsky: types, expect tests and review matter more with agents

    Ron Minsky’s Bug Bash 2026 talk argues Jane Street’s old habits (rich types, expect tests, real code review) matter more with agents: they give the model fast, exact feedback and keep the code readable for the humans who own it. He goes the other way from the Claude Code team on review: its main job is keeping a human able to explain the system, not catching bugs.

    The idea I’m taking: expect tests. The test prints output, the expected text lives inline, and a change shows up as a diff of behavior, not just code. Python’s version is inline-snapshot: assert result == snapshot(), filled in by pytest.

    • Gotcha with agents: under --inline-snapshot=fix (or create, review) every snapshot comparison returns True and the file is rewritten. An agent chasing green doesn’t need to delete a test; it re-accepts the wrong output. Keep acceptance with a human and never auto-fix in CI.
  • Django Seedkit

    viewflow/seedkit is an agent skill that scaffolds a Django project by asking you questions, then writes only the parts you picked. The edge over cookiecutter: it also works on a live repo. /django-seedkit add proper auth inventories what exists and wires the new package in midway: deps, settings, .env example, CI step. A deterministic generator runs once, on day zero.

    The layout is the part worth copying. One SKILL.md walks the questions and routes each answer to exactly one file in references/ (auth.md, billing.md, tasks-celery.md, about 50 of them). Each file keeps only what the model gets wrong: current setting names, current packages. Their benchmark: Sonnet 5 with the skill passed 72 of 72 security and config checks across nine projects; Fable 5 without it missed about a quarter.

    The pattern generalizes past Django: one orchestrator skill that asks the questions, plus a reference pack per stack (Django, Next.js, Flutter). Seedkit ships only the Django pack today.

  • django-ox

    django-ox makes the database the Django task queue: transactional enqueue inside atomic(), no Redis/RabbitMQ, retries, worker-death recovery, recurring schedules, admin and metrics. Adoption read: pilot it for ordinary Django jobs; keep Celery for broker-scale workflows.

  • jetify-com/typeid

    jetify-com/typeid is a spec for Stripe-style IDs: user_01h2xcejqtf2nbrexx3vqjhp41 is a snake_case type prefix, _, then a UUIDv7 in 26 chars of Crockford base32 (hex UUIDs take 36). Time-ordered, so B-tree inserts stay local, unlike UUIDv4. Double-click selects the whole ID, and a serializer expecting user_ rejects a pasted post_ ID. Strip the prefix and you get a valid UUIDv7 back, so the database never has to know. Cheap way to adopt: keep the column a native 16-byte uuid (DEFAULT uuidv7() on Postgres 18, uuid.uuid7() on Python 3.14) and encode/decode only at the API edge, e.g. a DRF serializer field on top of typeid-python. If PKs are already uuid, no schema change, and IDs explain themselves in logs and support tickets.

    Discuss on Mastodon

  • NVIDIA's NOOA framework

    Python’s Ellipsis literal (...) is a real object (type(...) is <class 'ellipsis'>), not just a placeholder. Beyond type stubs and numpy slicing, NVIDIA’s NOOA framework repurposes it as a runtime dispatch marker: methods with ... bodies are completed by an LLM at runtime, while methods with real bodies stay deterministic Python. The boundary between “code I control” and “code the model controls” becomes greppable: grep -n '\.\.\.' agent.py. Clever reuse of existing syntax that linters and type checkers already accept.

    Discuss on Mastodon

  • django-crawl

    django-crawl by Adam Johnson: BFS-crawls your Django site using the test client, no real HTTP overhead. Origin story: diffing CSP headers during a Django 6.0 migration accidentally caught 7 non-CSP bugs in a 100%-coverage project. HTML parsing via Rust (html5ever), follows links/sitemaps/feeds. Works as a management command or a TestCase smoke test that raises ExceptionGroup on errors.

    Discuss on Mastodon

  • import datetime as dt

    Python 3.15 datetime docs now officially recommend import datetime as dt in a Tip block, to disambiguate the module from the datetime.datetime class. The tip cites Adam Johnson’s 2019 post — 6 years from community convention to CPython docs. Fixes both traps: from datetime import datetime shadows the module, and import datetime reads ambiguously as datetime.datetime.now(). via

  • Django Modern REST

    Django Modern REST seems to be an emerging REST API library with focus on performance, scalability and pluggable serializers. Supporting msgpack, CBV and less of sync_to_async. Might evaluate it against the my current preferred django-ninja. gemini

  • zoocache

    zoocache is a sematic dependency based cache manager, that support in-memory, LMDB or redis backends. Integration with Django looks interesting.

  • Free-threaded Python in uv and GitHub Actions

    The free-threaded version of python can be added to uv and github actions with t suffix. e.g. 3.14t and 3.13t source

  • Django Postgres Migration Tools

    “Django Postgres Migration Tools - add-on for safer and more scalable migrations in django.

  • how uv got so fast

    how uv got so fast. UV performance is because of design decisions while rust contributes to micro optimizations.

  • LangGraph

    “LangGraph is an orchestration framework for building stateful multi-agent applications using LLMs. It provides low-level primitives such as nodes and edges, along with built-in features that give developers granular control over agent workflows, memory management and state persistence. This means developers can start with a simple pre-built graph and scale to complex, evolving agent architectures. With support for streaming, advanced context management and resilience patterns like model fallbacks and tool error handling, LangGraph enables you to build robust, production-grade agentic applications. Its graph-based approach ensures predictable, customizable workflows and simplifies debugging and scaling.”

  • Django rapid architecture

    Notes from “Django rapid architecture”

    • Recommends organizing the codebase with interfaces at the top layer followed by readers and “actions”, Finally, ‘data’ as the bottom layer to organize Django codebase to allow for a simple code structure that allows for scaling