A request to un-deprecate (resurrect) timeutils.isotime()
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
oslo.utils |
Opinion
|
Undecided
|
Amrith Kumar |
Bug Description
Earlier changes and discussions concluded that it was appropriate for OSLO to deprecate timeutils.
For a summary of those reasons and considerations, readers are directed to https:/
A more recent ML thread is at http://
An unfortunate consequence of the proposed deprecation of the isotime() function, the perfectly valid recommendation that datetime.
This kind of thing has been proposed three times (and rejected) in Trove.
https:/
https:/
https:/
It strikes me as not a good thing for all projects to have this same code in their respective projects if it is felt that it is worth deprecating from oslo. On the other hand, I also see the rationale why projects are looking to maintain the same code that was in oslo_utils.
To that end, I think the issue(s) with isotime() in OSLO are fixable and it is beneficial if the code remains in a single location (oslo_utils.
This bug is being added for two reasons.
First, in the proposed change I will reference it and it will serve as a record of why it was felt that we should not deprecate the isotime() code.
Second, it will provide an explanation of the change being proposed and the rationale.
----
The issue(s) with the old isotime() include the fact that it was:
- not timezone aware
- did not respect timezones when they were part of a timestamp
The issue with just expecting projects to use datetime.
For these reasons, projects opted in some cases to just keep the isotime() code in their projects; warts and all.
The code being proposed with the fix for this bug will attempt to address the issues with isotime() and minimize the issues for projects that use them.
Changed in oslo.utils: | |
assignee: | nobody → Amrith (amrith) |
Another gnarly problem is that isotime() does two things that make it not quite iso.
First, it uses this thing called PERFECT_TIME_FORMAT which isn't.
_ISO8601_ TIME_FORMAT_ SUBSECOND = '%Y-%m- %dT%H:% M:%S.%f' TIME_FORMAT = '%Y-%m-%dT%H:%M:%S' TIME_FORMAT_ SUBSECOND
_ISO8601_
PERFECT_TIME_FORMAT = _ISO8601_
It is NOT (as best as I can tell) to have a subsecond time with no timezone information. (see: RFC 3339, section 5.6).
date-time = full-date "T" full-time
full-time = partial-time time-offset
partial-time = time-hour ":" time-minute ":" time-second [time-secfrac]
time-offset = "Z" / time-numoffset
time-numoffset = ("+" / "-") time-hour ":" time-minute
Observe therefore that full-time has only one optional component; time-secfrac. time-offset is mandatory.
Second, isotime() uses iso8601 (the python library), which is kind-of on thin ice in some areas.
For example, see http:// pyiso8601. readthedocs. io/en/latest/ #where- it-differs- from-iso- 8601
In the documentation for 'latest' (current: iso8601 0.1.11), I see that there are three 'listed' differences.
I see immediately above, in the 'Time Zones' section (http:// pyiso8601. readthedocs. io/en/latest/ #time-zones) that there are five time zones supported. Three of them are iso8601, two are not. +/-HH is the other one that is NOT iso8601.
So it happens that PERFECT_TIME_FORMAT is really not consistent with RFC 3339 and something that iso8601 (the library) does support.
These two things mean that it may well be worthwhile considering (also) submitting fixes to iso8601 (the library).