diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fb2472e..1db0d81 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,7 @@ jobs: fail-fast: false matrix: - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] os: [ubuntu-latest] runs-on: ${{ matrix.os }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 161a786..ead20ce 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ exclude: "docs/" repos: # Pre-commit hooks for general code quality checks - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: check-yaml # Validate YAML files - id: debug-statements # Detect debug statements (e.g., print, pdb) @@ -17,31 +17,31 @@ repos: # Sort imports automatically - repo: https://github.com/PyCQA/isort - rev: 6.0.1 + rev: 5.12.0 hooks: - id: isort # Format Python code with Black - repo: https://github.com/psf/black - rev: 25.1.0 + rev: 23.12.1 hooks: - id: black # Lint Python code with Ruff - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.2 + rev: v0.15.0 hooks: - id: ruff # Format tox.ini files - repo: https://github.com/tox-dev/tox-ini-fmt - rev: "1.5.0" + rev: "1.7.1" hooks: - id: tox-ini-fmt # Upgrade Python syntax to modern versions - repo: https://github.com/asottile/pyupgrade - rev: v3.19.1 + rev: v3.21.2 hooks: - id: pyupgrade args: [--py39-plus] # Target Python 3.9+ syntax diff --git a/.readthedocs.yaml b/.readthedocs.yaml index ecc432f..af51632 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -10,7 +10,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.11" + python: "3.12" python: install: diff --git a/CHANGELOG b/CHANGELOG index ed904f4..11e5673 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,13 @@ Changelog ========= +7.2.0 (2026-02-08) + +- Add support to Python 3.14 +- Improce README and docs text + 7.0.1 (2025-03-16) +------------------ - Fixes #104 - Fixes #103 diff --git a/README.md b/README.md index 3bf83e3..9e8de9f 100644 --- a/README.md +++ b/README.md @@ -56,19 +56,18 @@ ## Features -✨ **Simple and Intuitive API** - Easy-to-use interface for CEP queries +- Easy-to-use interface for CEP queries +- Full support for asynchronous operations +- Support for **ViaCEP**, **ApiCEP**, and **OpenCEP** +- Minimal dependencies and optimized performance +- Full type annotation support for better IDE experience +- Configure timeout, proxies, and preferred web service +- Comprehensive test coverage -🚀 **Async/Await Support** - Full support for asynchronous operations - -🔄 **Multiple Web Services** - Support for ViaCEP, ApiCEP, and OpenCEP - -⚡ **Fast and Lightweight** - Minimal dependencies and optimized performance - -🛡️ **Type Hints** - Full type annotation support for better IDE experience +## About CEP -🔧 **Customizable** - Configure timeout, proxies, and preferred web service +**CEP** (Código de Endereçamento Postal) or **Postal Address Code** is the Brazilian postal code system created, maintained, and organized by Correios do Brasil (Brazilian Post Office). It consists of eight digits and helps streamline address organization and delivery of mail and packages across Brazil. -📦 **Well Tested** - Comprehensive test coverage ## Installation @@ -80,12 +79,6 @@ Install using [pip](https://pip.pypa.io/): pip install brazilcep ``` -Or using [poetry](https://python-poetry.org/): - -```bash -poetry add brazilcep -``` - ## Quick Start ### Synchronous Usage @@ -140,85 +133,6 @@ address = get_address_from_cep('37503-130', webservice=WebService.APICEP) address = get_address_from_cep('37503-130', webservice=WebService.OPENCEP) ``` -### Configuring Timeout - -Set a custom timeout for requests (default is 5 seconds): - -```python -# Set timeout to 10 seconds -address = get_address_from_cep('37503-130', timeout=10) -``` - -### Using Proxies - -Configure proxy settings for requests: - -```python -proxies = { - 'http': 'http://10.10.1.10:3128', - 'https': 'http://10.10.1.10:1080', -} - -address = get_address_from_cep('37503-130', proxies=proxies) -``` - -### Handling Exceptions - -```python -from brazilcep import get_address_from_cep, exceptions - -try: - address = get_address_from_cep('00000-000') -except exceptions.CEPNotFound: - print('CEP not found!') -except exceptions.InvalidCEP: - print('Invalid CEP format!') -except exceptions.ConnectionError: - print('Connection error!') -except exceptions.Timeout: - print('Request timeout!') -except exceptions.BrazilCEPException as e: - print(f'An error occurred: {e}') -``` - -### Complete Async Example - -```python -import asyncio -from brazilcep import async_get_address_from_cep, WebService, exceptions - -async def fetch_multiple_ceps(): - """Fetch multiple CEPs concurrently.""" - ceps = ['37503-130', '01310-100', '20040-020'] - - tasks = [ - async_get_address_from_cep(cep, webservice=WebService.OPENCEP) - for cep in ceps - ] - - try: - addresses = await asyncio.gather(*tasks) - for cep, address in zip(ceps, addresses): - print(f"\nCEP {cep}:") - print(f" Street: {address['street']}") - print(f" City: {address['city']}/{address['uf']}") - except exceptions.BrazilCEPException as e: - print(f"Error fetching addresses: {e}") - -asyncio.run(fetch_multiple_ceps()) -``` - -## Supported Web Services - -| Service | Website | Status | Rate Limit | -|---------|---------|--------|------------| -| [OpenCEP](https://opencep.com) | https://opencep.com | ✅ Active | Yes | -| [ViaCEP](https://viacep.com.br) | https://viacep.com.br | ✅ Active | Yes | -| [ApiCEP](https://apicep.com) | https://apicep.com | ✅ Active | Yes | - -> [!IMPORTANT] -> BrazilCEP does not guarantee the availability or support of any third-party query APIs. This library serves as a convenient interface for accessing these services. Please check each service's terms of use and rate limits. - ## Response Format All queries return a dictionary with the following structure: @@ -232,7 +146,18 @@ All queries return a dictionary with the following structure: 'uf': str, # State abbreviation (e.g., 'MG') 'complement': str # Additional information (may be empty) } + ``` +## Supported Web Services + +| Service | Website | Status | Rate Limit | +| ------------------------------- | --------------------- | -------- | ---------- | +| [OpenCEP](https://opencep.com) | https://opencep.com | ✅ Active | Yes | +| [ViaCEP](https://viacep.com.br) | https://viacep.com.br | ✅ Active | Yes | +| [ApiCEP](https://apicep.com) | https://apicep.com | ✅ Active | Yes | + +> [!IMPORTANT] +> BrazilCEP does not guarantee the availability or support of any third-party query APIs. This library serves as a convenient interface for accessing these services. Please check each service's terms of use and rate limits. ## Documentation @@ -258,62 +183,8 @@ Contributions are welcome! Here's how you can help: Please read our [Contributing Guide](https://brazilcep.readthedocs.io/contributing.html) before submitting a pull request. -### Development Setup - -```bash -# Clone the repository -git clone https://github.com/mstuttgart/brazilcep.git -cd brazilcep - -# Install dependencies -make setup - -# Run tests -make test - -# Run linting -make lint - -# Run all checks -make check -``` - -## About CEP - -**CEP** (Código de Endereçamento Postal) or **Postal Address Code** is the Brazilian postal code system created, maintained, and organized by Correios do Brasil (Brazilian Post Office). It consists of eight digits and helps streamline address organization and delivery of mail and packages across Brazil. - -## Migration from PyCEPCorreios - -BrazilCEP is the successor to PyCEPCorreios. To migrate your code: - -**Old (PyCEPCorreios):** -```python -from pycepcorreios import get_address_from_cep -``` - -**New (BrazilCEP):** -```python -from brazilcep import get_address_from_cep -``` - -For detailed migration instructions, see the [migration guide](https://brazilcep.readthedocs.io/api.html#migrate-from-pycepcorreios). - ## License BrazilCEP is released under the [MIT License](https://github.com/mstuttgart/brazilcep/blob/main/LICENSE). -## Credits - Created and maintained by [Michell Stuttgart](https://github.com/mstuttgart). - -## Support - -- 📧 Issues: [GitHub Issues](https://github.com/mstuttgart/brazilcep/issues) -- 💬 Discussions: [GitHub Discussions](https://github.com/mstuttgart/brazilcep/discussions) -- 📖 Documentation: [ReadTheDocs](https://brazilcep.readthedocs.io/) - ---- - -
- Made with ❤️ in Brazil -
diff --git a/brazilcep/__version__.py b/brazilcep/__version__.py index fb16410..e698104 100644 --- a/brazilcep/__version__.py +++ b/brazilcep/__version__.py @@ -1 +1 @@ -__version__ = "7.0.1" +__version__ = "7.2.0" diff --git a/pyproject.toml b/pyproject.toml index 2fa2516..781da3f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Topic :: Software Development :: Build Tools", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules", diff --git a/tox.ini b/tox.ini index c377206..7cd3cb6 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ requires = env_list = lint type - py3{13, 12, 11, 10, 9} + py3{14, 13, 12, 11, 10, 9} skip_missing_interpreters = true [testenv]