Skip to content

Remove typing aliases deprecated in python 3.9. Also replace usages of typing.Union/Optional with |#5277

Open
DylanRussell wants to merge 7 commits into
open-telemetry:mainfrom
DylanRussell:new11
Open

Remove typing aliases deprecated in python 3.9. Also replace usages of typing.Union/Optional with |#5277
DylanRussell wants to merge 7 commits into
open-telemetry:mainfrom
DylanRussell:new11

Conversation

@DylanRussell

@DylanRussell DylanRussell commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Description

Removing typing aliases deprecated in python 3.9 -- see https://docs.python.org/3/library/typing.html#deprecated-aliases -- replacing them with the now supported collections.abc equivalent

Replace all usages of typing.Union and typing.Optional with |.

Type of change

  • [ x] Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Unit tests

Does This PR Require a Contrib Repo Change?

  • Yes. - Link to PR:
  • [ x] No.

Checklist:

  • [ x] Followed the style guidelines of this project
  • [ x] Changelogs have been updated
  • [ x] Unit tests have been added
  • [ x] Documentation has been updated

@DylanRussell DylanRussell requested a review from a team as a code owner June 5, 2026 19:41
@DylanRussell DylanRussell changed the title Remove typing aliases deprecated in python 3.9 Remove typing aliases deprecated in python 3.9. Also replace usages of typing.Union with | Jun 5, 2026
Comment thread codegen/opentelemetry-codegen-json/src/opentelemetry/codegen/json/generator.py Outdated
DylanRussell and others added 2 commits June 8, 2026 14:36
…son/generator.py

Co-authored-by: Lukas Hering <40302054+herin049@users.noreply.github.com>
Comment thread opentelemetry-proto-json/src/opentelemetry/proto_json/logs/v1/logs.py Outdated

@emdneto emdneto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why ruff didn't catch this

@DylanRussell DylanRussell changed the title Remove typing aliases deprecated in python 3.9. Also replace usages of typing.Union with | Remove typing aliases deprecated in python 3.9. Also replace usages of typing.Union/Optional with | Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants