Skip to content

feat: log deprecations once per process #727

Closed

Description

@uniqueg

FOCA 0.22.0 deprecates several APIs ahead of the ASGI release:

  • app.config.foca (reading, setting, deleting) and get_app_config();
  • Unauthorized(www_authenticate=...) and Unauthorized.www_authenticate;
  • x-body-name: permission for the permissions API.

Each of these emits a DeprecationWarning. Python hides DeprecationWarning outside __main__ by default, so operators running apps under Gunicorn never see them. As decided by the maintainer, FOCA should also log each deprecation once per process at WARNING level.

Do:

  • One shared helper emits the DeprecationWarning, with the caller's stack level, as before. The first time a deprecation fires in a process, it also logs the message at WARNING on a FOCA logger. The log is keyed per deprecation, is thread-safe and never fails the call. FOCA's deprecations use it.
  • Docs: say in docs/migration-0.22.md and the logging configuration docs (docs/configuration/log.md) that deprecations are logged once per process, name the logger, and say how to silence it.
  • Tests: a deprecation logs once per process, and the warning is still emitted on every call. The existing deprecation tests stay green.

Out of scope: the warning that FOCA already logs, once per class, for exception maps with raw Werkzeug classes.

Activity

  1. added this to the v0.22.0 milestone on Nov 6, 2026
  2. added
    priority: medium
    status: in progress
    type: feature
    workload: hours
    on Nov 6, 2026
  3. removed
    status: in progress
    on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: mediumtype: featureworkload: hours

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions