Skip to main content

quantilica-core: Fundação de infraestrutura para projetos Quantilica

License: MIT Python

Biblioteca de utilitários domain-neutral que serve como base para todos os coletores e pipelines Quantilica. Centraliza rede resiliente, armazenamento atômico, proveniência de dados e logging estruturado — permitindo que cada pacote de domínio foque exclusivamente na lógica de sua fonte de dados.

Para a documentação completa, consulte https://docs.quantilica.com.

Instalação

O quantilica-core é publicado no PyPI:

uv add quantilica-core

Uso Rápido

from quantilica.core.http import HttpClient
from quantilica.core.storage import LocalStorage
from quantilica.core.manifests import DownloadManifest, write_manifest_sidecar

# Cliente HTTP com retry automático
client = HttpClient(attempts=3)
response = client.get("https://api.ibge.gov.br/...")

# Escrita atômica em disco
storage = LocalStorage("dados/raw")
stat = storage.write_bytes("sidra/tabela.csv", response.content)

# Registro de proveniência (SHA-256)
manifest = DownloadManifest.from_file(
    source_id="ibge",
    dataset_id="sidra-1234",
    url="https://...",
    file_path=stat.path,
    producer="ibge-sidra-fetcher",
)
write_manifest_sidecar(stat.path, manifest)  # grava <arquivo>.manifest.json ao lado

Módulos

Módulo Descrição
http HttpClient e AsyncHttpClient com backoff exponencial, jitter, retomada de download e política por host (HostPolicy)
ratelimit TokenBucket, CircuitBreaker (CircuitOpenError) e HostGuard para respeitar as fontes (o RateLimiter simples fica em http)
retry retry_call, with_retry e exponential_delay para falhas de rede e erros transientes
ftp FtpClient, MonitoredFTP e parse_ftp_list_line (listagens UNIX e IIS)
ckan, odata Clientes de portais CKAN e paginação OData
storage LocalStorage (escrita atômica por chave) e BaseDataRepository e StampedDataRepository (layout {dataset_id}/ e nomes com carimbo @AAAAMMDD)
files Escrita atômica, sha256, decompress_archive e extracted_archive
manifests DownloadManifest, ExecutionManifest, DatasetManifest, RunManifest e o sidecar <arquivo>.manifest.json
sync Sincronização incremental: FreshnessPolicy, sondas HTTP/FTP e should_skip
regeneration Detecção de arquivo regenerado pela fonte sem mudança de conteúdo
lake Contrato do Data Lake em Parquet: DatasetDescriptor, LakeConverter, materialize_view
registry Registro público de fetchers (FetcherInfo)
dates, config, cache utc_now/isoformat_utc, EnvSettings/load_dotenv e FileCache
logging Logging estruturado via get_logger e log_step
exceptions Hierarquia padrão: QuantilicaError, FetchError, ParseError, StorageError

Princípios de Design

  1. Neutralidade de domínio — o core nunca sabe o que é IBGE, DATASUS ou INMET.
  2. Leveza — dependências mínimas no núcleo; integrações pesadas são extras opcionais.
  3. Estabilidade — alta cobertura de testes em todos os componentes de infraestrutura.
  4. DX — APIs tipadas e tratamento de erros consistente em toda a organização.

Desenvolvimento

git clone https://github.com/Quantilica/quantilica-core.git
cd quantilica-core
uv sync --dev
uv run pytest

Licença

MIT — veja LICENSE.

Metadata

Release files for quantilica-core 0.28.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quantilica-core 0.28.1
File Size Uploaded Provenance Actions
quantilica_core-0.28.1.tar.gz 213.3 kB With provenance Details for quantilica_core-0.28.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for quantilica-core 0.28.1
File Interpreter ABI Platform Actions
quantilica_core-0.28.1-py3-none-any.whl Python 3 none any Details for quantilica_core-0.28.1-py3-none-any.whl

Total release size: 340.7 kB

Release files / quantilica_core-0.28.1.tar.gz

Download URL quantilica_core-0.28.1.tar.gz
Size 213.3 kB
Tags Source
SHA-256 checksum
How to use checksums
712162184e6e249e77cf44ea6f9863bf2bd9e11b1d3878abbe2f0510e992e64d
BLAKE2b-256 checksum
How to use checksums
bf6a5f7a37587789b0d4d7e639248b38bea680b4644038c8f6002e6799803cdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / quantilica_core-0.28.1-py3-none-any.whl

Download URL quantilica_core-0.28.1-py3-none-any.whl
Size 127.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03826fedc6707a3252dd6537aa0c32d3f67875d1a34fecff1361005a25f2164c
BLAKE2b-256 checksum
How to use checksums
4e3ae1d9bfe684592009af5493c398cfe6113974b5d50f9fd10c961f493bce39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Security for quantilica-core 0.28.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for quantilica_core-0.28.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.28.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page