You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Datetime is simple, and move from isodate is straightforward.
Duration is way more complicated, since this is relative duration (one month can't be converted to timedelta). Isodate algorithm returns timedelta instances for duration defined in days/hours/..., and a specific isodate.Duration class for ambiguous relative duration. It's dynamic based on what is parsed.
I found aniso8601 to parse duration. Aniso8601 is not using dynamic return type, there is a relative flag to decide if you want timedelta (might be converted with 1 month == 30 days), or dateutil.relativedelta to keep the precision. Aniso8601 does not serialize, but it's not the most complicated part.
Moving this dependency will also imply that users will get different object from a SDK call, moving from the couple timedelta/isodate.Duration to dateutil.relativedelta.
Considering that the issue itself (2to3 on Py3 install) is not that critical for now, and that there is no direct obvious solution, I plan to do nothing for now, but I keep this issue open for the record of what I found. Eventually we'll have to work on this.
It's really easy to fix isolate and maintain it. I did that months ago for the compatibility with Azure Functions in Py 3.6. https://github.com/smereczynski/isodate. Maybe it will be much easier to fork it and include?
Following discussion with @zooba about isodate:
The features we use of isodate are:
Datetime is simple, and move from isodate is straightforward.
Duration is way more complicated, since this is relative duration (one month can't be converted to
timedelta
). Isodate algorithm returnstimedelta
instances for duration defined in days/hours/..., and a specificisodate.Duration
class for ambiguous relative duration. It's dynamic based on what is parsed.I found aniso8601 to parse duration. Aniso8601 is not using dynamic return type, there is a
relative
flag to decide if you wanttimedelta
(might be converted with 1 month == 30 days), ordateutil.relativedelta
to keep the precision. Aniso8601 does not serialize, but it's not the most complicated part.Moving this dependency will also imply that users will get different object from a SDK call, moving from the couple
timedelta
/isodate.Duration
todateutil.relativedelta
.Considering that the issue itself (2to3 on Py3 install) is not that critical for now, and that there is no direct obvious solution, I plan to do nothing for now, but I keep this issue open for the record of what I found. Eventually we'll have to work on this.
FYI @johanste
The text was updated successfully, but these errors were encountered: