parsedatetime


Nameparsedatetime JSON
Version 2.6 PyPI version JSON
download
home_pagehttps://github.com/bear/parsedatetime
SummaryParse human-readable date/time text.
upload_time2020-05-31 23:50:57
maintainer
docs_urlNone
authorMike Taylor
requires_python
licenseApache License 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            parsedatetime
=============

Parse human-readable date/time strings.

Python 2.6 or greater is required for parsedatetime version 1.0 or greater.

While we still test with Python 2.6 we cannot guarantee that future changes will not break under 2.6

.. image:: https://img.shields.io/pypi/v/parsedatetime.svg
    :target: https://pypi.python.org/pypi/parsedatetime/
    :alt: Downloads

.. image:: https://travis-ci.org/bear/parsedatetime.svg?branch=master
    :target: https://travis-ci.org/bear/parsedatetime
    :alt: Travis CI

.. image:: http://codecov.io/github/bear/parsedatetime/coverage.svg?branch=master
    :target: http://codecov.io/github/bear/parsedatetime
    :alt: Codecov

.. image:: https://requires.io/github/bear/parsedatetime/requirements.svg?branch=master
     :target: https://requires.io/github/bear/parsedatetime/requirements/?branch=master
     :alt: Requirements Status

.. image:: https://dependencyci.com/github/bear/parsedatetime/badge
     :target: https://dependencyci.com/github/bear/parsedatetime
     :alt: Dependency Status

==========
Installing
==========

You can install parsedatetime using::

    pip install parsedatetime

=============
Running Tests
=============

From the source directory::

    make test

To run tests on several python versions, type ``make tox``::

  $ make tox
  [... tox creates a virtualenv for every python version and runs tests inside of each]
  py27: commands succeeded
  py35: commands succeeded

This assumes that you have the versions you want to test under installed as part of your
PyEnv environment::

    pyenv install -s 2.6.9
    pyenv install -s 2.7.11
    pyenv install -s 3.5.2
    pyenv install -s pypy-5.3
    pyenv global 2.7.11 3.5.2 2.6.9 pypy-5.3

The tests depend on PyICU being installed using the `pyicu-binary` package which removes the source build step. PyICU depends on icu4c which on macOS requires homebrew::

    brew install icu4c

The Makefile contains the macOS default values for them so you may need to tweak them.

===================
Using parsedatetime
===================

An example of how to use parsedatetime:


.. code:: python

    import parsedatetime

    cal = parsedatetime.Calendar()

    cal.parse("tomorrow")

To get it to a Python ``datetime`` object:


.. code:: python

    from datetime import datetime

    time_struct, parse_status = cal.parse("tomorrow")

    datetime(*time_struct[:6])

Parse datetime with timezone support (using pytz package):

.. code:: python

    import parsedatetime
    import pytz
    from pytz import timezone

    cal = parsedatetime.Calendar()

    datetime_obj, _ = cal.parseDT(datetimeString="tomorrow", tzinfo=timezone("US/Pacific"))

More detailed examples can be found in the examples directory.

=============
Documentation
=============

The generated documentation is included by default in the docs directory and can also be viewed online at https://bear.im/code/parsedatetime/docs/index.html

The docs can be generated by running::

    make docs

=====
Notes
=====

The ``Calendar`` class has a member property named ``ptc`` which is created during the class init method to be an instance
of ``parsedatetime_consts.CalendarConstants()``.

=======
History
=======

The code in parsedatetime has been implemented over the years in many different languages (C, Clipper, Delphi) as part of different custom/proprietary systems I've worked on.  Sadly the previous code is not "open" in any sense of that word.

When I went to work for Open Source Applications Foundation and realized that the Chandler project could benefit from my experience with parsing of date/time text I decided to start from scratch and implement the code using Python and make it truly open.

