{ "info": { "author": "ryanss", "author_email": "ryanssdev@icloud.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Office/Business :: Scheduling", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Localization" ], "description": "=========\nbdateutil\n=========\n\nAdds business day logic and improved data type flexibility to python-dateutil.\n100% backwards compatible with python-dateutil, simply replace :code:`dateutil`\nimports with :code:`bdateutil`.\n\n.. image:: http://img.shields.io/travis/ryanss/bdateutil.svg\n :target: https://travis-ci.org/ryanss/bdateutil\n\n.. image:: http://img.shields.io/coveralls/ryanss/bdateutil.svg\n :target: https://coveralls.io/r/ryanss/bdateutil\n\n\nExample Usage\n-------------\n\n.. code-block:: python\n\n # Test if a date is a business day\n >>> from bdateutil import isbday\n >>> isbday(date(2014, 1, 1))\n True\n\n # Date parameters are no longer limited to datetime objects\n >>> isbday(\"2014-01-01\")\n True\n >>> isbday(\"1/1/2014\")\n True\n >>> isbday(1388577600) # Unix timestamp = Jan 1, 2014\n True\n\n # Take into account U.S. statutory holidays\n >>> import holidays\n >>> isbday(\"2014-01-01\", holidays=holidays.US())\n False\n\n # Increment date by two business days\n >>> from bdateutil import relativedelta\n >>> date(2014, 7, 3) + relativedelta(bdays=+2)\n datetime.date(2014, 7, 7)\n\n # Any arguments that take a date/datetime object now accept\n # strings/unicode/bytes in any encoding and integer/float timestamps.\n # All dateutil functions now also take an optional `holidays` argument\n # for helping to work with business days.\n >>> \"2014-07-03\" + relativedelta(bdays=+2, holidays=holidays.US())\n datetime.date(2014, 7, 8)\n\n # Determine how many business days between two dates\n >>> relativedelta(\"2014-07-07\", date(2014, 7, 3))\n relativedelta(days=+4, bdays=+2)\n # Take into account Canadian statutory holidays\n >>> from holidays import Canada\n >>> relativedelta('2014-07-07', '07/03/2014', holidays=Canada())\n relativedelta(days=+4, bdays=+1)\n\n # Get a list of the next 10 business days starting 2014-01-01\n >>> from bdateutil import rrule, BDAILY\n >>> list(rrule(BDAILY, count=10, dtstart=date(2014, 1, 1)))\n # Take into account British Columbia, Canada statutory holidays\n >>> list(rrule(BDAILY, count=10, dtstart=date(2014, 1, 1),\n holidays=Canada(prov='BC')))\n\n\nInstall\n-------\n\nThe latest stable version can always be installed or updated via pip:\n\n.. code-block:: bash\n\n $ pip install bdateutil\n\nIf the above fails, please use easy_install instead:\n\n.. code-block:: bash\n\n $ easy_install bdateutil\n\n\nDocumentation\n-------------\n\nThis section will outline the additional functionality of bdateutil only. For\nfull documentation on the features provided by python-dateutil please see its\ndocumentation at https://labix.org/python-dateutil.\n\nbdateutil is 100% backwards compatible with python-dateutil. You can replace\n:code:`dateutil` with :code:`bdateutil` across your entire project and\neverything will continue to work the same but you will have access to the\nfollowing additional features:\n\n\n1. A new, optional, keyword argument :code:`bdays` is available when using\n relativedelta to add or remove time to a datetime object.\n\n.. code-block:: python\n\n >>> date(2014, 1, 1) + relativedelta(bdays=+5)\n date(2014, 1, 8)\n\n2. When passing two datetime arguments to relativedelta, the resulting\n relativedelta object will contain a :code:`bdays` attribute with the number\n of business days between the datetime arguments.\n\n.. code-block:: python\n\n >>> relativedelta(date(2014, 7, 7), date(2014, 7, 3))\n relativedelta(days=+4, bdays=+2)\n\n3. Another new, optional, keyword argument :code:`holidays` is available when\n using relativedelta to support the :code:`bdays` feature. Without holidays\n business days are only calculated using weekdays. By passing a list of\n holidays a more accurate and useful business day calculation can be\n performed. The Python package :code:`holidays.py` is installed as a\n requirement with bdateutil and that is the prefered way to generate\n holidays.\n\n.. code-block:: python\n\n >>> from bdateutil import relativedelta\n >>> from holidays import UnitedStates\n >>> date(2014, 7, 3) + relativedelta(bdays=+2)\n datetime.date(2014, 7, 7)\n >>> date(2014, 7, 3) + relativedelta(bdays=+2, holidays=UnitedStates())\n datetime.date(2014, 7, 8)\n\n4. A new function :code:`isbday` which returns :code:`True` if the argument\n passed to it falls on a business day and :code:`False` if it is a weekend or\n holiday. Option keyword argument :code:`holidays` adds the ability to take\n into account a specific set of holidays.\n\n.. code-block:: python\n\n >>> from bdateutil import isbday\n >>> isbday(date(2014, 1, 1))\n True\n >>> isbday(\"2014-01-01\")\n True\n >>> isbday(\"1/1/2014\")\n True\n >>> isbday(1388577600) # Unix timestamp = Jan 1, 2014\n True\n\n # Take into account U.S. statutory holidays\n >>> import holidays\n >>> isbday(\"2014-01-01\", holidays=holidays.US())\n False\n\n5. In addition to :code:`datetime` and :code:`date` types, relativedelta works\n with all strings/bytes regardless of encoding and integer/float timestamps.\n It does this by running all date/datetime parameters through the\n :code:`parse` function which has been modified to accept many different\n types than strings, including date/datetime which will return without\n modifications. This allows you to call :code:`parse(dt)` on an object\n regardless of type and ensure a datetime object is returned.\n\n.. code-block:: python\n\n >>> parse(date(2014, 1, 1))\n datetime.date(2014, 1, 1)\n >>> parse(datetime(2014, 1, 1))\n datetime.datetime(2014, 1, 1, 0, 0)\n >>> parse(\"2014-01-01\")\n datetime.datetime(2014, 1, 1, 0, 0)\n >>> parse(\"1/1/2014\")\n datetime.datetime(2014, 1, 1, 0, 0)\n >>> parse(1388577600)\n datetime.datetime(2014, 1, 1, 0, 0)\n\n >>> relativedelta('2014-07-07', '2014-07-03')\n relativedelta(days=+4, bdays=+2)\n\n >>> 1388577600 + relativedelta(days=+2)\n date(2014, 1, 3)\n\n6. The :code:`rrule` feature has a new :code:`BDAILY` option for use as the :code:`freq` argument.\n This will create a generator which yields business days. Rrule also will now\n accept an optional :code:`holidays` keyword argument which affects the\n :code:`BDAILY` freq only. The existing :code:`dtstart` and :code:`until`\n arugments can now be passed as any type resembling a date/datetime.\n\n.. code-block:: python\n\n # Get a list of the next 10 business days starting 2014-01-01\n >>> from bdateutil import rrule, BDAILY\n >>> list(rrule(BDAILY, count=10, dtstart=date(2014, 1, 1)))\n\n # Get a list of all business days in January 2014, taking into account\n # Canadian statutory holidays\n >>> import holidays\n >>> list(rrule(BDAILY, dtstart=\"2014-01-01\", until=\"2014-01-31\",\n holidays=holidays.Canada()))\n\n7. Import shortcuts are available that make importing the bdateutil features a\n little easier than python-dateutil. However, importing from bdateutil using\n the longer method used by python-dateutil still works to remain 100%\n backwards compatibility.\n\n.. code-block:: python\n\n >>> # Importing relativedelta from the original python-dateutil package\n >>> from dateutil.relativedelta import relativedelta\n\n >>> # This method works with bdateutil\n >>> from bdateutil.relativedelta import relativedelta\n\n >>> # bdateutil also provides an easier way\n >>> from bdateutil import relativedelta\n\n\nDevelopment Version\n-------------------\n\nThe latest development version can be installed directly from GitHub:\n\n.. code-block:: bash\n\n $ pip install --upgrade https://github.com/ryanss/bdateutil/tarball/master\n\n\nRunning Tests\n-------------\n\n.. code-block:: bash\n\n $ pip install flake8\n $ flake8 bdateutil/*.py tests.py --ignore=F401,F403\n $ python tests.py\n\n\nCoverage\n--------\n\n.. code-block:: bash\n\n $ pip install coverage\n $ coverage run --omit=*site-packages* tests.py\n $ coverage report\n\n\nContributions\n-------------\n\n.. _issues: https://github.com/ryanss/bdateutil/issues\n.. __: https://github.com/ryanss/bdateutil/pulls\n\nIssues_ and `Pull Requests`__ are always welcome.\n\n\nLicense\n-------\n\n.. __: https://github.com/ryanss/bdateutil/raw/master/LICENSE\n\nCode and documentation are available according to the MIT License\n(see LICENSE__).", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ryanss/bdateutil", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "bdateutil", "package_url": "https://pypi.org/project/bdateutil/", "platform": "any", "project_url": "https://pypi.org/project/bdateutil/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/ryanss/bdateutil" }, "release_url": "https://pypi.org/project/bdateutil/0.1/", "requires_dist": null, "requires_python": null, "summary": "Adds business day logic and improved data type flexibility to python-dateutil.", "version": "0.1" }, "last_serial": 3927872, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "fb6ad1c05bb38978e205d81f60946198", "sha256": "6dda0c79ed5d80f7c0972d62e6147e6d3a625e5d0ec2b77d0d69076b663ccc07" }, "downloads": -1, "filename": "bdateutil-0.1.tar.gz", "has_sig": false, "md5_digest": "fb6ad1c05bb38978e205d81f60946198", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24125, "upload_time": "2014-11-12T01:28:42", "url": "https://files.pythonhosted.org/packages/39/a4/44e289969e9826f25b3eeb30eacfdde6e175cc88bb54e1bada2431a8eb89/bdateutil-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fb6ad1c05bb38978e205d81f60946198", "sha256": "6dda0c79ed5d80f7c0972d62e6147e6d3a625e5d0ec2b77d0d69076b663ccc07" }, "downloads": -1, "filename": "bdateutil-0.1.tar.gz", "has_sig": false, "md5_digest": "fb6ad1c05bb38978e205d81f60946198", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24125, "upload_time": "2014-11-12T01:28:42", "url": "https://files.pythonhosted.org/packages/39/a4/44e289969e9826f25b3eeb30eacfdde6e175cc88bb54e1bada2431a8eb89/bdateutil-0.1.tar.gz" } ] }