From ddada617298ff2b869e5a33a2b83f374604153bf Mon Sep 17 00:00:00 2001 From: Artur Sadurski Date: Wed, 29 Jul 2015 13:29:28 +0200 Subject: [PATCH] Release 0.3.0 --- CONTRIBUTING.rst | 1 + HISTORY.rst | 12 ++++++++++++ README.rst | 11 +++++------ dateparser/__init__.py | 2 +- dateparser/date.py | 12 +++++++----- setup.py | 4 ++++ 6 files changed, 30 insertions(+), 12 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 45aa084d4..febf51f10 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -32,6 +32,7 @@ Implement Features Look through the GitHub issues for features. Anything tagged with "feature" is open to whoever wants to implement it. +We encourage you to add new languages to existing stack. Write Documentation ~~~~~~~~~~~~~~~~~~~ diff --git a/HISTORY.rst b/HISTORY.rst index f010ddabb..8da026fce 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,18 @@ History ======= +0.3.0 (2015-07-29) +------------------ +New features: + +* Compatibility with Python 3 and PyPy. + +Improvements: + +* `languages.yaml` data cleaned up to make it human-readable. +* Improved Spanish date parsing. + + 0.2.1 (2015-07-13) ------------------ * Support for generic parsing of dates with UTC offset. diff --git a/README.rst b/README.rst index 08d090ac5..bd57ce785 100644 --- a/README.rst +++ b/README.rst @@ -28,9 +28,9 @@ Documentation can be found `here Features ======== -* Generic parsing of dates in English, Spanish, Dutch, Russian and several other langauges and formats. +* Generic parsing of dates in English, Spanish, Dutch, Russian and several other languages and formats. * Generic parsing of relative dates like: ``'1 min ago'``, ``'2 weeks ago'``, ``'3 months, 1 week and 1 day ago'``. -* Generic parsing of dates with time zones abbreviations like: ``'August 14, 2015 EST'``, ``'July 4, 2013 PST'``. +* Generic parsing of dates with time zones abbreviations or UTC offsets like: ``'August 14, 2015 EST'``, ``'July 4, 2013 PST'``, ``'21 July 2013 10:15 pm +0500'``. * Extensive test coverage. @@ -69,7 +69,7 @@ You can specify the language(s), if known, using ``languages`` argument. In this >>> dateparser.parse('2015, Ago 15, 1:08 pm', languages=['pt', 'es']) datetime.datetime(2015, 8, 15, 13, 8) -If you know the possible formats that the date will be, you can +If you know the possible formats of the dates, you can use the ``date_formats`` argument:: >>> dateparser.parse(u'22 Décembre 2010', date_formats=['%d %B %Y']) @@ -98,7 +98,7 @@ Relative Dates Dependencies ============ -`dateparser` translates non-english dates to English and uses dateutil_ module ``'parser'`` to parse the translated date. +`dateparser` translates non-English dates to English and uses dateutil_ module ``parser`` to parse the translated date. Also, it requires PyYAML_ for its language detection module to work. @@ -109,5 +109,4 @@ Also, it requires PyYAML_ for its language detection module to work. Limitations =========== -* Only Python 2 support for now (Python 3 support **will be** added in future versions) - +* Limited language support. diff --git a/dateparser/__init__.py b/dateparser/__init__.py index ec324baf6..7eb79aa82 100644 --- a/dateparser/__init__.py +++ b/dateparser/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -__version__ = '0.2.1' +__version__ = '0.3.0' from .date import DateDataParser diff --git a/dateparser/date.py b/dateparser/date.py index 34cb38117..79b4d689b 100644 --- a/dateparser/date.py +++ b/dateparser/date.py @@ -227,7 +227,7 @@ class DateDataParser(object): string representing date and/or time. :param languages: - A list of two letters language codes.e.g. ['en', 'es']. + A list of two letters language codes, e.g. ['en', 'es']. If languages are given, it will not attempt to detect the language. :type languages: list @@ -267,8 +267,8 @@ def __init__(self, languages=None, allow_redetect_language=False): def get_date_data(self, date_string, date_formats=None): """ - Parse string representing date and/or time in recognizeable localized formats. - Supports parsing multiple languages. + Parse string representing date and/or time in recognizable localized formats. + Supports parsing multiple languages and timezones. :param date_string: A string representing date and/or time in a recognizably valid format. @@ -286,7 +286,7 @@ def get_date_data(self, date_string, date_formats=None): .. note:: *Period* values can be a 'day' (default), 'week', 'month', 'year'. - *Period* represent the granularity of date parsed from the given string. + *Period* represents the granularity of date parsed from the given string. In the example below, since no day information is present, the day is assumed to be current day ``16`` from *current date* (which is June 16, 2015, at the moment of writing this). @@ -301,7 +301,9 @@ def get_date_data(self, date_string, date_formats=None): >>> DateDataParser().get_date_data(u'2014') {'date_obj': datetime.datetime(2014, 6, 16, 0, 0), 'period': u'year'} - TODO: Timezone issues + Dates with time zone indications or UTC offsets are returned in UTC time. + >>> DateDataParser().get_date_data(u'23 March 2000, 1:21 PM CET') + {'date_obj': datetime.datetime(2000, 3, 23, 14, 21), 'period': 'day'} """ date_string = date_string.strip() diff --git a/setup.py b/setup.py index 3b6d79d99..eefd72932 100644 --- a/setup.py +++ b/setup.py @@ -34,6 +34,10 @@ 'Natural Language :: English', "Programming Language :: Python :: 2", 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: Implementation :: PyPy' ], test_suite='nose.collector', tests_require=test_requirements