python-bcb 0.3.6__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. {python_bcb-0.3.6 → python_bcb-0.4.0}/.claude/settings.local.json +9 -1
  2. python_bcb-0.4.0/.github/workflows/dependency-audit.yml +31 -0
  3. python_bcb-0.4.0/.github/workflows/integration.yml +29 -0
  4. {python_bcb-0.3.6 → python_bcb-0.4.0}/.github/workflows/lint.yml +1 -1
  5. {python_bcb-0.3.6 → python_bcb-0.4.0}/.github/workflows/sphinx.yml +1 -1
  6. {python_bcb-0.3.6 → python_bcb-0.4.0}/.github/workflows/test.yml +1 -1
  7. {python_bcb-0.3.6 → python_bcb-0.4.0}/.gitignore +7 -1
  8. {python_bcb-0.3.6 → python_bcb-0.4.0}/CHANGELOG.md +17 -0
  9. {python_bcb-0.3.6 → python_bcb-0.4.0}/PKG-INFO +45 -11
  10. {python_bcb-0.3.6 → python_bcb-0.4.0}/README.md +44 -10
  11. {python_bcb-0.3.6 → python_bcb-0.4.0}/bcb/currency.py +368 -210
  12. python_bcb-0.4.0/bcb/http.py +184 -0
  13. {python_bcb-0.3.6 → python_bcb-0.4.0}/bcb/odata/api.py +116 -31
  14. {python_bcb-0.3.6 → python_bcb-0.4.0}/bcb/odata/framework.py +304 -68
  15. {python_bcb-0.3.6 → python_bcb-0.4.0}/bcb/sgs/__init__.py +197 -73
  16. {python_bcb-0.3.6 → python_bcb-0.4.0}/bcb/sgs/regional_economy.py +68 -44
  17. {python_bcb-0.3.6 → python_bcb-0.4.0}/docs/async.rst +29 -10
  18. {python_bcb-0.3.6 → python_bcb-0.4.0}/docs/currency.rst +43 -9
  19. {python_bcb-0.3.6 → python_bcb-0.4.0}/docs/expectativas.rst +9 -6
  20. {python_bcb-0.3.6 → python_bcb-0.4.0}/docs/odata.rst +62 -22
  21. python_bcb-0.4.0/docs/project-health-hardening.md +134 -0
  22. {python_bcb-0.3.6 → python_bcb-0.4.0}/docs/sgs.rst +43 -2
  23. {python_bcb-0.3.6 → python_bcb-0.4.0}/docs/taxajuros.rst +4 -3
  24. {python_bcb-0.3.6 → python_bcb-0.4.0}/examples/async_usage.py +11 -5
  25. {python_bcb-0.3.6 → python_bcb-0.4.0}/examples/currency_exchange.py +3 -4
  26. {python_bcb-0.3.6 → python_bcb-0.4.0}/examples/sgs_time_series.py +3 -2
  27. {python_bcb-0.3.6 → python_bcb-0.4.0}/pyproject.toml +3 -3
  28. {python_bcb-0.3.6 → python_bcb-0.4.0}/tests/conftest.py +1 -1
  29. {python_bcb-0.3.6 → python_bcb-0.4.0}/tests/integration/test_currency.py +2 -2
  30. {python_bcb-0.3.6 → python_bcb-0.4.0}/tests/sgs/test_regional_economy.py +15 -0
  31. {python_bcb-0.3.6 → python_bcb-0.4.0}/tests/sgs/test_series.py +52 -3
  32. python_bcb-0.4.0/tests/test_async.py +461 -0
  33. {python_bcb-0.3.6 → python_bcb-0.4.0}/tests/test_currency.py +77 -5
  34. {python_bcb-0.3.6 → python_bcb-0.4.0}/tests/test_currency_negative.py +147 -3
  35. python_bcb-0.4.0/tests/test_http.py +198 -0
  36. python_bcb-0.4.0/tests/test_odata.py +926 -0
  37. python_bcb-0.4.0/tests/test_request_timeout.py +192 -0
  38. {python_bcb-0.3.6 → python_bcb-0.4.0}/tests/test_sgs_negative.py +83 -2
  39. {python_bcb-0.3.6 → python_bcb-0.4.0}/uv.lock +250 -258
  40. python_bcb-0.3.6/bcb/http.py +0 -98
  41. python_bcb-0.3.6/env.local +0 -1
  42. python_bcb-0.3.6/tests/test_async.py +0 -220
  43. python_bcb-0.3.6/tests/test_odata.py +0 -275
  44. {python_bcb-0.3.6 → python_bcb-0.4.0}/.claude/plans/dynamic-bubbling-glade.md +0 -0
  45. {python_bcb-0.3.6 → python_bcb-0.4.0}/.claude/plans/phase2-review.md +0 -0
  46. {python_bcb-0.3.6 → python_bcb-0.4.0}/.claude/plans/phase4-review.md +0 -0
  47. {python_bcb-0.3.6 → python_bcb-0.4.0}/.claude/plans/recursive-sniffing-snowflake.md +0 -0
  48. {python_bcb-0.3.6 → python_bcb-0.4.0}/.claude/plans/text-output.md +0 -0
  49. {python_bcb-0.3.6 → python_bcb-0.4.0}/.claude/settings.json +0 -0
  50. {python_bcb-0.3.6 → python_bcb-0.4.0}/.python-version +0 -0
  51. {python_bcb-0.3.6 → python_bcb-0.4.0}/CLAUDE.md +0 -0
  52. {python_bcb-0.3.6 → python_bcb-0.4.0}/LICENSE +0 -0
  53. {python_bcb-0.3.6 → python_bcb-0.4.0}/QUESTIONS.md +0 -0
  54. {python_bcb-0.3.6 → python_bcb-0.4.0}/bcb/__init__.py +0 -0
  55. {python_bcb-0.3.6 → python_bcb-0.4.0}/bcb/exceptions.py +0 -0
  56. {python_bcb-0.3.6 → python_bcb-0.4.0}/bcb/odata/__init__.py +0 -0
  57. {python_bcb-0.3.6 → python_bcb-0.4.0}/bcb/utils.py +0 -0
  58. {python_bcb-0.3.6 → python_bcb-0.4.0}/docs/.claude/settings.local.json +0 -0
  59. {python_bcb-0.3.6 → python_bcb-0.4.0}/docs/Makefile +0 -0
  60. {python_bcb-0.3.6 → python_bcb-0.4.0}/docs/_static/images/ipca12m-acumulado.png +0 -0
  61. {python_bcb-0.3.6 → python_bcb-0.4.0}/docs/_static/images/savefig/currency1.png +0 -0
  62. {python_bcb-0.3.6 → python_bcb-0.4.0}/docs/_static/images/savefig/sgs1.png +0 -0
  63. {python_bcb-0.3.6 → python_bcb-0.4.0}/docs/_static/images/savefig/taxajuros1.png +0 -0
  64. {python_bcb-0.3.6 → python_bcb-0.4.0}/docs/_static/images/selic.png +0 -0
  65. {python_bcb-0.3.6 → python_bcb-0.4.0}/docs/api.rst +0 -0
  66. {python_bcb-0.3.6 → python_bcb-0.4.0}/docs/conf.py +0 -0
  67. {python_bcb-0.3.6 → python_bcb-0.4.0}/docs/index.rst +0 -0
  68. {python_bcb-0.3.6 → python_bcb-0.4.0}/docs/make.bat +0 -0
  69. {python_bcb-0.3.6 → python_bcb-0.4.0}/examples/odata_query.py +0 -0
  70. {python_bcb-0.3.6 → python_bcb-0.4.0}/notebooks/SGS Economia Regional - Inadimpl/303/252ncia.ipynb" +0 -0
  71. {python_bcb-0.3.6 → python_bcb-0.4.0}/notebooks/bcb_Expectativas_da_SELIC_(nova_API).ipynb +0 -0
  72. {python_bcb-0.3.6 → python_bcb-0.4.0}/notebooks/currency PTAX.ipynb +0 -0
  73. {python_bcb-0.3.6 → python_bcb-0.4.0}/notebooks/currency get EUR parity.ipynb +0 -0
  74. {python_bcb-0.3.6 → python_bcb-0.4.0}/notebooks/currency get strong currencies.ipynb +0 -0
  75. {python_bcb-0.3.6 → python_bcb-0.4.0}/notebooks/currency get with side.ipynb +0 -0
  76. {python_bcb-0.3.6 → python_bcb-0.4.0}/notebooks/currency get.ipynb +0 -0
  77. {python_bcb-0.3.6 → python_bcb-0.4.0}/notebooks/dinheiro em circula/303/247/303/243o.ipynb" +0 -0
  78. {python_bcb-0.3.6 → python_bcb-0.4.0}/notebooks/expectativas IPCA anual.ipynb +0 -0
  79. {python_bcb-0.3.6 → python_bcb-0.4.0}/notebooks/odata ODataAPI.ipynb +0 -0
  80. {python_bcb-0.3.6 → python_bcb-0.4.0}/notebooks/odata examples.ipynb +0 -0
  81. {python_bcb-0.3.6 → python_bcb-0.4.0}/notebooks/odata taxas de juros cheque especial.ipynb +0 -0
  82. {python_bcb-0.3.6 → python_bcb-0.4.0}/notebooks/pix.odata +0 -0
  83. {python_bcb-0.3.6 → python_bcb-0.4.0}/notebooks/sgs get series with join.ipynb +0 -0
  84. {python_bcb-0.3.6 → python_bcb-0.4.0}/notebooks/sgs get series with period index.ipynb +0 -0
  85. {python_bcb-0.3.6 → python_bcb-0.4.0}/notebooks/sgs get series.ipynb +0 -0
  86. {python_bcb-0.3.6 → python_bcb-0.4.0}/notebooks/workspace.ipynb +0 -0
  87. {python_bcb-0.3.6 → python_bcb-0.4.0}/tests/__init__.py +0 -0
  88. {python_bcb-0.3.6 → python_bcb-0.4.0}/tests/integration/__init__.py +0 -0
  89. {python_bcb-0.3.6 → python_bcb-0.4.0}/tests/integration/test_expectativas.py +0 -0
  90. {python_bcb-0.3.6 → python_bcb-0.4.0}/tests/integration/test_sgs.py +0 -0
  91. {python_bcb-0.3.6 → python_bcb-0.4.0}/tests/sgs/__init__.py +0 -0
  92. {python_bcb-0.3.6 → python_bcb-0.4.0}/tests/test_exceptions.py +0 -0
  93. {python_bcb-0.3.6 → python_bcb-0.4.0}/tests/test_expectativas.py +0 -0
  94. {python_bcb-0.3.6 → python_bcb-0.4.0}/tests/test_utils.py +0 -0
@@ -40,7 +40,15 @@
40
40
  "mcp__github__add_issue_comment",
41
41
  "Bash(git add:*)",
42
42
  "Bash(git commit:*)",
43
- "Bash(uv sync:*)"
43
+ "Bash(uv sync:*)",
44
+ "Bash(wc -l /home/wilson/dev/python/python-bcb/bcb/**/*.py /home/wilson/dev/python/python-bcb/bcb/*.py)",
45
+ "Bash(xargs ls:*)",
46
+ "Bash(grep -n except.*Exception /home/wilson/dev/python/python-bcb/bcb/**/*.py /home/wilson/dev/python/python-bcb/bcb/*.py)",
47
+ "Bash(grep -n 'type: ignore' /home/wilson/dev/python/python-bcb/bcb/**/*.py /home/wilson/dev/python/python-bcb/bcb/*.py)",
48
+ "Bash(grep -n pass /home/wilson/dev/python/python-bcb/bcb/**/*.py /home/wilson/dev/python/python-bcb/bcb/*.py)",
49
+ "Bash(grep:*)",
50
+ "mcp__github__issue_write",
51
+ "mcp__github__get_me"
44
52
  ]
45
53
  }
46
54
  }
@@ -0,0 +1,31 @@
1
+ name: Dependency Audit
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ schedule:
6
+ - cron: "0 10 * * 1"
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ audit:
13
+ runs-on: ubuntu-latest
14
+ timeout-minutes: 20
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@v5
21
+
22
+ - name: Set up Python 3.12
23
+ run: uv python install 3.12
24
+
25
+ - name: Export locked dependencies
26
+ run: >-
27
+ uv export --frozen --format requirements-txt --all-groups
28
+ --no-emit-project --no-hashes -o requirements-audit.txt
29
+
30
+ - name: Run dependency audit
31
+ run: uvx pip-audit --requirement requirements-audit.txt
@@ -0,0 +1,29 @@
1
+ name: Integration Tests
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ schedule:
6
+ - cron: "0 9 * * 1"
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ integration:
13
+ runs-on: ubuntu-latest
14
+ timeout-minutes: 30
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@v5
21
+
22
+ - name: Set up Python 3.12
23
+ run: uv python install 3.12
24
+
25
+ - name: Install dependencies
26
+ run: uv sync --frozen --group test
27
+
28
+ - name: Run integration tests
29
+ run: uv run pytest -m integration
@@ -16,7 +16,7 @@ jobs:
16
16
  run: uv python install 3.10
