Skip to content

[python-dateutil] Update to 3.0 and preserve structural inputs - #16615

Draft
pganssle wants to merge 1 commit into
python:mainfrom
pganssle:dateutil-structural-types
Draft

pganssle wants to merge 1 commit into
python:mainfrom
pganssle:dateutil-structural-types

Conversation

@pganssle

Copy link
Copy Markdown
Member

Update the stubs for dateutil 3.0 and carry over signature corrections from dateutil/dateutil#1647, using structural protocols to preserve duck-typed inputs and overloads to describe parser and recurrence results.

This supersedes the version bump in #16593. ISO-parser bytearray support remains covered by #16613.

Differences from the proposed inline annotations

The stubs retain datetime-subclass return types for relativedelta arithmetic, while date inputs have a date return type because adding a time component can promote them to datetime. A separate date/timedelta overload for utils.within_delta handles a mypy inference limitation with the generic subtraction protocol.

The stubs target the released 3.0 implementation, which still includes some compatibility aliases removed on dateutil's main branch. Stub-only protocols use @type_check_only and existing typeshed protocols where available.

Assisted by OpenAI Codex.

Carry over corrections identified while annotating the implementation,
including parser overloads, recurrence return types and duck-typed inputs.
Update the timezone and deprecated zoneinfo APIs for the released 3.0
implementation, and add regression cases for protocol inference and date
subclass behavior.
@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

This branch has not been deployed

No deployments
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.

1 participant