Skip to content

Latest commit

 

History

History
41 lines (34 loc) · 2.31 KB

File metadata and controls

41 lines (34 loc) · 2.31 KB

Registry — where it lives outside this repo

Cited, real implementations to study (or point an agent at) when designing or reviewing registry-shaped code.

Python standard library

Major ecosystems

  • Flask route decorators. @app.route("/users") fills the URL map — a registry populated at import time, which is why a views module that never gets imported serves 404s (the caveat, in production form). flask.palletsprojects.com
  • Django admin.site.register. The explicit-call flavor: the admin is a registry of model → options, filled in each app's admin.py — a module Django deliberately auto-imports, solving the import-time problem by convention. docs.djangoproject.com/en/stable/ref/contrib/admin/
  • setuptools entry points. Registration moved out of code into package metadata, so plugins in other distributions are discoverable without any import — the industrial-strength answer to "a plugin nobody imports". packaging.python.org/en/latest/specifications/entry-points/

What to notice across all of them

Each one has an explicit answer to the two policy questions: unknown names (LookupError from codecs, 404 from Flask) and registration time (import side effects, auto-imported conventions, or metadata). When reviewing registry code, find both answers; if either is implicit, that's the bug waiting.