17
17
 
18
18
  - name: Install dependencies
19
- run: uv sync --group dev
19
+ run: uv sync --frozen --group dev
20
20
 
21
21
  - name: Check formatting
22
22
  run: uv run ruff format --check bcb/ tests/
@@ -20,7 +20,7 @@ jobs:
20
20
  run: uv python install 3.10
21
21
 
22
22
  - name: Install dependencies
23
- run: uv sync --group docs
23
+ run: uv sync --frozen --group docs
24
24
 
25
25
  - name: Build docs
26
26
  run: |
@@ -19,7 +19,7 @@ jobs:
19
19
  run: uv python install ${{ matrix.python-version }}
20
20
 
21
21
  - name: Install dependencies
22
- run: uv sync --group test --group dev
22
+ run: uv sync --frozen --group test --group dev
23
23
 
24
24
  - name: Run tests
25
25
  run: uv run pytest --cov=bcb --cov-report=xml -m "not integration"
@@ -12,4 +12,10 @@ coverage.xml
12
12
  build
13
13
  dist
14
14
  *checkpoint.ipynb
15
- docs/_build/
15
+ docs/_build/
16
+
17
+ # Environment files with secrets
18
+ .env
19
+ .env.local
20
+ env.local
21
+ *.env.local
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.0] - 2026-06-15
4
+
5
+ ### Added
6
+ - Added `tidy=True` to `sgs.get()`, `sgs.async_get()`, `currency.get()`, and `currency.async_get()` for long-form DataFrame output. SGS tidy output uses `Date`, `series`, and `value`; currency tidy output uses `Date`, `symbol`, `side`, and `value`. The default wide DataFrame output and `output="text"` behavior are unchanged.
7
+ - Added per-call `timeout` support across SGS, currency, and OData APIs, including sync and async paths, so slow calls can override the shared HTTP client timeout without changing global defaults.
8
+ - Added explicit OR composition for OData filters with the `|` operator, including nested combinations with `&`.
9
+ - Added retry handling for transient SGS request failures.
10
+
11
+ ### Changed
12
+ - Improved OData `describe()` output: detailed endpoint information is now shown by default, while `describe(full=False)` keeps the compact endpoint summary.
13
+ - PTAX date parameters now accept ISO date strings, `datetime.date`, `datetime.datetime`, and `pandas.Timestamp`; generalized inputs are converted to the PTAX service format `M/D/YYYY`.
14
+ - Strengthened public API validation, OData literal serialization, HTTP error mapping, currency response parsing, and async currency missing-symbol behavior.
15
+
16
+ ### Fixed
17
+ - Fixed documentation drift around async client shutdown, timeout usage, raw text output, PTAX date parameters, and tidy DataFrame schemas.
18
+ - Fixed brittle currency integration expectations for missing symbols.
19
+
3
20
  ## [0.3.6] - 2026-03-26
