Skip to content

Replace deprecated package with warnings/typing_extensions deprecated #4467

@jenshnielsen

Description

@jenshnielsen

Is your feature request related to a problem?

I was wondering if there is any interest in replacing deprecated decorator from the deprecated package with the one from the standard library (or typing_extensions for python <3.13).

This has two primary benefits.

  • It removes the dependency on deprecated and wrapt. Specially wrapt is a compiled dependency that may not be available for all python versions and platforms
  • Deprecation can be statically discovered by the type checker and highlighted in an editor e.g. vscode with show a deprecated call with a strike out.

If there is interest, I can submit a pr with the changes.

Describe the solution you'd like

Replace deprecated decorator with the one from typing_extensions / warnings.

This can either be dome by always using typing_extensions or using a conditional import and depend on typing_extensions for python <3.13

This would change the dependencies of opentelemtry_api from

deprecated
importlib-metadata
wrapt
zipp

to

typing_extensions
importlib-metadata
zipp

Describe alternatives you've considered

  • Continue as is:
    This has the negative implications of including heavier dependencies than needed specifically wrapt that is a compile d dependency that sometimes breaks for newer python versions and may not be available for all systems.

  • Remove all deprecated methods and functions and drop deprecated.
    Probably not realistic any time soon as there are many deprecated items

Additional Context

No response

Would you like to implement a fix?

Yes

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions