diff --git a/.github/ISSUE_TEMPLATE/custom.md b/.github/ISSUE_TEMPLATE/custom.md index 8d25f51..ef69b96 100644 --- a/.github/ISSUE_TEMPLATE/custom.md +++ b/.github/ISSUE_TEMPLATE/custom.md @@ -6,5 +6,3 @@ labels: Question assignees: '' --- - - diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 746eba1..e9ae8fb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.4 + rev: v0.8.0 hooks: - id: ruff diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 27e994c..a50f36f 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -19,5 +19,5 @@ python: extra_requirements: - docs -mkdocs: - configuration: mkdocs.yml +sphinx: + configuration: docs/conf.py diff --git a/CHANGELOG.md b/CHANGELOG similarity index 82% rename from CHANGELOG.md rename to CHANGELOG index 3dd0ae5..8a1481e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG @@ -1,29 +1,36 @@ -# Changelog +Changelog +========= -## 6.5.0 (2024-08-18) +6.5.0 (2024-08-18) +------------------ - Remove API Correios from website. -## 6.4.1 (2024-08-18) +6.4.1 (2024-08-18) +------------------ - Fix beautifulsoup4 version -## 6.4.0 (2024-08-14) +6.4.0 (2024-08-14) +------------------ - Add API Correios (via Correios site) support - Add OpenCEP support -## 6.3.1 (2024-05-05) +6.3.1 (2024-05-05) +------------------ Update copyright and python version -## 6.3.0 (2024-05-05) +6.3.0 (2024-05-05) +------------------ - Change poetry `pyproject.toml` and use default `pyproject.toml` from Python docs - Improve nox tests and dependencies enviromnents - Add support to Python 3.12 -## 6.2.0 (2023-10-01) +6.2.0 (2023-10-01) +------------------ - Add timeout settings - Add proxy settings. From: https://github.com/mstuttgart/brazilcep/issues/40 @@ -31,12 +38,14 @@ Update copyright and python version - Update docs and README - Deprecated 'Correios' webservice support -## 6.1.0 (2023-10-01) +6.1.0 (2023-10-01) +------------------ - Add timeout parameters in requests - Update README typing errors -## 6.0.0 (2023-04-30) +6.0.0 (2023-04-30) +------------------ - Rename lib to BrazilCEP - Create new pip package @@ -52,13 +61,15 @@ Update copyright and python version - Create docs site (translate to English) - Update contribute doc to use poetry -## 5.1.0 (2022-10-12) +5.1.0 (2022-10-12) +------------------ * Corrige: AttributeError: 'NoneType' object has no attribute 'split' ao consultar cep 99999-999 * Adiciona nova exception 'BlockedByFlood' para excesso de consultas * Melhoras testes adicionando mock as consultas de ViaCEP e ApiCEP -## 5.0.0 (2021-01-07) +5.0.0 (2021-01-07) +------------------ * Adiciona suporte para Python 3.8 * Adiciona integração com consulta de CEP nos webservices dos Correios @@ -71,26 +82,31 @@ Update copyright and python version * Uso de TOX para testes em diferentes versões do Python * Adiciona novos testes e aumenta taxa do coverage -## 4.0.4 (2020-08-18) +4.0.4 (2020-08-18) +------------------ * Corrige "AttributeError: 'ConnectionError' object has no attribute 'message'" -## 4.0.3 (2020-06-08) +4.0.3 (2020-06-08) +------------------ * Corrige 'get_cep_from_address' error key - thanks Hendrix Costa https://github.com/hendrixcosta * Corrige docs -## 4.0.2 (2020-05-31) +4.0.2 (2020-05-31) +------------------ * Corrige exemplo de uso do 'get_cep_from_address' * Corrige "(client): KeyError exception when address not found" - thanks Patrick Ferraz https://github.com/patricksferraz * Adiciona captura de erro com status_code=200 - thanks Bruno Mello https://github.com/bgmello -## 4.0.1 (2020-02-22) +4.0.1 (2020-02-22) +------------------ * Corrige travis.yml deploy -## 4.0.0 (2020-02-22) +4.0.0 (2020-02-22) +------------------ * Adiciona suporte a API do ViaCEP (https://viacep.com.br/) * Adiciona consulta de faixa de CEPs @@ -101,39 +117,45 @@ Update copyright and python version Milestone: https://github.com/mstuttgart/pycep-correios/milestone/4 -## 3.2.0 (2019-08-18) +3.2.0 (2019-08-18) +------------------ * Remove suporte para Python 3.4: https://www.python.org/downloads/release/python-3410/ * Adiciona suporte para retorno com atributos ausentes * Adiciona mock aos testes -## 3.1.0 (2018-11-11) +3.1.0 (2018-11-11) +------------------ * Correção no tipo do retorno do metodo consultar_cep (por questões de compatibilidade, agora retorna um dict) * Correção da documentação, pois as tags 'id' e 'complemento' não estão mais sendo retornadas pelo Correios. * Atualização do README.md para uso de markdown no pypi e documentação. -## 3.0.0 (2018-10-21) +3.0.0 (2018-10-21) +------------------ * Alteração da API de consulta para [python-zeep](https://pypi.org/project/zeep/) * Antigas `exceptions` agora estão `deprecated`. Usar apenas `ExcecaoPyCEPCorreios` * Atualização da documentação * Remoção do suporte para Python 2.7 -## 2.3.1 (2018-05-03) +2.3.1 (2018-05-03) +------------------ * Corrige README.rst * Adiciona comando para validação dpo setup.py no Makefile * Corrige link do repositorio e donwload -## 2.3.0 (2018-05-03) +2.3.0 (2018-05-03) +------------------ * Adiciona logging para consulta de CEP * Adiciona documentação em inglês * Versão requirida das libs *requests* e da *Jinja2* limitadas por baixo, para fins de compatibilidade * Remove suporte para Python 3.3 -## 2.2.0 (2017-07-16) +2.2.0 (2017-07-16) +------------------ * Melhorias no metodo de formatar_cep, que agora passou a utilizar expressão regular para verificar se o CEP é formado por caracteres. * A função *formatar_cep* agora passa a lançar a exceção *Value Error* quando o CEP não possui estrutura válida https://github.com/mstuttgart/pycep-correios/pull/22 @@ -141,16 +163,19 @@ Milestone: https://github.com/mstuttgart/pycep-correios/milestone/4 * Adicionado ambientes de *Homologação* e *Producao*. Facilitando realizar consultas utilizadas para testes. close https://github.com/mstuttgart/pycep-correios/issues/24 * Melhorias na organização da API. -## 2.1.1 (2017-06-30) +2.1.1 (2017-06-30) +------------------ * Correção de erros de unicode com python2.7 -## 2.1.0 (2017-06-29) +2.1.0 (2017-06-29) +------------------ * Adicionado suporte para Python 2.7+ * Ajustes e correções na documentação -## 2.0.0 (2017-06-20) +2.0.0 (2017-06-20) +------------------ * Atualização do código da PyCEPCorreios, deixando-a mais facil de ser utilizada * Remoção das exceções antigas, deixando apenas a Exceção padrão da lib @@ -160,40 +185,47 @@ Milestone: https://github.com/mstuttgart/pycep-correios/milestone/4 * Adicionado testes com TOX * Adicionado método de validação de CEP e formatação de CEP -## 1.1.7 (2017-05-09) +1.1.7 (2017-05-09) +------------------ * Corrigido erro `jinja2.exceptions.TemplateNotFound: consultacep.xml` * Erro durante instalação da PyCEPCorreios via pip * Atualizado código de exemplo no README.rst * Atualizado exemplos na documentação -## 1.1.6 (2017-05-08) +1.1.6 (2017-05-08) +------------------ -* Correção de bug durante instalação. #15 +* Correção de bug durante instalação. 15 * Correção de template xml ausente no pacote do modulo * Melhorias gerais no código e correções de bugs -## 1.1.1 (2017-02-08) +1.1.1 (2017-02-08) +------------------ * Melhorias gerais no código * XML schema utilizando Jinja2 -## 1.0.1 (2016-08-03) +1.0.1 (2016-08-03) +------------------ * Simplificação da classes Exceptions * Organização do código de teste * Utilização do mock para test -## 1.0.0 (2016-07-31) +1.0.0 (2016-07-31) +------------------ * API migrada para Python 3. Python 2.7 não será mais suportado * Substituição da lib *suds* pela lib *requests* para realizar as requisições -## 0.0.2 (2016-05-09) +0.0.2 (2016-05-09) +------------------ * `setup.py` com número de versão atualizado e dependência corrigidas. -## 0.0.1 (2016-05-05) +0.0.1 (2016-05-05) +------------------ * Versão inicial. * Permite busca no webservice dos correios dos dados de um CEP fornecido. diff --git a/Makefile b/Makefile index 357b44a..3900ed5 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ help: .PHONY : check check: make pre-commit - # make docs + make docs make test make build @@ -40,19 +40,21 @@ build : .PHONY : coverage coverage: - pytest --cov=. --cov-config=pyproject.toml --cov-report term-missing --no-cov-on-fail + pytest --cov=brazilcep --cov-config=pyproject.toml --cov-report term-missing --no-cov-on-fail --cov-report=html .PHONY : lint lint: - isort --check . - black --check brazilcep tests --exclude .tox - ruff check . + isort --check brazilcep tests + black --check brazilcep tests + ruff check brazilcep tests CUDA_VISIBLE_DEVICES='' pytest -v --color=yes --doctest-modules tests/ brazilcep/ .PHONY : docs docs: - sphinx-build -E -T -W -b html -D language=en -j auto -q docs/source docs/build + rm -rf docs/build/ + sphinx-autobuild -b html --watch brazilcep/ docs/source/ docs/build/ +.PHONY : pre-commit pre-commit: pre-commit run --all-files @@ -64,6 +66,7 @@ setup: pip install -e ".[build]" pre-commit install --hook-type pre-commit pre-commit install --hook-type pre-push + pre-commit autoupdate .PHONY : test test: diff --git a/README.md b/README.md index 9c89e20..0cf1666 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,11 @@ - Codecov + Codecov + + + + readthedocs @@ -41,7 +45,7 @@ ## About -**BrazilCEP** is a minimalist and easy-to-use python library designed to query CEP (Postal Address Code) data. +**BrazilCEP** is a minimalist and easy-to-use Python library designed to query CEP (Postal Address Code) data. Its objective is to provide a common query interface to all these search services, facilitating the integration of Python applications with these services. @@ -51,7 +55,7 @@ Currently supports several CEP API's: - [ApiCEP (WideNet)](https://apicep.com) - [OpenCEP](https://opencep.com/) -> [!NOTE] > **BrazilCEP** is the new name of former **PyCEPCorreio** python library. +> [!NOTE] > **BrazilCEP** is the new name of former **PyCEPCorreio** Python library. > If you want to migrate the old code to the new version, please see the [migrate](https://brazilcep.readthedocs.io/en/latest/migrate/) section in docs. > [!TIP] > **CEP** or **Código de Endereçamento Postal** (_Postal Address Code_), as it is also known, is a system of numeric codes, created, maintained and organized by _Correios do Brazil_ for diff --git a/brazilcep/__init__.py b/brazilcep/__init__.py index b7e8e23..c3b975f 100644 --- a/brazilcep/__init__.py +++ b/brazilcep/__init__.py @@ -8,13 +8,15 @@ Its objective is to provide a common query interface to all these search services, facilitating the integration of Python applications with these services. -:copyright: (c) 2023 by Michell Stuttgart. +:copyright: (c) 2024 by Michell Stuttgart. :license: MIT, see LICENSE for more details. """ +from .__version__ import __version__ from .client import WebService, get_address_from_cep __all__ = [ "get_address_from_cep", "WebService", + "__version__", ] diff --git a/brazilcep/__version__.py b/brazilcep/__version__.py new file mode 100644 index 0000000..b61ecef --- /dev/null +++ b/brazilcep/__version__.py @@ -0,0 +1 @@ +__version__ = "6.5.0" diff --git a/brazilcep/client.py b/brazilcep/client.py index f650b96..d5caccf 100644 --- a/brazilcep/client.py +++ b/brazilcep/client.py @@ -53,7 +53,7 @@ def get_address_from_cep(cep, webservice=WebService.APICEP, timeout=None, proxie RequestError: When connection error occurs in CEP query Timeout: When occurs timeout of webservice response HTTPError: Invalid HTTP format query - CEPNotFund: CEP not exist in API + CEPNotFound: CEP not exist in API Exception: When any error occurs in the CEP query returns: diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md deleted file mode 100644 index 3a59fbb..0000000 --- a/docs/CHANGELOG.md +++ /dev/null @@ -1,194 +0,0 @@ -# Changelog - -## 6.5.0 (2024-08-18) - -- Remove API Correios from website. - -## 6.4.1 (2024-08-18) - -- Fix beautifulsoup4 version - -## 6.4.0 (2024-08-14) - -- Add API Correios (via Correios site) support -- Add OpenCEP support - -## 6.3.1 (2024-05-05) - -Update copyright and python version - -## 6.3.0 (2024-05-05) - -- Change poetry `pyproject.toml` and use default `pyproject.toml` from Python docs -- Improve nox tests and dependencies enviromnents -- Add support to Python 3.12 - -## 6.2.0 (2023-10-01) - -- Add timeout settings -- Add proxy settings. From: https://github.com/mstuttgart/brazilcep/issues/40 -- Add real tests to APICEP and ViaCEP -- Update docs and README -- Deprecated 'Correios' webservice support - -## 6.0.0 (2023-05-01) - -- Rename lib to BrazilCEP -- Create new pip package -- Remove support for Python 3.5, 3.6, and 3.7 -- Add support to Python 3.9, 3.10, and 3.11 -- Add poetry to manage project dependencies -- Add matrix test of Python versions using nox -- Improve docs and code -- Fix Github actions lint -- Fix Github actions coverage -- Improve lint test -- Improve coverage test -- Create docs site (translate to English) -- Update contribute doc to use poetry - -## 5.1.0 (2022-10-12) - -* Corrige: AttributeError: 'NoneType' object has no attribute 'split' ao consultar cep 99999-999 -* Adiciona nova exception 'BlockedByFlood' para excesso de consultas -* Melhoras testes adicionando mock as consultas de ViaCEP e ApiCEP - -## 5.0.0 (2021-01-07) - -* Adiciona suporte para Python 3.8 -* Adiciona integração com consulta de CEP nos webservices dos Correios -* Adiciona integração com consulta de CEP no webservice da APICEP.com -* Adiciciona novas exceptions para melhor tratamentos de erros. -* Remove deprecated methods (consulta_cep, validar_cep, formatar_cep) -* Remove deprecated exceptions (ExcecaoPyCEPCorreios, CEPInvalido, FalhaNaConexao, MultiploRedirecionamento, Timeout) -* Remove function 'get_cep_from_address', por falta de uso -* Remove documentação antiga e centraliza exemplos de uso no README -* Uso de TOX para testes em diferentes versões do Python -* Adiciona novos testes e aumenta taxa do coverage - -## 4.0.4 (2020-08-18) - -* Corrige "AttributeError: 'ConnectionError' object has no attribute 'message'" - -## 4.0.3 (2020-06-08) - -* Corrige 'get_cep_from_address' error key - thanks Hendrix Costa https://github.com/hendrixcosta -* Corrige docs - -## 4.0.2 (2020-05-31) - -* Corrige exemplo de uso do 'get_cep_from_address' -* Corrige "(client): KeyError exception when address not found" - thanks Patrick Ferraz https://github.com/patricksferraz -* Adiciona captura de erro com status_code=200 - thanks Bruno Mello https://github.com/bgmello - -## 4.0.1 (2020-02-22) - -* Corrige travis.yml deploy - -## 4.0.0 (2020-02-22) - -* Adiciona suporte a API do ViaCEP (https://viacep.com.br/) -* Adiciona consulta de faixa de CEPs -* Adiciona function format_cep, validate_cep -* Adiciona nova function de busca de CEP -* Adiciona suporte para Python 3.7 -* Ajustes no codigo e documentação - -Milestone: https://github.com/mstuttgart/pycep-correios/milestone/4 - -## 3.2.0 (2019-08-18) - -* Remove suporte para Python 3.4: https://www.python.org/downloads/release/python-3410/ -* Adiciona suporte para retorno com atributos ausentes -* Adiciona mock aos testes - -## 3.1.0 (2018-11-11) - -* Correção no tipo do retorno do metodo consultar_cep (por questões de compatibilidade, agora retorna um dict) -* Correção da documentação, pois as tags 'id' e 'complemento' não estão mais sendo retornadas pelo Correios. -* Atualização do README.md para uso de markdown no pypi e documentação. - -## 3.0.0 (2018-10-21) - -* Alteração da API de consulta para [python-zeep](https://pypi.org/project/zeep/) -* Antigas `exceptions` agora estão `deprecated`. Usar apenas `ExcecaoPyCEPCorreios` -* Atualização da documentação -* Remoção do suporte para Python 2.7 - -## 2.3.1 (2018-05-03) - -* Corrige README.rst -* Adiciona comando para validação dpo setup.py no Makefile -* Corrige link do repositorio e donwload - -## 2.3.0 (2018-05-03) - -* Adiciona logging para consulta de CEP -* Adiciona documentação em inglês -* Versão requirida das libs *requests* e da *Jinja2* limitadas por baixo, para fins de compatibilidade -* Remove suporte para Python 3.3 - -## 2.2.0 (2017-07-16) - -* Melhorias no metodo de formatar_cep, que agora passou a utilizar expressão regular para verificar se o CEP é formado por caracteres. -* A função *formatar_cep* agora passa a lançar a exceção *Value Error* quando o CEP não possui estrutura válida https://github.com/mstuttgart/pycep-correios/pull/22 -* Adicionado novas exceções ExcecaoPyCEPCorreios, Timeout, MultiploRedirecionamento, FalhaNaConexao. Consultar documentacao para exemplos de utilização delas. close https://github.com/mstuttgart/pycep-correios/issues/25 -* Adicionado ambientes de *Homologação* e *Producao*. Facilitando realizar consultas utilizadas para testes. close https://github.com/mstuttgart/pycep-correios/issues/24 -* Melhorias na organização da API. - -## 2.1.1 (2017-06-30) - -* Correção de erros de unicode com python2.7 - -## 2.1.0 (2017-06-29) - -* Adicionado suporte para Python 2.7+ -* Ajustes e correções na documentação - -## 2.0.0 (2017-06-20) - -* Atualização do código da PyCEPCorreios, deixando-a mais facil de ser utilizada -* Remoção das exceções antigas, deixando apenas a Exceção padrão da lib -* Remoção da classe PyCEPCorreios -* Alteração dos *imports* da lib para facilitar seu uso e diminuir tamanho dos *imports* -* Adicionado documentação com Sphinx -* Adicionado testes com TOX -* Adicionado método de validação de CEP e formatação de CEP - -## 1.1.7 (2017-05-09) - -* Corrigido erro `jinja2.exceptions.TemplateNotFound: consultacep.xml` -* Erro durante instalação da PyCEPCorreios via pip -* Atualizado código de exemplo no README.rst -* Atualizado exemplos na documentação - -## 1.1.6 (2017-05-08) - -* Correção de bug durante instalação. #15 -* Correção de template xml ausente no pacote do modulo -* Melhorias gerais no código e correções de bugs - -## 1.1.1 (2017-02-08) - -* Melhorias gerais no código -* XML schema utilizando Jinja2 - -## 1.0.1 (2016-08-03) - -* Simplificação da classes Exceptions -* Organização do código de teste -* Utilização do mock para test - -## 1.0.0 (2016-07-31) - -* API migrada para Python 3. Python 2.7 não será mais suportado -* Substituição da lib *suds* pela lib *requests* para realizar as requisições - -## 0.0.2 (2016-05-09) - -* `setup.py` com número de versão atualizado e dependência corrigidas. - -## 0.0.1 (2016-05-05) - -* Versão inicial. -* Permite busca no webservice dos correios dos dados de um CEP fornecido. diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md deleted file mode 100644 index 2f2fd3a..0000000 --- a/docs/CONTRIBUTING.md +++ /dev/null @@ -1,31 +0,0 @@ -# Contribute - -Contributions are welcome and greatly appreciated! - -## Types of contributions - -You can contribute in several ways: - -### Reporting bugs - -Report bugs [here](https://github.com/mstuttgart/brazilcep/issues). - -If you are reporting a *bug*, please include: - -* The name and version of your operating system. -* Any details about your local configuration that might be helpful in troubleshooting. -* Detailed steps to reproduce the bug. - -### Fixing bugs - -Search the *issues* list for those with the *Bug* tag. -Any *issue* marked "Bug" is open to anyone who wants to fix it. - -### Adding new features - -Search the list of *issues* for ones with the tag *Improvement* or *New feature*. -Any *issue* tagged with these *tags* is open to anyone who wants to implement it. - -### Sending Suggestions and Questions - -The best way to send suggestions and questions is to open an *issue* [here](https://github.com/mstuttgart/brazilcep/issues). diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index 785785e..0000000 --- a/docs/index.md +++ /dev/null @@ -1,64 +0,0 @@ - -

- - - -
- BrazilCEP -

- -

- - - GitHub Workflow Status - - - - Codecov - - - - Downloads - - - - Ratings - - - - Version - - -

- -**BrazilCEP** is a minimalist and easy-to-use python library designed to query CEP (brazilian zip codes) data. - -Its objective is to provide a common query interface to all these search services, facilitating the integration of Python applications with these services. - -```python ->>> get_address_from_cep('37503-130') -{ - 'bairro': 'str', - 'cep': 'str', - 'cidade': 'str', - 'logradouro': 'str', - 'uf': 'str', - 'complemento': 'str', -} -``` - -!!! tip - - **BrazilCEP** is the new name of former **PyCEPCorreio** python library. - If you want to migrate the old code to the new version, please see the [migrate](/migrate) section. - -## Features - -* Cross-platform: Windows, Mac, and Linux are officially supported. -* Works with Python 3.9+. -* Currently supports several CEP API's: - * [ViaCEP](https://viacep.com.br) - * [ApiCEP (WideNet)](https://apicep.com) - * [OpenCEP](https://opencep.com/) - -BrazilCEP started as a personal study project and evolved into a serious and open source project that is used by many developers on a daily basis. diff --git a/docs/install.md b/docs/install.md deleted file mode 100644 index c74aad1..0000000 --- a/docs/install.md +++ /dev/null @@ -1,13 +0,0 @@ -# Install - -The recommended way to get BrazilCEP is to **install the latest stable release** -via [pip](http://pip-installer.org>): - -```sh -pip install brazilcep -``` - -BrazilCEP has only a few **direct dependencies**: - -- [Zeep](https://pypi.org/project/zeep): for SOAP requests. -- [requests](https://pypi.org/project/requests): for REST API requests. diff --git a/docs/migrate.md b/docs/migrate.md deleted file mode 100644 index 532f2a2..0000000 --- a/docs/migrate.md +++ /dev/null @@ -1,67 +0,0 @@ -# Migrate - -**BrazilCEP** is the new name of former **PycepCorreios**. This page -guide you on to process of migrate old code to new version. - -It's simples migrate te code and require minimal steps. - -## imports - -First, rename the `import` statements from: - -```python title="PyCEPCorreios" -import pycepcorreios -``` -to - -```python title="BrazilCEP" -import brazilcep -``` - -## Query results - -The next step, is adjust the *keys* of query returned by `get_address_from_cep` function. - -The keys have simply been translated to english. Take a look on this old code: - -``` python title="PyCEPCorreios" ->>> get_address_from_cep('37503-130') -{ - 'bairro': 'rua abc', - 'cep': '37503130', - 'cidade': 'city ABC', - 'logradouro': 'str', - 'uf': 'str', - 'complemento': 'str', -} -``` -This is the new code: - -``` python title="BrazilCEP" ->>> get_address_from_cep('37503-130') -{ - 'district': 'rua abc', - 'cep': '37503130', - 'city': 'city ABC', - 'street': 'str', - 'uf': 'str', - 'complement': 'str', -} -``` - -## Exceptions - -The follow Exceptions have been removed. - -```python -exceptions.ConnectionError -exceptions.Timeout -exceptions.HTTPError -exceptions.BaseException -``` - -Please, use the [requests](https://requests.readthedocs.io/en/latest/user/quickstart/#errors-and-exceptions) exceptions instead. - -## Questions? - -The best way to send question is open a issue in **BrazilCEP** issue tracker [here](https://github.com/mstuttgart/brazilcep/issues). diff --git a/docs/source/_static/favicon.ico b/docs/source/_static/favicon.ico new file mode 100644 index 0000000..7598529 Binary files /dev/null and b/docs/source/_static/favicon.ico differ diff --git a/docs/static/icon-bazilcep.png b/docs/source/_static/logo.png similarity index 100% rename from docs/static/icon-bazilcep.png rename to docs/source/_static/logo.png diff --git a/docs/source/_templates/sidebar-intro.html b/docs/source/_templates/sidebar-intro.html new file mode 100644 index 0000000..b420a7b --- /dev/null +++ b/docs/source/_templates/sidebar-intro.html @@ -0,0 +1,18 @@ + + + + +

+ BrazilCEP is Python library designed to query CEP (brazilian zip codes) data +

+ +

+ +

diff --git a/docs/source/_templates/sidebar-links.html b/docs/source/_templates/sidebar-links.html new file mode 100644 index 0000000..04ad2bf --- /dev/null +++ b/docs/source/_templates/sidebar-links.html @@ -0,0 +1,11 @@ +

Useful Links

+ +
diff --git a/docs/source/api.rst b/docs/source/api.rst new file mode 100644 index 0000000..49db6ef --- /dev/null +++ b/docs/source/api.rst @@ -0,0 +1,79 @@ +.. _api: + +============= +API Reference +============= + +.. module:: brazilcep + +This part of the documentation covers all the interfaces of BrazilCEP. + +Client +------ + +The main BrazilCEP' functionality can be accessed by this function. + +.. autofunction:: get_address_from_cep + +Exceptions +---------- + +.. autoexception:: brazilcep.exceptions.BrazilCEPException +.. autoexception:: brazilcep.exceptions.InvalidCEP +.. autoexception:: brazilcep.exceptions.CEPNotFound +.. autoexception:: brazilcep.exceptions.BlockedByFlood + +Webservices +----------- + +.. autofunction:: brazilcep.apicep.fetch_address +.. autofunction:: brazilcep.opencep.fetch_address +.. autofunction:: brazilcep.viacep.fetch_address + + +Migrate from PyCEPCorreios +-------------------------- + +**BrazilCEP** is the new name of former **PyCEPCorreios**. It's simples migrate te code and require minimal steps. + +First, rename the `import` statements from:: + + >>> import pycepcorreios + +to:: + + >>> import brazilcep + +The next step, is adjust the *keys* of query returned by `get_address_from_cep` function. + +The keys have simply been translated to english. Take a look on this old code:: + + >>> get_address_from_cep('37503-130') + { + 'bairro': 'rua abc', + 'cep': '37503130', + 'cidade': 'city ABC', + 'logradouro': 'str', + 'uf': 'str', + 'complemento': 'str', + } + +This is the new code:: + + >>> get_address_from_cep('37503-130') + { + 'district': 'rua abc', + 'cep': '37503130', + 'city': 'city ABC', + 'street': 'str', + 'uf': 'str', + 'complement': 'str', + } + +The follow `Exceptions` have been removed: + +* `ConnectionError` +* `Timeout` +* `HTTPError` +* `BaseException` + diff --git a/docs/source/changes.rst b/docs/source/changes.rst new file mode 100644 index 0000000..e272c5a --- /dev/null +++ b/docs/source/changes.rst @@ -0,0 +1 @@ +.. include:: ../../CHANGELOG diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..45fcb6f --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,126 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +import logging +import os +import sys +from datetime import datetime + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# + +sys.path.insert(0, os.path.abspath("../../")) + +import brazilcep + +# -- Project information ----------------------------------------------------- + +project = "BrazilCEP" +copyright = f"{datetime.today().year}, Michell Stuttgart" +author = "Michell Stuttgart" +version = brazilcep.__version__ +release = brazilcep.__version__ + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.napoleon", + "sphinx.ext.intersphinx", + "sphinx.ext.viewcode", + "sphinx.ext.doctest", + "sphinx_copybutton", + "sphinx_autodoc_typehints", +] + +# Tell myst-parser to assign header anchors for h1-h3. +myst_heading_anchors = 3 + +# suppress_warnings = ["myst.header"] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ["_build"] + +source_suffix = [".rst", ".md"] + +intersphinx_mapping = { + "python": ("https://docs.python.org/3", None), + # Uncomment these if you use them in your codebase: + # "torch": ("https://pytorch.org/docs/stable", None), + # "datasets": ("https://huggingface.co/docs/datasets/master/en", None), + # "transformers": ("https://huggingface.co/docs/transformers/master/en", None), +} + +# By default, sort documented members by type within classes and modules. +autodoc_member_order = "groupwise" + +# Include default values when documenting parameter types. +typehints_defaults = "comma" + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = "alabaster" + +html_title = f"brazilcep v{brazilcep.__version__}" + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ["_static"] + +# html_css_files = ["css/custom.css"] + +html_favicon = "_static/favicon.ico" + +html_theme_options = { + "logo": "logo.png", + "show_powered_by": False, + "github_user": "mstuttgart", + "github_repo": "brazilcep", + "github_banner": True, + "show_related": False, + "note_bg": "#FFF59C", +} + +# Custom sidebar templates, maps document names to template names. +html_sidebars = { + # "index": ["sidebar-intro.html"], + "**": [ + 'sidebar-intro.html', + 'globaltoc.html', + 'sidebar-links.html', + 'searchbox.html', + ], +} + +# -- Hack to get rid of stupid warnings from sphinx_autodoc_typehints -------- + + +class ShutupSphinxAutodocTypehintsFilter(logging.Filter): + def filter(self, record: logging.LogRecord) -> bool: + if "Cannot resolve forward reference" in record.msg: + return False + return True + + +logging.getLogger("sphinx.sphinx_autodoc_typehints").addFilter(ShutupSphinxAutodocTypehintsFilter()) diff --git a/docs/source/dev/contributing.rst b/docs/source/dev/contributing.rst new file mode 100644 index 0000000..6c1e4e3 --- /dev/null +++ b/docs/source/dev/contributing.rst @@ -0,0 +1,136 @@ +============ +Contributing +============ + +.. _prs: https://github.com/mstuttgart/brazilcep/pulls +.. _`main branch`: https://github.com/mstuttgart/brazilcep/tree/main + +Thanks for considering contributing! Please read this document to learn the +various ways you can contribute to this project and how to go about doing it. + +Bug reports and feature requests +================================ + +Did you find a bug? +------------------- + +First, do `a quick search `_ to see whether your issue has already been reported. +If your issue has already been reported, please comment on the existing issue. Otherwise, +open `a new GitHub issue `_. + +Be sure to include a clear title +and description. The description should include as much relevant information as possible and should explain how +to reproduce the erroneous behavior as well as the behavior you expect to see. +Ideally you would include a code sample or an executable test case demonstrating the expected behavior. + +Do you have a suggestion for an enhancement or new feature? +----------------------------------------------------------- + +We use GitHub issues to track feature requests. Before you create a feature request: + +* Make sure you have a clear idea of the enhancement you would like. If you have a vague idea, consider discussing it first on a GitHub issue. +* Check the documentation to make sure your feature does not already exist. +* Do `a quick search `_ to see whether your feature has already been suggested. + +When creating your request, please: + +* Provide a clear title and description. +* Explain why the enhancement would be useful. It may be helpful to highlight the feature in other libraries. +* Include code examples to demonstrate how the enhancement would be used. + +Contributions are welcome and greatly appreciated! + + +Contributing with fixes and new features +======================================== + +When contributing with fixes and new features, please start forking/branching +from the `main branch`_ to work on the latest code and reduce merging issues. + +Contributed PRs_ are required to include valid test coverage in order to be merged. +Please don't hesitate to ask for help if you need one with the tests. + +Thanks a lot for your support. + + +Running tests +------------- + +First step is setting up development environment and installing all the required dependencies with: + +.. code-block:: shell + + $ virtualenv -p python3 .venv + $ source .venv/bin/activate + + $ make setup + +The project provides automated style, tests and coverage checks: + +.. code-block:: shell + + $ make check + +You can run them separately: + +.. code-block:: shell + + $ make pre-commit + $ make test + +If you want to retrieve uncovered lines too: + +.. code-block:: shell + + $ make coverage + +You can specific tests using ``pytest`` command: + +.. code-block:: shell + + $ pytest tests/test_apicep.py + +Or even more granular: + +.. code-block:: shell + + $ pytest tests/test_apicep.py::test_fetch_address_success + +Code Style +---------- + +BrazilCEP uses a collection of tools to ensure the code base has a consistent +style as it grows. We have these orchestrated using a tool called +`pre-commit`_. This can be installed locally and run over your changes prior +to opening a PR, and will also be run as part of the CI approval process +before a change is merged. + +To check pre-commit, run: + +.. code-block:: shell + + $ make pre-commit + +You can find the full list of formatting requirements specified in the +`.pre-commit-config.yaml`_ at the top level directory of Requests. + +.. _pre-commit: https://pre-commit.com/ +.. _.pre-commit-config.yaml: https://github.com/psf/requests/blob/main/.pre-commit-config.yaml + +Build sphinx documentation +-------------------------- + +.. _readthedocs.io: https://brazilcep.readthedocs.io/ + +The project provides a Sphinx documentation source under ``./docs/source``, +published online on `readthedocs.io`_. + +Great documentation is absolutely key in any a project. If you are not familiar +with reStructuredText for Sphinx you can read a primer +`here`__. + +__ https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html + + +Thanks for your contribution! + diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..42c889f --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,90 @@ + +BrazilCEP: Query CEP Easily™ +============================ + +.. image:: https://static.pepy.tech/badge/brazilcep/month + :target: https://pepy.tech/project/brazilcep/ + :alt: BrazilCEP Downloads Per Month Badge + +.. image:: https://img.shields.io/pypi/l/brazilcep.svg + :target: https://pypi.org/project/brazilcep/ + :alt: License Badge + +.. image:: https://img.shields.io/pypi/v/brazilcep.svg + :target: https://pypi.org/project/brazilcep/ + :alt: BrazilCEP Version Badge + +.. image:: https://img.shields.io/pypi/pyversions/brazilcep.svg + :target: https://pypi.org/project/brazilcep/ + :alt: Python Version Support Badge + +**BrazilCEP** is a minimalist and easy-to-use Python library designed to query CEP (Postal Address Code) data. + +------------------- + +A simple use example:: + + >>> brazilcep.get_address_from_cep('37503-130') + { + 'district': 'rua abc', + 'cep': '37503130', + 'city': 'city ABC', + 'street': 'str', + 'uf': 'str', + 'complement': 'str', + } + + +**BrazilCEP** objective is to provide a common query interface to all these search services, facilitating the integration of Python applications with these services. + +Currently supports several CEP API's: + +- `ViaCEP `_. +- `ApiCEP (WideNet) `_. +- `OpenCEP `_. + +**CEP** or **Código de Endereçamento Postal** (*Postal Address Code*), as it is also known, is a system of numeric codes, +created, maintained and organized by *Correios do Brazil* for organizing addresses and deliveries of letters and parcels. + +The User Guide +-------------- + +This part of the documentation, which is mostly prose, begins with some +background information about BRazilCEP. + +.. toctree:: + :maxdepth: 2 + + user/install + user/quickstart + +The API Documentation / Guide +----------------------------- + +If you are looking for information on a specific function, class, or method, +this part of the documentation is for you. + +.. toctree:: + :maxdepth: 2 + + api + + +The Contributor Guide +--------------------- + +If you want to contribute to the project, this part of the documentation is for +you. + +.. toctree:: + :maxdepth: 3 + + dev/contributing + +Release History +--------------- + +.. toctree:: + :maxdepth: 1 + + changes diff --git a/docs/source/user/install.rst b/docs/source/user/install.rst new file mode 100644 index 0000000..098110d --- /dev/null +++ b/docs/source/user/install.rst @@ -0,0 +1,40 @@ +.. _install: + +Installation +============ + +This part of the documentation covers the installation of BrazilCEP. + +**BrazilCEP** currently supports the follow Python versions: + + .. image:: https://img.shields.io/pypi/pyversions/brazilcep.svg + :target: https://pypi.org/project/brazilcep/ + :alt: Python Version Support Badge + + +Install from PyPi +----------------- + +To install **BrazilCEP**, simply run this simple command in your terminal of choice:: + + pip install brazilcep + +Install from Source Code +------------------------ + +**BrazilCEP** is actively developed on GitHub, where the code is +`always available `_. + +You can either clone the public repository:: + + git clone https://github.com/mstuttgart/brazilcep.git + +Or, download the `tarball `_:: + + curl -OL https://github.com/mstuttgart/brazilcep/tarball/main + +Once you have a copy of the source, you can embed it in your own Python +package, or install it into your site-packages easily:: + + cd brazilcep + pip install -e . diff --git a/docs/source/user/quickstart.rst b/docs/source/user/quickstart.rst new file mode 100644 index 0000000..a5a5d1a --- /dev/null +++ b/docs/source/user/quickstart.rst @@ -0,0 +1,132 @@ +.. _quickstart: + +Quickstart +========== + +.. module:: brazilcep.client + +Eager to get started? This page gives a good introduction in how to get started +with BrazilCEP. + +First, make sure that: + +* BrazilCEP is :ref:`installed ` + + +Let's get started with some simple examples. + + +Make a CEP Request +------------------ + +Making a request with BrazilCEP is very simple. + +Begin by importing the BrazilCEP module:: + + >>> import brazilcep + +Now, call the `get_address_from_cep` to query any CEP:: + + >>> address = brazilcep.get_address_from_cep('37503-130') + +Now, we have a *dict* object called ``address``. We can +get all the address information we need from this object:: + + >>> address + { + 'district': 'rua abc', + 'cep': '37503130', + 'city': 'city ABC', + 'street': 'str', + 'uf': 'str', + 'complement': 'str', + } + +The CEP always must be a string. + +Timeouts +-------- + +You can tell BrazilCEP to stop waiting for a response after a given number of +seconds with the ``timeout`` parameter. Nearly all production code should use +this parameter in nearly all requests. Failure to do so can cause your program +to hang indefinitely:: + + >>> get_address_from_cep('37503-130', timeout=0.001) + Traceback (most recent call last): + File "", line 1, in + requests.exceptions.Timeout: HTTPConnectionPool(host='http://www.viacep.com.br/ws/37503130/json', port=80): Request timed out. (timeout=0.001) + +Proxy +----- + +BrazilCEP also supports proxy setings following *requests* pattern:: + + from brazilcep import get_address_from_cep + + proxies = { + 'https': "00.00.000.000", + 'http': '00.00.000.000', + } + + # set proxies + get_address_from_cep('37503-130', proxies=proxies) + +For more details, please official `requests doc `_. + +Unsing differents API's +----------------------- + +.. note:: + + BrazilCEP was developed to integrate on-demand queries into web pages. + Querying CEP in bulk through scripts or any other means is not recommended. + +.. note:: + + BrazilCEP is not responsible for the functioning, availability and support of any of these query API's. All of them are provided by third parties, and + this library just provides a handy way to centralize the CEP search on these services. + +By default, BrazilCEP uses the API provided by the `ApiCEP `_ service. + +To use other services, we must indicate the desired service when calling the `get_address_from_cep` +function. + +Begin by importing the BrazilCEP `Webservice` class:: + + >>> from brazilcep import get_address_from_cep, WebService + +Now, call the `get_address_from_cep` method with `webservice` parameter:: + + >>> get_address_from_cep('37503-130', webservice=WebService.APICEP) + { + 'district': 'rua abc', + 'cep': '37503130', + 'city': 'city ABC', + 'street': 'str', + 'uf': 'str', + 'complement': 'str', + } + +The possible values for the `webservice` parameter are: + +* `Webservice.APICEP` +* `Webservice.VIACEP` +* `Webservice.OPENCEP` + +Errors and Exceptions +--------------------- + +BrazilCEP also supports a group of exceptions that can be used to +handle any errors that occur during the query process. + +If a invalid CEP request has be made, a :exc:`~brazilcep.exceptions.InvalidCEP` exception is +raised. + +If a CEP request not find CEP address, a :exc:`~brazilcep.exceptions.CEPNotFound` exception is raised. + +To a large number of CEP requests in short range of time, a :exc:`~brazilcep.exceptions.BlockedByFlood` exception is raised. + +All exceptions that BrazilCEP explicitly raises inherit from +:exc:`brazilcep.exceptions.BrazilCEPException`. + diff --git a/docs/static/logo.png b/docs/static/logo.png deleted file mode 100644 index 2cb3d92..0000000 Binary files a/docs/static/logo.png and /dev/null differ diff --git a/docs/static/logo.xcf b/docs/static/logo.xcf deleted file mode 100644 index 79e1382..0000000 Binary files a/docs/static/logo.xcf and /dev/null differ diff --git a/docs/tutorial.md b/docs/tutorial.md deleted file mode 100644 index d9b5d6d..0000000 --- a/docs/tutorial.md +++ /dev/null @@ -1,138 +0,0 @@ -# Tutorial - -First, make sure that **BrazilCEP** is [installed](/install) and updated. - -Let's get started with some simple examples. - -## Make a CEP request - -Making a request is very simple. Begin by importing the BrazilCEP module: - -```python ->>> import brazilcep -``` - -Now, call the `get_address_from_cep` to query any CEP: - -```python ->>> address = brazilcep.get_address_from_cep('37503-130') -``` - -Now, we have a *dict* object called ``address``. We can -get all the address information we need from this object: - -```python - >>> address -{ - 'district': 'rua abc', - 'cep': '37503130', - 'city': 'city ABC', - 'street': 'str', - 'uf': 'str', - 'complement': 'str', -} -``` - -The CEP always must be a string. - -## Timeout - -BrazilCEP also supports set a request timeout. Use the timeout option. The default timeout is 5 seconds: - -```python -from brazilcep import get_address_from_cep - -# set timeout to 10 seconds -get_address_from_cep('37503-130', timeout=10) - -``` - -## Proxy - -BrazilCEP also supports proxy setings following *requests* pattern. For more details, -please official *requests* doc [here](https://requests.readthedocs.io/en/latest/user/advanced/#proxies). - -```python -from brazilcep import get_address_from_cep - -proxies = { - 'https': "00.00.000.000", - 'http': '00.00.000.000', -} - -# set proxies -get_address_from_cep('37503-130', proxies=proxies) - -``` - -## Unsing differents API's - -!!! note - - BrazilCEP was developed to integrate on-demand queries into web pages. - Querying CEP in bulk through scripts or any other means is not recommended. - -!!! info - - BrazilCEP is not responsible for the functioning, availability and support of any of these query API's. All of them are provided by third parties, and - this library just provides a handy way to centralize the CEP search on these services. - -By default, BrazilCEP uses the API provided by the [ApiCEP](https://apicep.com) service. -To use other services, we must indicate the desired service when calling the `get_address_from_cep` -function. - -Begin by importing the BrazilCEP `Webservice` class: - -```python ->>> from brazilcep import get_address_from_cep, WebService -``` - -Now, call the `get_address_from_cep` method with `webservice` parameter. - -```python ->>> get_address_from_cep('37503-130', webservice=WebService.APICEP) -{ - 'district': 'rua abc', - 'cep': '37503130', - 'city': 'city ABC', - 'street': 'str', - 'uf': 'str', - 'complement': 'str', -} - -``` -The possible values for the `webservice` parameter are: - -* `Webservice.APICEP` -* `Webservice.VIACEP` -* `Webservice.OPENCEP` - -## Errors and Exceptions - -BrazilCEP also supports a group of exceptions that can be used to -handle any errors that occur during the query process. - -```python -from brazilcep import get_address_from_cep, exceptions - -try: - - get_address_from_cep('37503-130') - -# when provide CEP is invalid. Wrong size or with chars that dont be numbers. -except exceptions.InvalidCEP as eic: - print(eic) - -# CEP is fine but not exist ou not found in request API's database -except exceptions.CEPNotFound as ecnf: - print(ecnf) - -# many request exception -execept exceptions.BlockedByFlood as ebbf: - print(ebbf) - -# general exceptions -except exceptions.BrazilCEPException as e: - print(e) - -``` diff --git a/mkdocs.yml b/mkdocs.yml deleted file mode 100644 index f970563..0000000 --- a/mkdocs.yml +++ /dev/null @@ -1,39 +0,0 @@ -site_name: BrazilCEP - -repo_url: https://github.com/mstuttgart/brazilcep -repo_name: mstuttgart/brazilcep - -edit_uri: tree/main/docs - -theme: - name: material - palette: - scheme: default - primary: white - accent: yellow - logo: static/logo.png - favicon: static/logo.png - features: - - content.code.copy - -nav: - - Home: "index.md" - - "install.md" - - "tutorial.md" - - "migrate.md" - - "CONTRIBUTING.md" - - "CHANGELOG.md" - -plugins: - - search - -markdown_extensions: - - pymdownx.highlight: - anchor_linenums: true - line_spans: __span - pygments_lang_class: true - - pymdownx.inlinehilite - - pymdownx.snippets - - pymdownx.superfences - - admonition - - pymdownx.details diff --git a/pyproject.toml b/pyproject.toml index c119ce5..c3690bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,12 +4,12 @@ build-backend = "setuptools.build_meta" [project] name = "brazilcep" -version = "6.5.0" description = "Minimalist and easy-to-use python library designed to query CEP (brazilian zip codes) data" readme = "README.md" license = { file = "LICENSE" } authors = [{ name = "Michell Stuttgart", email = "michellstut@gmail.com" }] requires-python = ">=3.9" +dynamic = ["version"] classifiers = [ "Topic :: Software Development :: Build Tools", "Topic :: Software Development :: Libraries :: Python Modules", @@ -30,7 +30,7 @@ classifiers = [ "Natural Language :: Portuguese (Brazilian)", ] -dependencies = ["zeep>=4.2.1", "requests>=2.28.2"] +dependencies = ["requests>=2.28.2"] [project.optional-dependencies] @@ -47,34 +47,41 @@ dev = [ ] coverage = ["coveralls>=3.3.1", "pytest-cov>=4.0.0", "requests-mock>=1.10.0"] -docs = ["mkdocs-material>=9.1.6", "mkdocs>=1.4.2"] + +docs = [ + "Sphinx>=6,<8", + # "alabaster", + "readme-renderer==43", + "myst-parser>=1.0,<2.1", + "sphinx-copybutton==0.5.2", + "sphinx-autobuild==2021.3.14", + "sphinx-autodoc-typehints==1.23.3", +] + build = ["build==1.2.2.post1"] [project.urls] Documentation = "https://github.com/mstuttgart/brazilcep/tree/main#readme" -Source = "https://github.com/mstuttgart/brazilcep" +Repository = "https://github.com/mstuttgart/brazilcep" Tracker = "https://github.com/mstuttgart/brazilcep/issues" Changelog = "https://github.com/mstuttgart/brazilcep/blob/main/CHANGELOG.md" [tool.check-manifest] ignore = [ ".*", - "test/**", + "tests/**", "docs/**", "bin/**", "*.yml", - "noxfile.py", + ".tox.ini", ".pylintrc", ] [tool.setuptools] include-package-data = true -[tool.setuptools.package-data] -my_package = ["py.typed"] - [tool.setuptools.dynamic] -version = { attr = "my_package.version.VERSION" } +version = { attr = "brazilcep.__version__.__version__" } [tool.black] line-length = 100 @@ -97,6 +104,7 @@ exclude = ''' [tool.isort] profile = "black" multi_line_output = 3 +skip = ["docs"] # You can override these pyright settings by adding a personal pyrightconfig.json file. [tool.pyright] @@ -108,3 +116,7 @@ target-version = "py39" [tool.lint.per-file-ignores] "__init__.py" = ["F401"] + +[tool.coverage.run] +branch = true +omit = ["tests/*"] diff --git a/tox.ini b/tox.ini index 5e72f3b..580770c 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,6 @@ requires = tox>=4.2 env_list = - pre-commit python3.{13, 12, 11, 10, 9} skip_missing_interpreters = true @@ -11,11 +10,3 @@ deps = -e ".[dev]" commands = pytest - -[testenv:pre-commit] -base_python = python -deps = - pre-commit -commands = - pre-commit autoupdate - pre-commit run --all-files