Skip to content

BUG: Type stub deleted for function that is not even officially deprecated #62911

@quicknir

Description

@quicknir

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd
pd.to_pickle([], "path")

Type check the above code with e.g. mypy.

Issue Description

mypy will say that there is no to_pickle function in pandas, even though the function is there. There was a discussion about how deprecating this function is a good idea in #48402, but it was never deprecated. Even if it were deprecated, removing it from the type stubs completely would not be correct - it should be marked deprecated in the type stub. Removing the function entirely simply because a function was considered being deprecated doesn't seem good.

This came up for me while upgrading my python environment; the upgrade brought pandas-stubs from 2.3.0.250703 to 2.3.2.250926. We use this function dozens of times, and the code still works perfectly, but the mypy checks fail. I could sit down and spend the time to solve this problem as if this function really were going away shortly, but since the function is there, still part of the public API (i.e. part of all), still not deprecated, I'd prefer not to. Can the stub for to_pickle be added back to pandas-stubs for the next release?

Expected Behavior

N/A

Installed Versions

Not relevant

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNeeds TriageIssue that has not been reviewed by a pandas team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions