Skip to content

use pandas.api.typing.aliases#1668

Merged
loicdiridollou merged 2 commits intopandas-dev:mainfrom
Dr-Irv:typing-aliases
Feb 9, 2026
Merged

use pandas.api.typing.aliases#1668
loicdiridollou merged 2 commits intopandas-dev:mainfrom
Dr-Irv:typing-aliases

Conversation

@Dr-Irv
Copy link
Collaborator

@Dr-Irv Dr-Irv commented Feb 9, 2026

With 3.0, the goal of adding pandas.api.typing.aliases was to get people to stop importing from pandas._typing. This PR adds the aliases, and modifies the tests to import from that module.

There are a few aliases that need to be added back into pandas, which I will handle via a PR there

  • IntervalClosedType
  • IntervalLeftRight
  • ListLike
  • ScalarIndexer
  • SequenceIndexer

Once a new version of pandas is released with those changes, we can modify the tests that need to use TYPE_CHECKING to no longer need them.

@Dr-Irv
Copy link
Collaborator Author

Dr-Irv commented Feb 9, 2026

PR for pandas is here: pandas-dev/pandas#64098

Copy link
Member

@loicdiridollou loicdiridollou left a comment

Choose a reason for hiding this comment

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

Overall good, just let me know about this tests/_typing.py file.
Other question, should we wait for your PR on the pandas repo to go through to merge this one or not?

@@ -1,171 +1,1263 @@
# ruff: noqa: PLC0414
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to make the changes to this file? Always confused if it needs to be committed or not

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No - that was my mistake.

@Dr-Irv
Copy link
Collaborator Author

Dr-Irv commented Feb 9, 2026

Overall good, just let me know about this tests/_typing.py file.

That was a mistake - should not have committed it.

Other question, should we wait for your PR on the pandas repo to go through to merge this one or not?

No, because we'd still have to wait for the release of pandas 3.0.1 or 3.1.

Once that release happens with the changes there, I can update pandas-stubs to accommodate those changes.

Copy link
Member

@loicdiridollou loicdiridollou left a comment

Choose a reason for hiding this comment

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

Great, thanks @Dr-Irv

@loicdiridollou loicdiridollou merged commit 1a40972 into pandas-dev:main Feb 9, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants