Skip to content

v0.1.3

Choose a tag to compare

@ashimov ashimov released this 19 Apr 11:11
· 30 commits to main since this release

Highlights

  • Tier 2 complete — bulkhead primitive, feature flags, GraphQL thin mount, gRPC thin mount
  • Tier 1 — free-threaded Python 3.13 wheels (cp313t), PEP 703-aware locking helpers
  • Tier 3 — OpenAPI TS/Python client codegen (hawkapi gen-client), typed routes with auto-inferred response_model
  • DX parity with FastAPI — route-level dependencies=, response_model_exclude_* flags, OAuth2 scopes, hawkapi.status constants
  • Distributed primitives — Redis-backed circuit breaker and adaptive concurrency limiter
  • CI — competitive benchmarks (weekly + release), performance regression gate (5 % threshold), memory budget tests via pytest-memray
  • Migrationhawkapi migrate codemod for FastAPI → HawkAPI

Added

Transports

  • app.mount_grpc(servicer, add_to_server=..., port=50051) — gRPC integration over grpc.aio: ASGI lifespan-tied server lifecycle, built-in HawkAPIObservabilityInterceptor (structured logging + Prometheus metrics), context injection (context.hawkapi_app, context.hawkapi_request_id), reflection toggle with reflection_service_names, TLS passthrough via ssl_credentials, port-merge for multi-servicer setups; zero runtime deps (grpcio imported lazily)
  • app.mount_graphql(path, executor=...) — GraphQL-over-HTTP adapter: POST + GET wire protocol, GraphiQL UI, context injection via context_factory, optional from_graphql_core and from_strawberry adapters behind lazy imports

Feature flags

  • FlagProvider Protocol, StaticFlagProvider / EnvFlagProvider / FileFlagProvider (mtime hot-reload, JSON/TOML/YAML)
  • Flags facade, Depends(get_flags) DI helper with per-request EvalContext
  • @requires_flag decorator (404 on off), plugin hook on_flag_evaluated

Client codegen

  • hawkapi gen-client CLI: zero-dep TypeScript (native fetch) + Python (msgspec) SDKs from OpenAPI 3.1

Typed routes

  • response_model auto-inferred from handler return annotation (msgspec Structs, Pydantic models, generics, Optionals)

FastAPI parity

  • hawkapi.status — HTTP and WebSocket status-code constants
  • Route-level response_model_exclude_none / _unset / _defaults (recursive, zero-overhead when off)
  • Route-level and router-level dependencies=[Depends(...)]
  • Security(dep, *, scopes=[...]), SecurityScopes, per-route scope aggregation, OpenAPI operation.security reflection

Concurrency primitives

  • hawkapi.middleware.Bulkhead — named async concurrency isolator with context-manager and @bulkhead(...) decorator forms
  • LocalBulkheadBackend (default) and RedisBulkheadBackend (distributed, hash + lease-TTL)
  • Prometheus metrics: hawkapi_bulkhead_in_flight, _capacity, _rejections_total, _acquire_latency_seconds

Free-threaded Python 3.13

  • cp313t-cp313t wheels via cibuildwheel (experimental)
  • hawkapi._threading module: FREE_THREADED flag, maybe_thread_lock(), maybe_async_lock()
  • build_mypyc.is_enabled() auto-skips mypyc compilation on free-threaded interpreters
  • PEP 779 Programming Language :: Python :: Free Threading :: 1 - Unstable trove classifier

Migration and CI

  • hawkapi migrate codemod — AST-driven FastAPI → HawkAPI rewrites
  • Performance regression gate: committed baseline + pytest-benchmark --benchmark-compare-fail
  • Memory budget tests via pytest-memray
  • Competitive benchmark CI (weekly cron + release trigger, wrk on ubuntu-latest, auto-PR of refreshed RESULTS.md)
  • Redis-backed circuit breaker (RedisCircuitBreakerMiddleware)
  • Adaptive concurrency limiter middleware
  • HTTP/2 deployment guide

Docs

  • docs/guide/grpc.md, docs/guide/graphql.md, docs/guide/feature-flags.md
  • docs/guide/bulkhead.md, docs/guide/free-threaded.md, docs/guide/benchmarks.md

Full changelog: https://github.com/ashimov/HawkAPI/blob/v0.1.3/CHANGELOG.md