4
21
 
5
22
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-bcb
3
- Version: 0.3.6
3
+ Version: 0.4.0
4
4
  Author-email: wilsonfreitas <wilson.freitas@gmail.com>
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.10
@@ -52,7 +52,7 @@ Implementado no módulo `currency`, realiza webscraping no site do [Conversor de
52
52
  ### OData - APIs Estruturadas
53
53
 
54
54
  O Banco Central disponibiliza diversas informações em APIs que seguem o padrão [OData](https://odata.org). Inclui:
55
- - **PTAX**: Boletins diários de taxas de câmbio com dados institucionalmentedetalhados
55
+ - **PTAX**: Boletins diários de taxas de câmbio com dados institucionalmente detalhados
56
56
  - **Expectativas**: Expectativas de mercado coletadas do Boletim FOCUS
57
57
  - **TaxaJuros**: Diversas taxas de juros (Selic, CDI, Cheque especial, etc.)
58
58
  - **MercadoImobiliario**: Dados de financiamento imobiliário
@@ -72,7 +72,7 @@ Use esta tabela para escolher o módulo certo para seu caso de uso:
72
72
  | Dados de financiamento imobiliário | `bcb.odata` (MercadoImobiliario) | Originações, taxas médias, volumes |
73
73
  | Informações de instituições financeiras | `bcb.odata` (IFDATA) | Dados de balanço, informações regulatórias |
74
74
  | Análise de dados avançada com filtros | `bcb.odata` (qualquer serviço) | API encadeável, filtragem tipo SQL, ordenação, seleção |
75
- | Busca concorrente de dados | Qualquer módulo com `async_get()` | Requisições não-bloqueantes, melhor performance para operações em massa |
75
+ | Busca concorrente de dados | APIs assíncronas (`sgs`, `currency` e OData) | Requisições não-bloqueantes com `async_get()`, `Endpoint.async_get()` e `ODataQuery.async_collect()` |
76
76
 
77
77
  ## Início Rápido
78
78
 
@@ -118,20 +118,46 @@ df = endpoint.query().filter(endpoint.Indicador == "IPCA").limit(100).collect()
118
118
  - Serviços OData: Varia; consulte documentação BCB para endpoints específicos
119
119
 
120
120
  ### P: Posso buscar dados de forma assíncrona?
121
- **R:** Sim! Todos os módulos têm métodos `async_get()` ou similares. Use-os para requisições concorrentes:
121
+ **R:** Sim. SGS e currency oferecem `async_get()`, e os endpoints OData oferecem `async_get()` e `async_collect()`. Feche o cliente assíncrono ao final de aplicações de longa duração:
122
122
  ```python
123
123
  import asyncio
124
- from bcb import sgs
124
+ from bcb import http, sgs
125
125
 
126
126
  async def main():
127
- results = await asyncio.gather(
128
- sgs.async_get(1), # SELIC
129
- sgs.async_get(433), # IPCA
130
- )
127
+ try:
128
+ results = await asyncio.gather(
129
+ sgs.async_get(1), # SELIC
130
+ sgs.async_get(433), # IPCA
131
+ )
132
+ return results
133
+ finally:
134
+ await http.aclose_async_client()
131
135
 
132
136
  asyncio.run(main())
133
137
  ```
134
138
 
139
+ ### P: Como aumento o timeout de uma consulta lenta?
140
+ **R:** Passe ``timeout`` na própria chamada. O valor é local daquela chamada e
141
+ não altera o cliente HTTP compartilhado globalmente:
142
+
143
+ ```python
144
+ from bcb import sgs, currency, Expectativas
145
+
146
+ # SGS
147
+ selic = sgs.get(11, start="1990-01-01", timeout=120)
148
+
149
+ # Currency
150
+ usd = currency.get("USD", start="1980-01-01", end="2026-01-01", timeout=120)
151
+
152
+ # OData
153
+ em = Expectativas(timeout=120)
154
+ ep = em.get_endpoint("ExpectativasMercadoAnuais")
155
+ df = ep.query().limit(1000).collect(timeout=120)
156
+ ```
157
+
158
+ O padrão continua sendo 30 segundos. No SGS, o timeout vale por tentativa HTTP;
159
+ quando houver retry, cada tentativa usa o mesmo valor.
160
+
135
161
  ### P: Como trato erros e dados faltantes?
136
162
  **R:** A biblioteca lança exceções específicas:
137
163
  - `CurrencyNotFoundError`: Símbolo de moeda não encontrado
@@ -174,7 +200,7 @@ logger.setLevel(logging.DEBUG)
174
200
  - Limites de requisições: APIs BCB podem ter limites; implemente backoff se necessário
175
201
  - Cache: Cache de moedas persiste em memória; limpe se atualizações de dados importarem
176
202
  - Pool de conexões: Usa httpx com connection pooling por padrão
177
- - API Assíncrona: Use métodos async para comportamento verdadeiramente não-bloqueante
203
+ - API Assíncrona: use métodos async para comportamento verdadeiramente não-bloqueante e chame `await bcb.http.aclose_async_client()` no encerramento de aplicações assíncronas longas
178
204
 
179
205
  ### P: Como contribuo ou reporto problemas?
180
206
  **R:** Visite o [repositório GitHub](https://github.com/wilsonfreitas/python-bcb) para:
@@ -183,9 +209,17 @@ logger.setLevel(logging.DEBUG)
183
209
  - Enviar pull requests
184
210
  - Ver documentação
185
211
 
212
+ ### P: Como gero a documentação localmente?
213
+ **R:** As dependências de documentação ficam no grupo `docs` do `uv`:
214
+ ```shell
215
+ uv run --group docs sphinx-build -b html docs docs/_build/html
216
+ ```
217
+
218
+ A saída HTML é gerada em `docs/_build/html`. Edite os arquivos fonte em `docs/`; não edite os arquivos gerados em `docs/_build`.
219
+
186
220
  ### P: Onde encontro documentação mais detalhada?
187
221
  **R:**
188
- - [Documentação de API](https://bcb-python.readthedocs.io/)
222
+ - [Documentação de API](https://wilsonfreitas.github.io/python-bcb/)
189
223
  - [Diretório de Exemplos](./examples/)
190
224
  - Docstrings inline: `help(bcb.sgs.get)`, `help(bcb.currency.get)`, etc.
191
225
  - [Portal de Dados Abertos BCB](https://dadosabertos.bcb.gov.br/)
@@ -40,7 +40,7 @@ Implementado no módulo `currency`, realiza webscraping no site do [Conversor de
40
40
  ### OData - APIs Estruturadas
41
41
 
42
42
  O Banco Central disponibiliza diversas informações em APIs que seguem o padrão [OData](https://odata.org). Inclui:
43
- - **PTAX**: Boletins diários de taxas de câmbio com dados institucionalmentedetalhados
43
+ - **PTAX**: Boletins diários de taxas de câmbio com dados institucionalmente detalhados
44
44
  - **Expectativas**: Expectativas de mercado coletadas do Boletim FOCUS
45
45
  - **TaxaJuros**: Diversas taxas de juros (Selic, CDI, Cheque especial, etc.)
46
46
  - **MercadoImobiliario**: Dados de financiamento imobiliário
@@ -60,7 +60,7 @@ Use esta tabela para escolher o módulo certo para seu caso de uso:
60
60
  | Dados de financiamento imobiliário | `bcb.odata` (MercadoImobiliario) | Originações, taxas médias, volumes |
61
61
  | Informações de instituições financeiras | `bcb.odata` (IFDATA) | Dados de balanço, informações regulatórias |
62
62
  | Análise de dados avançada com filtros | `bcb.odata` (qualquer serviço) | API encadeável, filtragem tipo SQL, ordenação, seleção |
63
- | Busca concorrente de dados | Qualquer módulo com `async_get()` | Requisições não-bloqueantes, melhor performance para operações em massa |
63
+ | Busca concorrente de dados | APIs assíncronas (`sgs`, `currency` e OData) | Requisições não-bloqueantes com `async_get()`, `Endpoint.async_get()` e `ODataQuery.async_collect()` |
64
64
 
65
65
  ## Início Rápido
66
66
 
@@ -106,20 +106,46 @@ df = endpoint.query().filter(endpoint.Indicador == "IPCA").limit(100).collect()
106
106
  - Serviços OData: Varia; consulte documentação BCB para endpoints específicos
107
107
 
108
108
  ### P: Posso buscar dados de forma assíncrona?
109
- **R:** Sim! Todos os módulos têm métodos `async_get()` ou similares. Use-os para requisições concorrentes:
109
+ **R:** Sim. SGS e currency oferecem `async_get()`, e os endpoints OData oferecem `async_get()` e `async_collect()`. Feche o cliente assíncrono ao final de aplicações de longa duração:
110
110
  ```python
111
111
  import asyncio
112
- from bcb import sgs
112
+ from bcb import http, sgs
113
113
 
114
114
  async def main():
115
- results = await asyncio.gather(
116
- sgs.async_get(1), # SELIC
117
- sgs.async_get(433), # IPCA
118
- )
115
+ try:
116
+ results = await asyncio.gather(
117
+ sgs.async_get(1), # SELIC
118
+ sgs.async_get(433), # IPCA
119
+ )
120
+ return results
121
+ finally:
122
+ await http.aclose_async_client()
119
123
 
120
124
  asyncio.run(main())
121
125
  ```
122
126
 
127
+ ### P: Como aumento o timeout de uma consulta lenta?
128
+ **R:** Passe ``timeout`` na própria chamada. O valor é local daquela chamada e
129
+ não altera o cliente HTTP compartilhado globalmente:
130
+
131
+ ```python
132
+ from bcb import sgs, currency, Expectativas
133
+
134
+ # SGS
135
+ selic = sgs.get(11, start="1990-01-01", timeout=120)
136
+
137
+ # Currency
138
+ usd = currency.get("USD", start="1980-01-01", end="2026-01-01", timeout=120)
139
+
140
+ # OData
141
+ em = Expectativas(timeout=120)
142
+ ep = em.get_endpoint("ExpectativasMercadoAnuais")
143
+ df = ep.query().limit(1000).collect(timeout=120)
144
+ ```
145
+
146
+ O padrão continua sendo 30 segundos. No SGS, o timeout vale por tentativa HTTP;
147
+ quando houver retry, cada tentativa usa o mesmo valor.
148
+
123
149
  ### P: Como trato erros e dados faltantes?
124
150
  **R:** A biblioteca lança exceções específicas:
125
151
  - `CurrencyNotFoundError`: Símbolo de moeda não encontrado
@@ -162,7 +188,7 @@ logger.setLevel(logging.DEBUG)
162
188
  - Limites de requisições: APIs BCB podem ter limites; implemente backoff se necessário
163
189
  - Cache: Cache de moedas persiste em memória; limpe se atualizações de dados importarem
164
190
  - Pool de conexões: Usa httpx com connection pooling por padrão
165
- - API Assíncrona: Use métodos async para comportamento verdadeiramente não-bloqueante
191
+ - API Assíncrona: use métodos async para comportamento verdadeiramente não-bloqueante e chame `await bcb.http.aclose_async_client()` no encerramento de aplicações assíncronas longas
166
192
 
167
193
  ### P: Como contribuo ou reporto problemas?
168
194
  **R:** Visite o [repositório GitHub](https://github.com/wilsonfreitas/python-bcb) para:
@@ -171,9 +197,17 @@ logger.setLevel(logging.DEBUG)
171
197
  - Enviar pull requests
172
198
  - Ver documentação
173
199
 
200
+ ### P: Como gero a documentação localmente?
201
+ **R:** As dependências de documentação ficam no grupo `docs` do `uv`:
202
+ ```shell
203
+ uv run --group docs sphinx-build -b html docs docs/_build/html
204
+ ```
205
+
206
+ A saída HTML é gerada em `docs/_build/html`. Edite os arquivos fonte em `docs/`; não edite os arquivos gerados em `docs/_build`.
207
+
174
208
  ### P: Onde encontro documentação mais detalhada?
175
209
  **R:**
176
- - [Documentação de API](https://bcb-python.readthedocs.io/)
210
+ - [Documentação de API](https://wilsonfreitas.github.io/python-bcb/)
177
211
  - [Diretório de Exemplos](./examples/)
178
212
  - Docstrings inline: `help(bcb.sgs.get)`, `help(bcb.currency.get)`, etc.
179
213
  - [Portal de Dados Abertos BCB](https://dadosabertos.bcb.gov.br/)