# dias_uteis
Biblioteca feita para facilitar o uso e cálculos de dias úteis no calendário brasileiro.
- Sem dependências externas.
- Testado em todas versões do Python a partir da versão 3.6.
- Fácil uso, API simples.
- Extremamente leve.
# Instalação
```
pip install dias_uteis
```
# Uso
```python
import datetime
import dias_uteis as dus
```
```
>>> dus.last_du()
datetime.date(2023, 11, 7)
>>> dus.next_du()
datetime.date(2023, 11, 9)
>>> date = datetime.date(2023, 11, 8)
>>> dus.is_du(date)
True
>>> corpus_christi_2020 = datetime.date(2020, 6, 11) # Corpus Christi 2020
>>> dus.is_holiday(corpus_christi_2020)
True
>>> dus.delta_du(date, 5) # Soma 5 dias úteis
datetime.date(2023, 11, 16)
>>> dus.delta_du(date, -2) # Subtrai 2 dias úteis
datetime.date(2023, 11, 6)
>>> a = datetime.date(2023,11,6)
>>> b = datetime.date(2023,11,16)
>>> dus.diff_du(a, b)
7
>>> start = datetime.date(2023, 10, 20)
>>> end = datetime.date(2023, 11, 7)
>>> dus.du_range(start, end)
[datetime.date(2023, 10, 20), datetime.date(2023, 10, 23), datetime.date(2023, 10, 24),
datetime.date(2023, 10, 25), datetime.date(2023, 10, 26), datetime.date(2023, 10, 27),
datetime.date(2023, 10, 30), datetime.date(2023, 10, 31), datetime.date(2023, 11, 1),
datetime.date(2023, 11, 3), datetime.date(2023, 11, 6)]
>>> dus.year_holidays(2023) # Lista todos feriados de 2023
[datetime.date(2023, 1, 1), datetime.date(2023, 2, 20), datetime.date(2023, 2, 21),
datetime.date(2023, 4, 7), datetime.date(2023, 4, 21), datetime.date(2023, 5, 1),
datetime.date(2023, 6, 8), datetime.date(2023, 9, 7), datetime.date(2023, 10, 12),
datetime.date(2023, 11, 2), datetime.date(2023, 11, 15), datetime.date(2023, 12, 25)]
```
Raw data
{
"_id": null,
"home_page": "https://github.com/renanmoretto/dias_uteis",
"name": "dias-uteis",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.6",
"maintainer_email": null,
"keywords": null,
"author": "renanmoretto",
"author_email": "himynameisrenan@outlook.com",
"download_url": "https://files.pythonhosted.org/packages/d8/d1/e19f56d2838a892599c4fcebb545bf43218fda22b4757e687696c90c7592/dias_uteis-0.1.13.tar.gz",
"platform": null,
"description": "# dias_uteis\nBiblioteca feita para facilitar o uso e c\u00e1lculos de dias \u00fateis no calend\u00e1rio brasileiro.\n\n- Sem depend\u00eancias externas.\n- Testado em todas vers\u00f5es do Python a partir da vers\u00e3o 3.6.\n- F\u00e1cil uso, API simples.\n- Extremamente leve.\n\n# Instala\u00e7\u00e3o\n```\npip install dias_uteis\n```\n\n# Uso\n```python\nimport datetime\nimport dias_uteis as dus\n```\n```\n>>> dus.last_du()\ndatetime.date(2023, 11, 7)\n\n>>> dus.next_du() \ndatetime.date(2023, 11, 9)\n\n>>> date = datetime.date(2023, 11, 8)\n>>> dus.is_du(date)\nTrue\n\n>>> corpus_christi_2020 = datetime.date(2020, 6, 11) # Corpus Christi 2020\n>>> dus.is_holiday(corpus_christi_2020)\nTrue\n\n>>> dus.delta_du(date, 5) # Soma 5 dias \u00fateis\ndatetime.date(2023, 11, 16)\n\n>>> dus.delta_du(date, -2) # Subtrai 2 dias \u00fateis\ndatetime.date(2023, 11, 6)\n\n>>> a = datetime.date(2023,11,6)\n>>> b = datetime.date(2023,11,16)\n>>> dus.diff_du(a, b)\n7\n\n>>> start = datetime.date(2023, 10, 20) \n>>> end = datetime.date(2023, 11, 7) \n>>> dus.du_range(start, end)\n[datetime.date(2023, 10, 20), datetime.date(2023, 10, 23), datetime.date(2023, 10, 24),\ndatetime.date(2023, 10, 25), datetime.date(2023, 10, 26), datetime.date(2023, 10, 27),\ndatetime.date(2023, 10, 30), datetime.date(2023, 10, 31), datetime.date(2023, 11, 1), \ndatetime.date(2023, 11, 3), datetime.date(2023, 11, 6)]\n\n>>> dus.year_holidays(2023) # Lista todos feriados de 2023\n[datetime.date(2023, 1, 1), datetime.date(2023, 2, 20), datetime.date(2023, 2, 21), \ndatetime.date(2023, 4, 7), datetime.date(2023, 4, 21), datetime.date(2023, 5, 1), \ndatetime.date(2023, 6, 8), datetime.date(2023, 9, 7), datetime.date(2023, 10, 12), \ndatetime.date(2023, 11, 2), datetime.date(2023, 11, 15), datetime.date(2023, 12, 25)]\n```",
"bugtrack_url": null,
"license": null,
"summary": "Ferramentas para c\u00e1lculos de dias \u00fateis no calend\u00e1rio brasileiro.",
"version": "0.1.13",
"project_urls": {
"Homepage": "https://github.com/renanmoretto/dias_uteis",
"Repository": "https://github.com/renanmoretto/dias_uteis"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1eb551f4edbe6b490cfbb2ea16962271ad2dbc60dfd7b9103f1497931bbf2ee7",
"md5": "2203864978bafc9bfe960a87fcc19d19",
"sha256": "7519fec7b28d81eede518ae38cbf91cc2541b008a8300af81416b0d5a2497960"
},
"downloads": -1,
"filename": "dias_uteis-0.1.13-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2203864978bafc9bfe960a87fcc19d19",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.6",
"size": 6941,
"upload_time": "2024-11-20T00:21:00",
"upload_time_iso_8601": "2024-11-20T00:21:00.675098Z",
"url": "https://files.pythonhosted.org/packages/1e/b5/51f4edbe6b490cfbb2ea16962271ad2dbc60dfd7b9103f1497931bbf2ee7/dias_uteis-0.1.13-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d8d1e19f56d2838a892599c4fcebb545bf43218fda22b4757e687696c90c7592",
"md5": "98f7491921f62820c6aac4025418a9f9",
"sha256": "9db7de796d07c8ccdd0e87762f6915402a63aef03c95f2be3168c986ddde2c1b"
},
"downloads": -1,
"filename": "dias_uteis-0.1.13.tar.gz",
"has_sig": false,
"md5_digest": "98f7491921f62820c6aac4025418a9f9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.6",
"size": 6643,
"upload_time": "2024-11-20T00:21:02",
"upload_time_iso_8601": "2024-11-20T00:21:02.419762Z",
"url": "https://files.pythonhosted.org/packages/d8/d1/e19f56d2838a892599c4fcebb545bf43218fda22b4757e687696c90c7592/dias_uteis-0.1.13.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-20 00:21:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "renanmoretto",
"github_project": "dias_uteis",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "dias-uteis"
}