debian-workalendar/README.rst

198 lines
4.9 KiB
ReStructuredText
Raw Normal View History

===========
Workalendar
===========
Overview
========
Workalendar is a Python module that offers classes able to handle calendars, list legal / religious holidays and gives working-day-related computation functions.
2016-12-12 10:07:24 +01:00
Status
======
This library is ready for production, although we may warn eventual users: some calendars may not be up-to-date, and this library doesn't cover all the existing countries on earth (yet).
If you spot any bug or wish to add a calendar, please refer to the `Contributing doc <contributing.md>`_.
2013-11-20 15:24:13 +01:00
Usage sample
============
.. code-block:: python
2013-11-20 15:24:13 +01:00
>>> from datetime import date
>>> from workalendar.europe import France
>>> cal = France()
2013-11-27 17:31:11 +01:00
>>> cal.holidays(2012)
[(datetime.date(2012, 1, 1), 'New year'),
(datetime.date(2012, 4, 9), 'Easter Monday'),
(datetime.date(2012, 5, 1), 'Labour Day'),
(datetime.date(2012, 5, 8), 'Victory in Europe Day'),
(datetime.date(2012, 5, 17), 'Ascension Day'),
(datetime.date(2012, 5, 28), 'Whit Monday'),
(datetime.date(2012, 7, 14), 'Bastille Day'),
(datetime.date(2012, 8, 15), 'Assumption of Mary to Heaven'),
(datetime.date(2012, 11, 1), "All Saints' Day"),
(datetime.date(2012, 11, 11), 'Armistice Day'),
(datetime.date(2012, 12, 25), 'Christmas')]
2013-11-27 17:28:07 +01:00
>>> cal.is_working_day(date(2012, 12, 25)) # it's Christmas
2013-11-20 15:24:13 +01:00
False
2013-11-25 23:02:12 +01:00
>>> cal.is_working_day(date(2012, 12, 30)) # it's Sunday
2013-11-20 15:24:13 +01:00
False
2013-11-25 23:02:12 +01:00
>>> cal.is_working_day(date(2012, 12, 26))
2013-11-20 15:24:13 +01:00
True
>>> cal.add_working_days(date(2012, 12, 23), 5) # 5 working days after Xmas
datetime.date(2012, 12, 31)
For a more complete documentation and advanced usage, go to
`the official workalendar documentation <https://peopledoc.github.io/workalendar>`_.
2013-11-20 15:24:13 +01:00
External dependencies
=====================
Workalendar has been tested on Python 3.5, 3.6, 3.7, 3.8.
2013-11-20 15:36:27 +01:00
2019-09-20 12:15:44 +02:00
If you're using wheels, you should be fine without having to install extra system packages. As of ``v7.0.0``, we have dropped ``ephem`` as a dependency for computing astronomical ephemeris in favor of ``skyfield``. So if you had any trouble because of this new dependency, during the installation or at runtime, `do not hesitate to file an issue <https://github.com/peopledoc/workalendar/issues/>`_.
2013-11-20 15:36:27 +01:00
Tests
=====
2013-11-20 16:41:15 +01:00
Travis status:
2019-12-13 18:00:07 +01:00
|travis|
.. |travis| image:: https://travis-ci.org/peopledoc/workalendar.svg?branch=master
:target: https://travis-ci.org/peopledoc/workalendar
2013-11-20 16:41:15 +01:00
To run test, just install tox with ``pip install tox`` and run::
2013-11-20 15:36:27 +01:00
tox
2013-11-20 15:36:27 +01:00
from the command line.
2013-11-28 09:38:44 +01:00
Available Calendars
===================
Europe
------
2016-12-03 16:22:06 +01:00
* Austria
2020-03-04 14:24:29 +01:00
* Belarus
2014-05-16 15:09:40 +02:00
* Belgium
2016-12-05 20:26:32 +01:00
* Bulgaria
2019-02-18 15:50:04 +01:00
* Cayman Islands
* Croatia
2017-01-07 18:57:39 +01:00
* Cyprus
2013-11-28 09:38:44 +01:00
* Czech Republic
2016-01-10 19:45:02 +01:00
* Denmark
2016-06-21 12:50:21 +02:00
* Estonia
* European Central Bank
2013-12-19 17:30:28 +01:00
* Finland
2013-11-28 09:38:44 +01:00
* France
* France (Alsace / Moselle)
2014-08-14 19:08:48 +02:00
* Germany
2013-12-18 11:27:30 +01:00
* Greece
2013-12-12 11:01:09 +01:00
* Hungary
2013-11-28 09:38:44 +01:00
* Iceland
2016-12-02 16:37:06 +01:00
* Ireland
2013-12-06 22:12:01 +01:00
* Italy
2017-01-13 23:41:49 +01:00
* Latvia
2017-11-07 13:22:17 +01:00
* Lithuania
2015-08-11 19:43:41 +02:00
* Luxembourg
2017-01-14 15:00:28 +01:00
* Malta
2015-08-14 00:57:42 +02:00
* Netherlands
2013-12-15 09:29:46 +01:00
* Norway
* Poland
* Portugal
2017-01-15 15:56:12 +01:00
* Romania
* Russia
2019-12-05 14:07:10 +01:00
* Serbia
2015-08-14 00:57:42 +02:00
* Slovakia
2016-02-29 19:42:18 +01:00
* Slovenia
* Spain (incl. Catalonia)
* Sweden
* Switzerland (Aargau, Appenzell Innerrhoden, Appenzell Ausserrhoden, Bern, Basel-Landschaft, Basel-Stadt, Fribourg, Geneva, Glarus, Graubünden, Jura, Luzern, Neuchâtel, Nidwalden, Obwalden, St. Gallen, Schaffhausen, Solothurn, Schwyz, Thurgau, Ticino, Uri, Vaud, Valais, Zug, Zurich)
* Turkey
2019-12-11 16:48:55 +01:00
* Ukraine
* United Kingdom (incl. Northern Ireland, Scotland and all its territories)
2013-11-28 09:38:44 +01:00
America
-------
* Argentina
2019-02-25 18:29:24 +01:00
* Barbados
2017-07-25 19:14:28 +02:00
* Brazil (all states, cities and for bank transactions, except the city of Viana)
* Canada (including provincial and territory holidays)
2013-12-17 09:25:02 +01:00
* Chile
2015-05-04 17:13:36 +02:00
* Colombia
2013-12-10 21:57:58 +01:00
* Mexico
2013-12-19 16:36:06 +01:00
* Panama
* Paraguay
* United States of America
* State holidays for all the 50 States
* American Samoa
* Chicago, Illinois
2019-02-14 16:49:05 +01:00
* Guam
* Suffolk County, Massachusetts
* California Education, Berkeley, San Francisco, West Hollywood
* Florida Legal and Florida Circuit Courts, Miami-Dade
2013-11-28 09:38:44 +01:00
Asia
----
2018-12-25 13:23:27 +01:00
* China
2017-07-03 10:34:59 +02:00
* Hong Kong
* Israel
2013-11-30 16:58:21 +01:00
* Japan
* JapanBank
* Malaysia
2013-12-16 10:00:17 +01:00
* Qatar
* Singapore
2013-12-17 08:40:55 +01:00
* South Korea
* Taiwan
2013-11-28 09:38:44 +01:00
2013-12-01 18:47:15 +01:00
Oceania
-------
2013-12-10 09:08:18 +01:00
* Australia (incl. its different states)
2013-12-18 10:48:02 +01:00
* Marshall Islands
2019-01-04 04:09:55 +01:00
* New Zealand
2013-11-28 09:38:44 +01:00
2013-12-03 09:14:41 +01:00
Africa
------
2013-11-28 09:38:44 +01:00
* Algeria
* Angola
2013-12-04 22:25:04 +01:00
* Benin
2013-12-10 22:33:53 +01:00
* Ivory Coast
2020-04-15 18:56:51 +02:00
* Kenya
2013-12-19 16:48:02 +01:00
* Madagascar
2013-12-12 11:45:20 +01:00
* São Tomé
* South Africa
2013-12-03 09:14:41 +01:00
2013-11-28 09:38:44 +01:00
And more to come (I hope!)
Caveats
=======
Please take note that some calendars are not 100% accurate. The most common
example is the Islamic calendar, where some computed holidays are not exactly on
the same official day decided by religious authorities, and this may vary
country by country. Whenever it's possible, try to adjust your results with
the official data provided by the adequate authorities.
2013-11-20 15:36:27 +01:00
2014-05-16 10:32:41 +02:00
Contributing
============
Please read our `contributing.md <https://github.com/peopledoc/workalendar/blob/master/contributing.md>`_
2014-05-16 10:32:41 +02:00
document to discover how you can contribute to ``workalendar``. Pull-requests
are very welcome.
License
=======
This library is published under the terms of the MIT License. Please check the
LICENSE file for more details.