Versioning Policy (Semver)
agrobr follows Semantic Versioning 2.0.0 with per-dataset
granularity. Each dataset has its own schema_version (independent of the library version, agrobr_version in MetaInfo).
Rules
The library version also follows SemVer and bumps major when behavior changes
broadly, even when not every dataset contract changes. The guarantee covers the
public API; the rest of the package is internal and may change in any release.
| Change type |
Bump |
Example |
| Field removed or renamed |
Major |
Rename preco → price |
| Data type changed (narrowing) |
Major |
price: float64 → price: str |
| Required column becomes optional |
Major |
uf: required → uf: nullable |
| Primary key changes observation identity |
Major |
estimativa_safra 3.0 distinguishes source and LSPA month |
| New optional column added |
Minor |
Add latitude |
| Constraint added |
Minor |
Add price_min: 0 |
| New fallback source |
Patch |
Add ABIOVE as backup |
| Parsing fix (same columns) |
Patch |
Fix municipality encoding |
| Data type widened |
Patch |
int → float (compatible) |
| New data source (module) |
Minor |
agrobr.bcb |
Principle: a dataset's schema_version only bumps major when the change
can break downstream code that depends on the current schema.
Per-Dataset Guarantees
preco_diario
| Column |
Type |
Guarantee |
Since |
data |
date |
required |
v0.4.0 |
produto |
str |
required |
v0.4.0 |
praca |
str |
optional |
v0.4.0 |
valor |
float |
required, > 0 |
v0.4.0 |
unidade |
str |
required |
v0.4.0 |
fonte |
str |
required |
v0.6.0 |
estimativa_safra
Contract 3.0: key [fonte, safra, produto, uf, levantamento, ano_lspa, mes_lspa]. This change prevents collisions between LSPA months and requires updating stored keys, even though the previous ten columns remain. CONAB_SAFRA_V2 remains the source's 2.0 contract.
| Column |
Type |
Guarantee |
Since |
produto |
str |
required |
v0.4.0 |
safra |
str |
required, format YYYY/YY |
v0.4.0 |
uf |
str |
optional |
v0.4.0 |
area_plantada |
float |
optional, >= 0 |
v0.4.0 |
area_colhida |
float |
optional, >= 0 |
v0.4.0 |
produtividade |
float |
optional, >= 0 |
v0.4.0 |
producao |
float |
optional, >= 0 |
v0.4.0 |
levantamento |
int |
optional, 1-12; null when the source is LSPA |
v1.2.0 |
data_publicacao |
date |
optional; null when the source is LSPA |
v1.2.0 |
ano_lspa |
Int64 |
nullable; observed LSPA year, null for CONAB |
contract 3.0 |
mes_lspa |
Int64 |
nullable, 1–12; observed LSPA month, null for CONAB |
contract 3.0 |
fonte |
str |
required |
v0.6.0 |
producao_anual (IBGE PAM)
| Column |
Type |
Guarantee |
Since |
ano |
int |
required, >= 1974 |
v0.4.0 |
localidade |
str |
optional |
v0.4.0 |
produto |
str |
required |
v0.4.0 |
area_plantada |
float |
optional, >= 0 |
v0.4.0 |
area_colhida |
float |
optional, >= 0 |
v0.4.0 |
producao |
float |
optional, >= 0 |
v0.4.0 |
rendimento |
float |
optional, >= 0 |
v0.4.0 |
valor_producao |
float |
optional, >= 0 |
v0.4.0 |
fonte |
str |
required |
v0.6.0 |
Source Layer — Per-module Contracts
Source-layer modules (agrobr.cepea, agrobr.conab, etc.) return
DataFrames with documented columns, but with a weaker guarantee than the
datasets layer. The datasets layer normalizes and validates.
comexstat.exportacao (v1.1)
| Column |
Type |
Guarantee |
ano |
int |
required |
mes |
int |
required, 1-12 |
produto |
str |
required |
uf |
str |
optional |
kg_liquido |
float |
optional, >= 0 |
valor_fob_usd |
float |
optional, >= 0 |
volume_ton |
float |
optional, >= 0 |
bcb.credito_rural (v2.0)
| Column |
Type |
Guarantee |
safra |
str |
required |
produto |
str |
required |
uf |
str |
optional |
finalidade |
str |
required |
agregacao |
str |
required (uf or programa) |
programa |
str |
optional |
cd_programa |
str |
optional |
qtd_contratos |
int |
optional, >= 0 |
valor |
float |
optional, >= 0 |
area_financiada |
float |
optional, >= 0 |
fonte |
str |
required |
inmet.clima_uf (clima contract v3.1)
| Column |
Type |
Guarantee |
mes |
date |
required |
uf |
str |
required |
precip_acum_mm |
float |
optional, >= 0 |
temp_media |
float |
optional |
temp_max_media |
float |
optional |
temp_min_media |
float |
optional |
num_estacoes |
int |
optional, >= 0 |
umidade_media |
float |
optional, 0-100 |
radiacao_media_mj |
float |
optional, >= 0 |
vento_medio_ms |
float |
optional, >= 0 |
fonte |
str |
required |
anda.entregas (v2.0)
| Column |
Type |
Guarantee |
ano |
int |
required |
mes |
int |
required, 1-12 |
uf |
str |
optional |
produto_fertilizante |
str |
required |
volume_ton |
float |
optional, >= 0 |
All functions with return_meta=True return MetaInfo with provenance
fields. MetaInfo fields are additive (never removed), so they do not
constitute a breaking change.
Deprecation
Before removing a column or changing a type (breaking change):
- Column marked as
deprecated for at least 1 minor release
- Warning emitted via
DeprecationWarning at runtime
- Documented in the CHANGELOG
- Removed in the next major