NAS-140909 / 27.0.0-BETA.1 / remove isodate dependency#357
Merged
Conversation
Contributor
Author
|
time 00:45 |
bmeagherix
approved these changes
May 5, 2026
|
This PR has been merged and conversations have been locked. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Replaces the
isodatethird-party package with builtin Python functionality. The package was used in only three files for two functions, both easily covered by the standard library now that the project requires Python 3.11+.parse_durationhelper inzettarepl/utils/datetime.py. It accepts ISO 8601 durations restricted to weeks, days, hours, minutes, and seconds, which is the full set of components representable as atimedeltaand the only set ever used in this codebase.isodate.parse_durationcalls inzettarepl/snapshot/task/task.pyandzettarepl/replication/task/retention_policy.pywith the new helper.isodate.parse_timecalls inzettarepl/scheduler/cron.pywith the stdlibdatetime.time.fromisoformat, which handles every begin/end value the project uses.isodatefromsetup.pyand removed the matching mypy override frompyproject.toml.The primary caller is the TrueNAS middleware. In
middlewared/plugins/zettarepl.py,lifetime_iso8601always emits durations of the formPT<int>S. Even MONTH and YEAR units are pre-flattened to days at the middleware layer (30 and 365 days respectively) before being formatted, so ISO year and month components never reach zettarepl. Thebeginandendschedule values are likewise emitted as plainHH MMstrings.The existing
lifetimetype annotation istimedelta, which means year and month durations were already implicitly unsupported. Sorting them inCustomSnapshotRetentionPolicywould have failed becauseisodate.Durationdoes not compare withtimedelta. The new helper rejects those components explicitly rather than silently producing a value that breaks downstream code.The hand-written YAML configs that appear in the integration tests use only
P1D,P14D,P30D,P7W, andPT1H, all of which the new parser handles.--strictreports no issues on the four changed source files.