Skip to content

Releases: CanDgrmc/doctreen-py

Release list

v0.1.0

Choose a tag to compare

@CanDgrmc CanDgrmc released this 01 Aug 17:18

Changelog

0.1.0

First release. Flask works end to end; FastAPI and Django/DRF are supported for the
parts that make sense on each.

Core

  • Schema builder (s) mirroring the Node helper method-for-method, producing JSON
    that is byte-identical to Node's — same values, same key order.
  • Route registry, config normalisation, and an OpenAPI 3.1 exporter with $ref
    dedup, anonymous-schema promotion, security schemes, tags, callbacks, webhooks and
    status-keyed responses.
  • Verified against the Node reference by the shared
    conformance suite, which
    runs the same fixtures through both implementations on every push.

Adapters

  • Flask — reads app.url_map, so there is no router to replace. Path parameters are
    typed from Flask's own converters. @define_route attaches metadata and returns your
    function unchanged. Introspection is lazy, so mount order does not matter.
  • FastAPI / Starlette — consumes app.openapi() rather than deriving a second spec,
    and adds drift. FastAPI's Swagger UI is left alone; DocTreen defaults to /doctreen.
  • Django / DRF — walks the URLconf and reads DRF serializers. A ViewSet expands into
    one documented route per action, each carrying its own docstring.
  • Pydantic v2 and DRF serializers as schema sources.

Runtime

  • Request validation with the standard 422 envelope, checking body, query and path in
    one pass. Optional write-back pushes coerced values at the handler.
  • Response assertion — a development-time check that never touches the body, and is
    status-aware: a 409 is checked against the schema declared for 409.
  • Schema drift detection with sampling, rolling buckets, a pluggable store, webhook
    and callback hooks, announce_routes, and release attribution.

Tooling

  • Docs UI sharing its entire visual surface with the Node package; the stylesheet and
    browser script are extracted verbatim by scripts/sync_ui_assets.py.
  • Integration flows as a shared document format, plus a pytest plugin that runs
    *.flow.json files as tests, and a doctreen-flow CLI.

Notes

  • Requires Python 3.9+. Zero runtime dependencies; everything else is an optional extra.
  • On Python 3.9, write Pydantic fields as Optional[str] rather than str | None
    Pydantic evaluates annotations at runtime.
  • The in-memory drift store is per-process. Under gunicorn or uWSGI each worker keeps its
    own; use a shared drift.store in those deployments.