workalendar


Nameworkalendar JSON
Version 17.0.0 PyPI version JSON
download
home_pagehttps://github.com/workalendar/workalendar
SummaryWorldwide holidays and working days helper and toolkit.
upload_time2023-01-01 22:33:06
maintainer
docs_urlNone
authorBruno Bord
requires_python>=3.7
licenseMIT License
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Workalendar

[![license](http://img.shields.io/pypi/l/workalendar.svg)](https://github.com/workalendar/workalendar/blob/master/LICENSE)
[![pypi](http://img.shields.io/pypi/v/workalendar.svg)](https://pypi.python.org/pypi/workalendar)
[![conda](https://img.shields.io/conda/v/conda-forge/workalendar?color=blue&logo=anaconda)](https://anaconda.org/conda-forge/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.

## Installation

**With pip**

```sh
pip install workalendar
```

**With conda**

```sh
conda install -c conda-forge workalendar
```

### Extra dependencies

**Note: NEW in v16.0.0**

If the calendar(s) you want to work with requires astronomical computations (such as Asian calendars needing equinoxes or solar terms), Workalendar will provide pre-computed values within the year range from 1991 to 2051.

However, if you want to use astronomical libraries to compute the calendar yourself, you'll need to install the `[astronomy]` extra dependency like this:

```sh
pip install workalendar[astronomy]
```

If you had previously installed the `skyfield` and `skyfield-data` packages, they'll be used to compute the calendars. If you want to benefit from the "astronomical cache", and eventually benefit from performance gains, you'll have to **uninstall** those packages first to fallback to pre-computed files.

## 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](docs/contributing.md).

## Usage sample

```python
>>> from datetime import date
>>> from workalendar.europe import France
>>> cal = France()
>>> 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')]
>>> cal.is_working_day(date(2012, 12, 25))  # it's Christmas
False
>>> cal.is_working_day(date(2012, 12, 30))  # it's Sunday
False
>>> cal.is_working_day(date(2012, 12, 26))
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://workalendar.github.io/workalendar).

## External dependencies

**Workalendar will require you to use Python 3.7+.**

Workalendar is tested on Python 3.7, 3.8, 3.9, 3.10, 3.11, and on Linux (Ubuntu), Mac OS and Windows using Github actions.

### Conditional dependencies

As of v15.0.0:

* If you're using \*Nix and Python 3.7, 3.8, the package `backports.zoneinfo` is required
* If you're using Windows and Python 3.7, 3.8, the package `tzdata` is *also* a requirement (with the `backports.zoneinfo`).
* If you're using Python 3.9+, the stdlib `zoneinfo` package will be used.

## Tests

CI status:

[![Github action status](https://github.com/workalendar/workalendar/workflows/CI/badge.svg)](https://github.com/workalendar/workalendar/actions?query=workflow%3ACI)

To run test, just install tox with `pip install tox` and run:

```
tox
```

from the command line.

## Available Calendars

### Europe

- Austria
- Belarus
- Belgium
- Bulgaria
- Cayman Islands
- Croatia
- Cyprus
- Czech Republic
- Denmark
- Estonia
- European Central Bank
- Finland
- France
- France (Alsace / Moselle)
- Georgia
- Germany
- Greece
- Guernsey
- Hungary
- Iceland
- Ireland
- Italy
- Latvia
- Lithuania
- Luxembourg
- Malta
- Monaco
- Netherlands (optionally with school holidays and carnival)
- Norway
- Poland
- Portugal
- Romania
- Russia
- Serbia
- Slovakia
- Slovenia
- Spain (Andalusia, Aragon, Castile and León, Castilla-La Mancha, Canary Islands, Extremadura, Galicia, Balearic Islands, La Rioja, Community of Madrid, Murcia, Navarre, Asturias, Basque Country, Cantabria, Valencian Community)
- 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
- Ukraine
- United Kingdom (incl. Northern Ireland, Scotland and all its territories)

### America

- Argentina
- Barbados
- Brazil (all states, cities and for bank transactions, except the city of Viana)
- Canada (including provincial and territory holidays)
- Chile
- Colombia
- El Salvador
- Mexico
- Panama
- Paraguay
- United States of America
  - State holidays for all the 50 States
  - American Samoa
  - Chicago, Illinois
  - Guam
  - Suffolk County, Massachusetts
  - California Education, Berkeley, San Francisco, West Hollywood
  - Florida Legal and Florida Circuit Courts, Miami-Dade
  - Federal Reserve System

### Asia

- China
- Hong Kong
- Israel
- Japan
- JapanBank
- Kazakhstan
- Malaysia
- Philippines
- Qatar
- Singapore
- South Korea
- Taiwan

### Oceania

- Australia (incl. its different states)
- Marshall Islands
- New Zealand

### Africa

- Algeria
- Angola
- Benin
- Ivory Coast
- Kenya
- Madagascar
- Mozambique
- Nigeria
- São Tomé
- South Africa
- Tunisia

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.

Some countries have some holidays based on ephemerids and equinoxes. Those are computed for the previous and next 30 years to prevent big computations and dependencies.

## Contributing

Please read our [contributing.md](https://github.com/workalendar/workalendar/blob/master/docs/contributing.md) document to discover how you can contribute to `workalendar`. Pull-requests are very welcome.

## History

This project was born in 2013, as an answer to the question "how do we calculate *this date + 5 working days*?". It was a use-case for [PeopleDoc](https://www.people-doc.fr/), in their ticketing application, for calculating SLAs. And it began as a small open-source library, for France and the USA at first.

Thanks to PeopleDoc, this project grew and eventually became a world-wide library, with the help of dozens of contributors.

As of June 2021, this project has moved to its own organization.

## License

This library is published under the terms of the MIT License. Please check the LICENSE file for more details.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/workalendar/workalendar",
    "name": "workalendar",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Bruno Bord",
    "author_email": "bruno@jehaisleprintemps.net",
    "download_url": "https://files.pythonhosted.org/packages/a7/16/e2d59c5a3b2d01519778dc1820daab70054022d88ff8291df602b2620481/workalendar-17.0.0.tar.gz",
    "platform": null,
    "description": "# Workalendar\n\n[![license](http://img.shields.io/pypi/l/workalendar.svg)](https://github.com/workalendar/workalendar/blob/master/LICENSE)\n[![pypi](http://img.shields.io/pypi/v/workalendar.svg)](https://pypi.python.org/pypi/workalendar)\n[![conda](https://img.shields.io/conda/v/conda-forge/workalendar?color=blue&logo=anaconda)](https://anaconda.org/conda-forge/workalendar)\n\n## Overview\n\nWorkalendar is a Python module that offers classes able to handle calendars, list legal / religious holidays and gives working-day-related computation functions.\n\n## Installation\n\n**With pip**\n\n```sh\npip install workalendar\n```\n\n**With conda**\n\n```sh\nconda install -c conda-forge workalendar\n```\n\n### Extra dependencies\n\n**Note: NEW in v16.0.0**\n\nIf the calendar(s) you want to work with requires astronomical computations (such as Asian calendars needing equinoxes or solar terms), Workalendar will provide pre-computed values within the year range from 1991 to 2051.\n\nHowever, if you want to use astronomical libraries to compute the calendar yourself, you'll need to install the `[astronomy]` extra dependency like this:\n\n```sh\npip install workalendar[astronomy]\n```\n\nIf you had previously installed the `skyfield` and `skyfield-data` packages, they'll be used to compute the calendars. If you want to benefit from the \"astronomical cache\", and eventually benefit from performance gains, you'll have to **uninstall** those packages first to fallback to pre-computed files.\n\n## Status\n\nThis 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).\n\nIf you spot any bug or wish to add a calendar, please refer to the [Contributing doc](docs/contributing.md).\n\n## Usage sample\n\n```python\n>>> from datetime import date\n>>> from workalendar.europe import France\n>>> cal = France()\n>>> cal.holidays(2012)\n[(datetime.date(2012, 1, 1), 'New year'),\n (datetime.date(2012, 4, 9), 'Easter Monday'),\n (datetime.date(2012, 5, 1), 'Labour Day'),\n (datetime.date(2012, 5, 8), 'Victory in Europe Day'),\n (datetime.date(2012, 5, 17), 'Ascension Day'),\n (datetime.date(2012, 5, 28), 'Whit Monday'),\n (datetime.date(2012, 7, 14), 'Bastille Day'),\n (datetime.date(2012, 8, 15), 'Assumption of Mary to Heaven'),\n (datetime.date(2012, 11, 1), \"All Saints' Day\"),\n (datetime.date(2012, 11, 11), 'Armistice Day'),\n (datetime.date(2012, 12, 25), 'Christmas')]\n>>> cal.is_working_day(date(2012, 12, 25))  # it's Christmas\nFalse\n>>> cal.is_working_day(date(2012, 12, 30))  # it's Sunday\nFalse\n>>> cal.is_working_day(date(2012, 12, 26))\nTrue\n>>> cal.add_working_days(date(2012, 12, 23), 5)  # 5 working days after Xmas\ndatetime.date(2012, 12, 31)\n```\n\nFor a more complete documentation and advanced usage, go to [the official workalendar documentation](https://workalendar.github.io/workalendar).\n\n## External dependencies\n\n**Workalendar will require you to use Python 3.7+.**\n\nWorkalendar is tested on Python 3.7, 3.8, 3.9, 3.10, 3.11, and on Linux (Ubuntu), Mac OS and Windows using Github actions.\n\n### Conditional dependencies\n\nAs of v15.0.0:\n\n* If you're using \\*Nix and Python 3.7, 3.8, the package `backports.zoneinfo` is required\n* If you're using Windows and Python 3.7, 3.8, the package `tzdata` is *also* a requirement (with the `backports.zoneinfo`).\n* If you're using Python 3.9+, the stdlib `zoneinfo` package will be used.\n\n## Tests\n\nCI status:\n\n[![Github action status](https://github.com/workalendar/workalendar/workflows/CI/badge.svg)](https://github.com/workalendar/workalendar/actions?query=workflow%3ACI)\n\nTo run test, just install tox with `pip install tox` and run:\n\n```\ntox\n```\n\nfrom the command line.\n\n## Available Calendars\n\n### Europe\n\n- Austria\n- Belarus\n- Belgium\n- Bulgaria\n- Cayman Islands\n- Croatia\n- Cyprus\n- Czech Republic\n- Denmark\n- Estonia\n- European Central Bank\n- Finland\n- France\n- France (Alsace / Moselle)\n- Georgia\n- Germany\n- Greece\n- Guernsey\n- Hungary\n- Iceland\n- Ireland\n- Italy\n- Latvia\n- Lithuania\n- Luxembourg\n- Malta\n- Monaco\n- Netherlands (optionally with school holidays and carnival)\n- Norway\n- Poland\n- Portugal\n- Romania\n- Russia\n- Serbia\n- Slovakia\n- Slovenia\n- Spain (Andalusia, Aragon, Castile and Le\u00f3n, Castilla-La Mancha, Canary Islands, Extremadura, Galicia, Balearic Islands, La Rioja, Community of Madrid, Murcia, Navarre, Asturias, Basque Country, Cantabria, Valencian Community)\n- Sweden\n- Switzerland (Aargau, Appenzell Innerrhoden, Appenzell Ausserrhoden, Bern, Basel-Landschaft, Basel-Stadt, Fribourg, Geneva, Glarus, Graub\u00fcnden, Jura, Luzern, Neuch\u00e2tel, Nidwalden, Obwalden, St. Gallen, Schaffhausen, Solothurn, Schwyz, Thurgau, Ticino, Uri, Vaud, Valais, Zug, Zurich)\n- Turkey\n- Ukraine\n- United Kingdom (incl. Northern Ireland, Scotland and all its territories)\n\n### America\n\n- Argentina\n- Barbados\n- Brazil (all states, cities and for bank transactions, except the city of Viana)\n- Canada (including provincial and territory holidays)\n- Chile\n- Colombia\n- El Salvador\n- Mexico\n- Panama\n- Paraguay\n- United States of America\n  - State holidays for all the 50 States\n  - American Samoa\n  - Chicago, Illinois\n  - Guam\n  - Suffolk County, Massachusetts\n  - California Education, Berkeley, San Francisco, West Hollywood\n  - Florida Legal and Florida Circuit Courts, Miami-Dade\n  - Federal Reserve System\n\n### Asia\n\n- China\n- Hong Kong\n- Israel\n- Japan\n- JapanBank\n- Kazakhstan\n- Malaysia\n- Philippines\n- Qatar\n- Singapore\n- South Korea\n- Taiwan\n\n### Oceania\n\n- Australia (incl. its different states)\n- Marshall Islands\n- New Zealand\n\n### Africa\n\n- Algeria\n- Angola\n- Benin\n- Ivory Coast\n- Kenya\n- Madagascar\n- Mozambique\n- Nigeria\n- S\u00e3o Tom\u00e9\n- South Africa\n- Tunisia\n\nAnd more to come (I hope!)\n\n## Caveats\n\nPlease 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.\n\nSome countries have some holidays based on ephemerids and equinoxes. Those are computed for the previous and next 30 years to prevent big computations and dependencies.\n\n## Contributing\n\nPlease read our [contributing.md](https://github.com/workalendar/workalendar/blob/master/docs/contributing.md) document to discover how you can contribute to `workalendar`. Pull-requests are very welcome.\n\n## History\n\nThis project was born in 2013, as an answer to the question \"how do we calculate *this date + 5 working days*?\". It was a use-case for [PeopleDoc](https://www.people-doc.fr/), in their ticketing application, for calculating SLAs. And it began as a small open-source library, for France and the USA at first.\n\nThanks to PeopleDoc, this project grew and eventually became a world-wide library, with the help of dozens of contributors.\n\nAs of June 2021, this project has moved to its own organization.\n\n## License\n\nThis library is published under the terms of the MIT License. Please check the LICENSE file for more details.\n\n\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Worldwide holidays and working days helper and toolkit.",
    "version": "17.0.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "b224dda962f6873a88d232cd468e21b4",
                "sha256": "8fe1d6758f9a1af05d59cb81480afb912246ec7fa46e246b909897127cdbb1b0"
            },
            "downloads": -1,
            "filename": "workalendar-17.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b224dda962f6873a88d232cd468e21b4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 210652,
            "upload_time": "2023-01-01T22:33:03",
            "upload_time_iso_8601": "2023-01-01T22:33:03.869478Z",
            "url": "https://files.pythonhosted.org/packages/4a/23/2fd9e240ae95be5653d57cc39d5377278eb376b4b3f30e27526d831b1668/workalendar-17.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "e4470cfd40af93ec0a0876834f2f94d7",
                "sha256": "b82d6024aed452505b01baf06dbe8d6309a3135ff1d39dee07c31b21ece853b4"
            },
            "downloads": -1,
            "filename": "workalendar-17.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e4470cfd40af93ec0a0876834f2f94d7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 153468,
            "upload_time": "2023-01-01T22:33:06",
            "upload_time_iso_8601": "2023-01-01T22:33:06.471569Z",
            "url": "https://files.pythonhosted.org/packages/a7/16/e2d59c5a3b2d01519778dc1820daab70054022d88ff8291df602b2620481/workalendar-17.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-01 22:33:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "workalendar",
    "github_project": "workalendar",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "workalendar"
}
        
Elapsed time: 0.06591s