msrest-for-python
msrest-for-python copied to clipboard
Replace isodate
Following discussion with @zooba about isodate:
- Isodate is not maintained anymore for 2 years. Direct Gmail email to the author get no answer as well.
- Isodate still uses 2to3
- I got no issue adapting it without 2to3, but since the owner abandoned the project, it's useless.
The features we use of isodate are:
- Parsing / serializing of ISO8601 datetime
- Parsing / serializing of ISO8601 duration
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.
FYI @johanste
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?