Remove iso8601 dependency#2213
Open
waketzheng wants to merge 6 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This removes the mandatory runtime dependency on
iso8601and keeps datetime parsing centralized throughtortoise.timezone.parse_datetime.The new behavior is:
ciso8601.parse_datetimewhen available.tortoise._iso8601.parse_datetimewhenciso8601cannot be imported.timezone.py, so timezone handling stays small and focused.ciso8601, includingZ/zUTC suffixes, compactdatetime strings, week dates, and ordinal dates such as
2020-230and2020230.This also updates the lockfile, removes direct test dependency on
iso8601, and adds Windows CI coveragefor the
accelextra now thatciso8601is no longer excluded on Windows CPython.Motivation and Context
iso8601was only used as a fallback parser whenciso8601was unavailable. That makes it a runtime dependency for a narrow path that can now be covered by Python's standard library on Tortoise ORM's supported Python versions.Keeping
iso8601has become hard to justify:datetime.fromisoformat().ciso8601, while non-accelerated installs depend on a separate third-party parser with subtly different behavior.This change keeps the fast path unchanged for users who install
accel, while making the non-accelerated path self-contained and easier to audit. The fallback parser intentionally preserves the commonciso8601formats that matter for existing Tortoise ORM behavior, so removingiso8601should not narrow normal datetime input support.The
ciso8601platform marker was also relaxed to allow Windows CPython installs. A Windows CI smoke job was added to verify that theaccelextra installs and that the accelerated parser is actually selected on Windows.How Has This Been Tested?
Tested locally on macOS with Python 3.14.2.
GitHub Actions for the latest pushed commit are passing:
Additional coverage added:
Checklist:
AI Disclaimer
This PR was developed with the assistance of either Claude or Codex. I've reviewed and verified the changes.