![PyPI](https://img.shields.io/pypi/v/work-calendar?label=pypi%20work-calendar)
![ruff](https://github.com/Polyrom/work-calendar/actions/workflows/linter.yml/badge.svg) ![tests](https://github.com/Polyrom/work-calendar/actions/workflows/tests.yml/badge.svg)
# Work Calendar
A simple no-nonsense library to find out whether a day is a working day in Russia.
Data obtained from [consultant.org](https://www.consultant.ru). I try to parse it as soon as the official calendar for the following year is published, which is normally late summer or early autumn.
Data available **for years 2015-2025**. Feel free to use the [raw json file](work_calendar/total.json).
## Installation
```bash
pip install work-calendar
```
## Usage
```python
from datetime import date
import work_calendar
new_years_holiday = date(2020, 1, 2)
weekend = date(2021, 4, 4)
workday = date(2020, 6, 3)
for day in [new_years_holiday, weekend, workday]:
if work_calendar.is_workday(day):
print(f"{day.strftime('%A %d.%m.%Y')} is a workday in Russia")
else:
print(f"{day.strftime('%A %d.%m.%Y')} is not a workday in Russia")
dt_out_of_bounds = dt = date(2090, 1, 2)
try:
work_calendar.is_workday(dt_out_of_bounds)
except work_calendar.NoDataForYearError:
print(f"No data found for date {dt_out_of_bounds} in work calendar!")
```
**Output**
```
Thursday 02.01.2020 is not a workday in Russia
Sunday 04.04.2021 is not a workday in Russia
Wednesday 03.06.2020 is a workday in Russia
No data found for date 2090-01-02 in work calendar!
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Polyrom/work-calendar",
"name": "work-calendar",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "utility, python, official, work, calendar, Russia",
"author": "Polyrom",
"author_email": "roman61394@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/7e/88/762782fea6bf2b50330348b9dff7bd4f35f9eb936abcfdfd881031952a0c/work_calendar-1.0.0.tar.gz",
"platform": null,
"description": "![PyPI](https://img.shields.io/pypi/v/work-calendar?label=pypi%20work-calendar)\n![ruff](https://github.com/Polyrom/work-calendar/actions/workflows/linter.yml/badge.svg) ![tests](https://github.com/Polyrom/work-calendar/actions/workflows/tests.yml/badge.svg)\n\n# Work Calendar\n\nA simple no-nonsense library to find out whether a day is a working day in Russia.\n\nData obtained from [consultant.org](https://www.consultant.ru). I try to parse it as soon as the official calendar for the following year is published, which is normally late summer or early autumn.\n\nData available **for years 2015-2025**. Feel free to use the [raw json file](work_calendar/total.json).\n\n## Installation\n\n```bash\npip install work-calendar\n```\n\n## Usage\n\n```python\nfrom datetime import date\n\nimport work_calendar\n\nnew_years_holiday = date(2020, 1, 2)\nweekend = date(2021, 4, 4)\nworkday = date(2020, 6, 3)\nfor day in [new_years_holiday, weekend, workday]:\n if work_calendar.is_workday(day):\n print(f\"{day.strftime('%A %d.%m.%Y')} is a workday in Russia\")\n else:\n print(f\"{day.strftime('%A %d.%m.%Y')} is not a workday in Russia\")\n\ndt_out_of_bounds = dt = date(2090, 1, 2)\ntry:\n work_calendar.is_workday(dt_out_of_bounds)\nexcept work_calendar.NoDataForYearError:\n print(f\"No data found for date {dt_out_of_bounds} in work calendar!\")\n```\n\n**Output**\n\n```\nThursday 02.01.2020 is not a workday in Russia\nSunday 04.04.2021 is not a workday in Russia\nWednesday 03.06.2020 is a workday in Russia\nNo data found for date 2090-01-02 in work calendar!\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "Determines if a day is a working day in Russia",
"version": "1.0.0",
"project_urls": {
"Documentation": "https://github.com/Polyrom/work-calendar",
"Homepage": "https://github.com/Polyrom/work-calendar",
"Repository": "https://github.com/Polyrom/work-calendar.git"
},
"split_keywords": [
"utility",
" python",
" official",
" work",
" calendar",
" russia"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "97a252adf6150e13e2b94a9aca52f0ffa97e59e75d18e0b60d62e796d2ce1e6e",
"md5": "fe94186d17254c5fb4dfdca238b71c97",
"sha256": "086fc676161dcce2d4c9ca8b816867df54b5ece40601f9e475546611be2fd9dc"
},
"downloads": -1,
"filename": "work_calendar-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fe94186d17254c5fb4dfdca238b71c97",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 9271,
"upload_time": "2024-10-18T23:47:13",
"upload_time_iso_8601": "2024-10-18T23:47:13.615845Z",
"url": "https://files.pythonhosted.org/packages/97/a2/52adf6150e13e2b94a9aca52f0ffa97e59e75d18e0b60d62e796d2ce1e6e/work_calendar-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7e88762782fea6bf2b50330348b9dff7bd4f35f9eb936abcfdfd881031952a0c",
"md5": "dab43fe4ae92813cd9b2c48e1b0e4be2",
"sha256": "4ba55ae673c7729ae76be62120d7318acea5e2bea16c61956fbe43a9143f7299"
},
"downloads": -1,
"filename": "work_calendar-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "dab43fe4ae92813cd9b2c48e1b0e4be2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 9627,
"upload_time": "2024-10-18T23:47:15",
"upload_time_iso_8601": "2024-10-18T23:47:15.280059Z",
"url": "https://files.pythonhosted.org/packages/7e/88/762782fea6bf2b50330348b9dff7bd4f35f9eb936abcfdfd881031952a0c/work_calendar-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-18 23:47:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Polyrom",
"github_project": "work-calendar",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "work-calendar"
}