After working on the initial concept and creating something that could be shown to the Chandler folks, the code has now evolved to its current state with the help of the Chandler folks, most especially Darshana.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/bear/parsedatetime",
    "name": "parsedatetime",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Mike Taylor",
    "author_email": "bear@bear.im",
    "download_url": "https://files.pythonhosted.org/packages/a8/20/cb587f6672dbe585d101f590c3871d16e7aec5a576a1694997a3777312ac/parsedatetime-2.6.tar.gz",
    "platform": "Any",
    "description": "parsedatetime\n=============\n\nParse human-readable date/time strings.\n\nPython 2.6 or greater is required for parsedatetime version 1.0 or greater.\n\nWhile we still test with Python 2.6 we cannot guarantee that future changes will not break under 2.6\n\n.. image:: https://img.shields.io/pypi/v/parsedatetime.svg\n    :target: https://pypi.python.org/pypi/parsedatetime/\n    :alt: Downloads\n\n.. image:: https://travis-ci.org/bear/parsedatetime.svg?branch=master\n    :target: https://travis-ci.org/bear/parsedatetime\n    :alt: Travis CI\n\n.. image:: http://codecov.io/github/bear/parsedatetime/coverage.svg?branch=master\n    :target: http://codecov.io/github/bear/parsedatetime\n    :alt: Codecov\n\n.. image:: https://requires.io/github/bear/parsedatetime/requirements.svg?branch=master\n     :target: https://requires.io/github/bear/parsedatetime/requirements/?branch=master\n     :alt: Requirements Status\n\n.. image:: https://dependencyci.com/github/bear/parsedatetime/badge\n     :target: https://dependencyci.com/github/bear/parsedatetime\n     :alt: Dependency Status\n\n==========\nInstalling\n==========\n\nYou can install parsedatetime using::\n\n    pip install parsedatetime\n\n=============\nRunning Tests\n=============\n\nFrom the source directory::\n\n    make test\n\nTo run tests on several python versions, type ``make tox``::\n\n  $ make tox\n  [... tox creates a virtualenv for every python version and runs tests inside of each]\n  py27: commands succeeded\n  py35: commands succeeded\n\nThis assumes that you have the versions you want to test under installed as part of your\nPyEnv environment::\n\n    pyenv install -s 2.6.9\n    pyenv install -s 2.7.11\n    pyenv install -s 3.5.2\n    pyenv install -s pypy-5.3\n    pyenv global 2.7.11 3.5.2 2.6.9 pypy-5.3\n\nThe tests depend on PyICU being installed using the `pyicu-binary` package which removes the source build step. PyICU depends on icu4c which on macOS requires homebrew::\n\n    brew install icu4c\n\nThe Makefile contains the macOS default values for them so you may need to tweak them.\n\n===================\nUsing parsedatetime\n===================\n\nAn example of how to use parsedatetime:\n\n\n.. code:: python\n\n    import parsedatetime\n\n    cal = parsedatetime.Calendar()\n\n    cal.parse(\"tomorrow\")\n\nTo get it to a Python ``datetime`` object:\n\n\n.. code:: python\n\n    from datetime import datetime\n\n    time_struct, parse_status = cal.parse(\"tomorrow\")\n\n    datetime(*time_struct[:6])\n\nParse datetime with timezone support (using pytz package):\n\n.. code:: python\n\n    import parsedatetime\n    import pytz\n    from pytz import timezone\n\n    cal = parsedatetime.Calendar()\n\n    datetime_obj, _ = cal.parseDT(datetimeString=\"tomorrow\", tzinfo=timezone(\"US/Pacific\"))\n\nMore detailed examples can be found in the examples directory.\n\n=============\nDocumentation\n=============\n\nThe generated documentation is included by default in the docs directory and can also be viewed online at https://bear.im/code/parsedatetime/docs/index.html\n\nThe docs can be generated by running::\n\n    make docs\n\n=====\nNotes\n=====\n\nThe ``Calendar`` class has a member property named ``ptc`` which is created during the class init method to be an instance\nof ``parsedatetime_consts.CalendarConstants()``.\n\n=======\nHistory\n=======\n\nThe code in parsedatetime has been implemented over the years in many different languages (C, Clipper, Delphi) as part of different custom/proprietary systems I've worked on.  Sadly the previous code is not \"open\" in any sense of that word.\n\nWhen I went to work for Open Source Applications Foundation and realized that the Chandler project could benefit from my experience with parsing of date/time text I decided to start from scratch and implement the code using Python and make it truly open.\n\nAfter working on the initial concept and creating something that could be shown to the Chandler folks, the code has now evolved to its current state with the help of the Chandler folks, most especially Darshana.\n\n\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Parse human-readable date/time text.",
    "version": "2.6",
    "project_urls": {
        "Download": "https://pypi.python.org/pypi/parsedatetime",
        "Homepage": "https://github.com/bear/parsedatetime"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9da43dd804926a42537bf69fb3ebb9fd72a50ba84f807d95df5ae016606c976c",
                "md5": "6ef722742c51574923426015f9a1abcf",
                "sha256": "cb96edd7016872f58479e35879294258c71437195760746faffedb692aef000b"
            },
            "downloads": -1,
            "filename": "parsedatetime-2.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6ef722742c51574923426015f9a1abcf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 42548,
            "upload_time": "2020-05-31T23:50:56",
            "upload_time_iso_8601": "2020-05-31T23:50:56.315601Z",
            "url": "https://files.pythonhosted.org/packages/9d/a4/3dd804926a42537bf69fb3ebb9fd72a50ba84f807d95df5ae016606c976c/parsedatetime-2.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a820cb587f6672dbe585d101f590c3871d16e7aec5a576a1694997a3777312ac",
                "md5": "fb8918fe699d79a470dcd959b77466d7",
                "sha256": "4cb368fbb18a0b7231f4d76119165451c8d2e35951455dfee97c62a87b04d455"
            },
            "downloads": -1,
            "filename": "parsedatetime-2.6.tar.gz",
            "has_sig": false,
            "md5_digest": "fb8918fe699d79a470dcd959b77466d7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 60114,
            "upload_time": "2020-05-31T23:50:57",
            "upload_time_iso_8601": "2020-05-31T23:50:57.443925Z",
            "url": "https://files.pythonhosted.org/packages/a8/20/cb587f6672dbe585d101f590c3871d16e7aec5a576a1694997a3777312ac/parsedatetime-2.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-05-31 23:50:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "bear",
    "github_project": "parsedatetime",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": false,
    "circle": true,
    "lcname": "parsedatetime"
}
        
Elapsed time: 0.06534s