Skip to content

Tags: wilsonfreitas/python-bcb

Tags

v0.3.6

Toggle v0.3.6's commit message
Release version 0.3.6 - Complete 8-Phase Architectural Refactoring

Comprehensive refactoring implementing 50 architectural/design improvements across 8 phases.
Full async support, enhanced documentation, and production-ready architecture.

- Created bcb/http.py with shared httpx.Client and AsyncClient
- Standardized 30s timeout across all modules
- Tenacity-based retry decorator for transient errors
- Fixed http:// → https:// in currency module

- Custom exception hierarchy: BCBError → BCBAPIError, CurrencyNotFoundError, SGSError, ODataError
- Added BCBRateLimitError (429) and BCBAPINotFoundError (404)
- Fail-fast implementation: raises immediately on invalid input
- Type-safe exception declarations with required status_code

- _ThreadSafeCache class with threading.RLock()
- Structured cache keys via CacheKey namedtuple
- OData metadata cache with URL keying
- Injectable cache interface for testing

- mypy --strict compliance (0 errors)
- CSV validation (8 columns exactly)
- Date validation with explicit errors
- SGSCode as frozen dataclass with classmethod constructors
- Format detection helpers for response validation

- URL construction with urllib.parse.urlencode
- Explicit kwargs on Endpoint.get()
- Consistent signatures across all modules
- Chainable query builders throughout

- sgs.async_get(), currency.async_get(), ODataQuery.async_collect()
- Concurrent operations via asyncio.gather()
- Shared _ASYNC_CLIENT singleton
- True non-blocking I/O with httpx.AsyncClient

- 103 unit tests (71% coverage)
- Factory functions for parameterizable mock data
- 36 new comprehensive test cases:
  • 12 currency negative tests (404/429/500/malformed CSV)
  • 15 SGS negative tests (invalid inputs/malformed JSON)
  • 9 async API tests with pytest-anyio
- Tests isolated via pytest-httpx mocking
- Separate tests/integration/ for live API tests

- Debug logging for all HTTP requests/responses
- Warning logging for retry attempts
- 4 comprehensive example scripts (Portuguese):
  • sgs_time_series.py - SGS time series
  • currency_exchange.py - Exchange rates
  • odata_query.py - OData filtering/sorting
  • async_usage.py - Concurrent operations
- Portuguese translation of README.md + examples
- docs/async.rst guide (43KB) with examples
- Global sidebar navigation in Furo theme
- Sphinx: 0 errors, 0 warnings

✅ 103 unit tests passing
✅ 71% code coverage
✅ ruff lint: all checks passed
✅ ruff format: 27 files formatted
✅ mypy: 0 type errors
✅ Sphinx docs: 0 errors, 0 warnings

A1: Shared global httpx.Client in bcb/http.py
A2: Fail-fast exception handling everywhere
A3: True async via httpx.AsyncClient + asyncio.gather()
A4: Format detection with descriptive BCBAPIError

- 0aaeb10 chore: Release version 0.3.6
- 3d8cba6 fix: Correct examples to work with API constraints
- 3277cf4 refactor: Remove unused import in async_usage.py
- 268495a docs: Add async API documentation with sidebar
- dc1583f docs: Translate README and examples to Portuguese

Version: 0.3.5 → 0.3.6 (2026-03-26)

Co-Authored-By: Claude Code <[email protected]>

v0.3.4

Toggle v0.3.4's commit message
Bump version to 0.3.4 and update README and CHANGELOG

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

0.3.3

Toggle 0.3.3's commit message
Update version to 0.3.3 and enhance changelog with new features and i…

…mprovements

0.2.0

Toggle 0.2.0's commit message
Updated version 0.2.0

0.1.4

Toggle 0.1.4's commit message
Implementing packing

- Replaced setup.py with setup.cfg
- created pyproject.toml
- updated changelog

0.1.3

Toggle 0.1.3's commit message
Updated CHANGELOG and setup.py for the release 0.1.2

0.1.2

Toggle 0.1.2's commit message
Updated CHANGELOG and setup.py for the release 0.1.2

0.1.1

Toggle 0.1.1's commit message
Created changelog