Skip to content

Clarify warnings.deprecated public API #150076

Description

@flying-sheep

Documentation

The current docs only specify that it sets the __deprecated__ attribute on the deprecated item.

Pydantic relies on its full API: the fact that it’s a class, and that its instances have all passed parameters in attributes: deprecated(**kw).__dict__ == kw basically.

Two questions:

  1. Is that safe or might deprecated get e.g. refactored into a function at some point?
  2. Can we subclass it and add parameters? Will type checkers understand this and still mark a @our_deprecated_subclass(...) def ... as deprecated? See How to extend warnings.deprecated? typing#2256

maybe related to #138165

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions