METADATA 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. Metadata-Version: 2.1
  2. Name: isodate
  3. Version: 0.7.2
  4. Summary: An ISO 8601 date/time/duration parser and formatter
  5. Author: Gerhard Weis
  6. License: Copyright (c) 2021, Hugo van Kemenade and contributors
  7. Copyright (c) 2009-2018, Gerhard Weis and contributors
  8. Copyright (c) 2009, Gerhard Weis
  9. All rights reserved.
  10. Redistribution and use in source and binary forms, with or without
  11. modification, are permitted provided that the following conditions are met:
  12. * Redistributions of source code must retain the above copyright
  13. notice, this list of conditions and the following disclaimer.
  14. * Redistributions in binary form must reproduce the above copyright
  15. notice, this list of conditions and the following disclaimer in the
  16. documentation and/or other materials provided with the distribution.
  17. * Neither the name of the <organization> nor the
  18. names of its contributors may be used to endorse or promote products
  19. derived from this software without specific prior written permission.
  20. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  21. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  22. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  23. DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  24. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  25. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  26. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  27. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  29. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. Project-URL: Homepage, https://github.com/gweis/isodate/
  31. Classifier: Development Status :: 4 - Beta
  32. Classifier: Intended Audience :: Developers
  33. Classifier: License :: OSI Approved :: BSD License
  34. Classifier: Operating System :: OS Independent
  35. Classifier: Programming Language :: Python
  36. Classifier: Programming Language :: Python :: 3
  37. Classifier: Programming Language :: Python :: 3.7
  38. Classifier: Programming Language :: Python :: 3.8
  39. Classifier: Programming Language :: Python :: 3.9
  40. Classifier: Programming Language :: Python :: 3.10
  41. Classifier: Programming Language :: Python :: 3.11
  42. Classifier: Programming Language :: Python :: 3.12
  43. Classifier: Programming Language :: Python :: 3.13
  44. Classifier: Programming Language :: Python :: Implementation :: CPython
  45. Classifier: Programming Language :: Python :: Implementation :: PyPy
  46. Classifier: Topic :: Internet
  47. Classifier: Topic :: Software Development :: Libraries :: Python Modules
  48. Requires-Python: >=3.7
  49. Description-Content-Type: text/x-rst
  50. License-File: LICENSE
  51. ISO 8601 date/time parser
  52. =========================
  53. .. image:: https://travis-ci.org/gweis/isodate.svg?branch=master
  54. :target: https://travis-ci.org/gweis/isodate
  55. :alt: Travis-CI
  56. .. image:: https://coveralls.io/repos/gweis/isodate/badge.svg?branch=master
  57. :target: https://coveralls.io/r/gweis/isodate?branch=master
  58. :alt: Coveralls
  59. .. image:: https://img.shields.io/pypi/v/isodate.svg
  60. :target: https://pypi.python.org/pypi/isodate/
  61. :alt: Latest Version
  62. .. image:: https://img.shields.io/pypi/l/isodate.svg
  63. :target: https://pypi.python.org/pypi/isodate/
  64. :alt: License
  65. This module implements ISO 8601 date, time and duration parsing.
  66. The implementation follows ISO8601:2004 standard, and implements only
  67. date/time representations mentioned in the standard. If something is not
  68. mentioned there, then it is treated as non existent, and not as an allowed
  69. option.
  70. For instance, ISO8601:2004 never mentions 2 digit years. So, it is not
  71. intended by this module to support 2 digit years. (while it may still
  72. be valid as ISO date, because it is not explicitly forbidden.)
  73. Another example is, when no time zone information is given for a time,
  74. then it should be interpreted as local time, and not UTC.
  75. As this module maps ISO 8601 dates/times to standard Python data types, like
  76. *date*, *time*, *datetime* and *timedelta*, it is not possible to convert
  77. all possible ISO 8601 dates/times. For instance, dates before 0001-01-01 are
  78. not allowed by the Python *date* and *datetime* classes. Additionally
  79. fractional seconds are limited to microseconds. That means if the parser finds
  80. for instance nanoseconds it will round it down to microseconds.
  81. Documentation
  82. -------------
  83. The following parsing methods are available.
  84. * parse_time:
  85. parses an ISO 8601 time string into a *time* object
  86. * parse_date:
  87. parses an ISO 8601 date string into a *date* object
  88. * parse_datetime:
  89. parses an ISO 8601 date-time string into a *datetime* object
  90. * parse_duration:
  91. parses an ISO 8601 duration string into a *timedelta* or *Duration*
  92. object.
  93. * parse_tzinfo:
  94. parses the time zone info part of an ISO 8601 string into a
  95. *tzinfo* object.
  96. As ISO 8601 allows to define durations in years and months, and *timedelta*
  97. does not handle years and months, this module provides a *Duration* class,
  98. which can be used almost like a *timedelta* object (with some limitations).
  99. However, a *Duration* object can be converted into a *timedelta* object.
  100. There are also ISO formatting methods for all supported data types. Each
  101. *xxx_isoformat* method accepts a format parameter. The default format is
  102. always the ISO 8601 expanded format. This is the same format used by
  103. *datetime.isoformat*:
  104. * time_isoformat:
  105. Intended to create ISO time strings with default format
  106. *hh:mm:ssZ*.
  107. * date_isoformat:
  108. Intended to create ISO date strings with default format
  109. *yyyy-mm-dd*.
  110. * datetime_isoformat:
  111. Intended to create ISO date-time strings with default format
  112. *yyyy-mm-ddThh:mm:ssZ*.
  113. * duration_isoformat:
  114. Intended to create ISO duration strings with default format
  115. *PnnYnnMnnDTnnHnnMnnS*.
  116. * tz_isoformat:
  117. Intended to create ISO time zone strings with default format
  118. *hh:mm*.
  119. * strftime:
  120. A re-implementation mostly compatible with Python's *strftime*, but
  121. supports only those format strings, which can also be used for dates
  122. prior 1900. This method also understands how to format *datetime* and
  123. *Duration* instances.
  124. Installation
  125. ------------
  126. This module can easily be installed with Python standard installation methods.
  127. Use *pip install isodate*.
  128. Limitations
  129. -----------
  130. * The parser accepts several date/time representation which should be invalid
  131. according to ISO 8601 standard.
  132. 1. for date and time together, this parser accepts a mixture of basic and extended format.
  133. e.g. the date could be in basic format, while the time is accepted in extended format.
  134. It also allows short dates and times in date-time strings.
  135. 2. For incomplete dates, the first day is chosen. e.g. 19th century results in a date of
  136. 1901-01-01.
  137. 3. negative *Duration* and *timedelta* value are not fully supported yet.
  138. Further information
  139. -------------------
  140. The doc strings and unit tests should provide rather detailed information about
  141. the methods and their limitations.
  142. The source release provides a *setup.py* script,
  143. which can be used to run the unit tests included.
  144. Source code is available at `<https://github.com/gweis/isodate>`_.
  145. CHANGES
  146. =======
  147. 0.7.3 (unreleased)
  148. ------------------
  149. - no changes yet
  150. 0.7.2 (2024-10-08)
  151. ------------------
  152. - drop end of life python versions
  153. - Don't match garbage characters at the end of parsed strings #16 (Gabriel de Perthuis)
  154. Potentially breaking changes:
  155. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  156. - Fractional seconds are cut off to microseconds (always round down)
  157. - Allow control over return type of parse_duration #64 (Felix Claessen)
  158. - Python >= 3.7 required
  159. 0.6.1 (2021-12-13)
  160. ------------------
  161. - support python 3.10 (Hugo van Kemenade)
  162. - last version to support py 2.7
  163. 0.6.0 (2017-10-13)
  164. ------------------
  165. - support incomplete month date (Fabien Loffredo)
  166. - rely on duck typing when doing duration maths
  167. - support ':' as separator in fractional time zones (usrenmae)
  168. 0.5.4 (2015-08-06)
  169. ------------------
  170. - Fix parsing of Periods (Fabien Bochu)
  171. - Make Duration objects hashable (Geoffrey Fairchild)
  172. - Add multiplication to duration (Reinoud Elhorst)
  173. 0.5.1 (2014-11-07)
  174. ------------------
  175. - fixed pickling of Duration objects
  176. - raise ISO8601Error when there is no 'T' separator in datetime strings (Adrian Coveney)
  177. 0.5.0 (2014-02-23)
  178. ------------------
  179. - ISO8601Error are subclasses of ValueError now (Michael Hrivnak)
  180. - improve compatibility across various python variants and versions
  181. - raise exceptions when using fractional years and months in date
  182. maths with durations
  183. - renamed method todatetime on Duraction objects to totimedelta
  184. 0.4.9 (2012-10-30)
  185. ------------------
  186. - support pickling FixedOffset instances
  187. - make sure parsed fractional seconds are in microseconds
  188. - add leading zeros when formattig microseconds (Jarom Loveridge)
  189. 0.4.8 (2012-05-04)
  190. ------------------
  191. - fixed incompatibility of unittests with python 2.5 and 2.6 (runs fine on 2.7
  192. and 3.2)
  193. 0.4.7 (2012-01-26)
  194. ------------------
  195. - fixed tzinfo formatting (never pass None into tzinfo.utcoffset())
  196. 0.4.6 (2012-01-06)
  197. ------------------
  198. - added Python 3 compatibility via 2to3
  199. 0.4.5 (2012-01-06)
  200. ------------------
  201. - made setuptools dependency optional
  202. 0.4.4 (2011-04-16)
  203. ------------------
  204. - Fixed formatting of microseconds for datetime objects
  205. 0.4.3 (2010-10-29)
  206. ------------------
  207. - Fixed problem with %P formatting and fractions (supplied by David Brooks)
  208. 0.4.2 (2010-10-28)
  209. ------------------
  210. - Implemented unary - for Duration (supplied by David Brooks)
  211. - Output fractional seconds with '%P' format. (partly supplied by David Brooks)
  212. 0.4.1 (2010-10-13)
  213. ------------------
  214. - fixed bug in comparison between timedelta and Duration.
  215. - fixed precision problem with microseconds (reported by Tommi Virtanen)
  216. 0.4.0 (2009-02-09)
  217. ------------------
  218. - added method to parse ISO 8601 time zone strings
  219. - added methods to create ISO 8601 conforming strings
  220. 0.3.0 (2009-1-05)
  221. ------------------
  222. - Initial release
  223. TODOs
  224. =====
  225. This to do list contains some thoughts and ideas about missing features, and
  226. parts to think about, whether to implement them or not. This list is probably
  227. not complete.
  228. Missing features:
  229. -----------------
  230. * time formatting does not allow to create fractional representations.
  231. * parser for ISO intervals.
  232. * currently microseconds are always padded to a length of 6 characters.
  233. trailing 0s should be optional
  234. Documentation:
  235. --------------
  236. * parse_datetime:
  237. - complete documentation to show what this function allows, but ISO forbids.
  238. and vice verse.
  239. - support other separators between date and time than 'T'
  240. * parse_date:
  241. - yeardigits should be always greater than 4
  242. - dates before 0001-01-01 are not supported
  243. * parse_duration:
  244. - alternative formats are not fully supported due to parse_date restrictions
  245. - standard duration format is fully supported but not very restrictive.
  246. * Duration:
  247. - support fractional years and month in calculations
  248. - implement w3c order relation? (`<http://www.w3.org/TR/xmlschema-2/#duration-order>`_)
  249. - refactor to have duration mathematics only at one place.
  250. - localize __str__ method (does timedelta do this?)
  251. - when is a Duration negative?
  252. - normalize Durations. months [00-12] and years ]-inf,+inf[