Skip to main content

layouts-cvm

CVM emblem

Project Status: Active Python Version PyPI Version Snyk Vulnerabilities Snyk License PyPI Downloads PyPI Docs Linting Mypy Test Coverage License Open Issues Contributions Welcome

Overview

Build, validate and serialise the files a fund sends to CVM, in CVM's own file layouts.

Source of truth. Field names, decimal scales and cardinalities come from the official CVM catalog of XML standards, not from this documentation. When the two disagree, the catalog wins; please open an issue.

  • Direction: submission only (build, then send to CVM). Reading CVM files back is out of scope today.
  • Coverage: the layouts in the table below are implemented. The rest are tracked as open writer issues, so they are planned, not forgotten.
  • Decimals are truncated, never rounded (ROUND_DOWN): a value with more digits than the layout's scale loses the excess, so a reported figure is never inflated.
  • CNPJ and CPF check digits are validated before anything is serialised.

Features

  • Pydantic models for every CVM XML layout listed below, validated before anything is serialised.
  • One writer per layout (export(doc, output_path=None)), producing windows-1252 XML.
  • Byte-identical to the original filings-cvm writers, pinned by a golden-file test.
  • Runtime dependencies: pydantic and beartype. No network.
Layout Writer Document model (private) Spec
Atualização do Cadastro de Ativos CadastroAtivos CadastroAtivosDocument PadraoXMLAtivos
CDA V4 Cda CdaDocument PadraoXMLCDANetV4
CDA V3 CdaV3 CdaV3Document PadraoXMLCDANetV3
Extrato das Informações sobre o Fundo V3 Extrato ExtratoDocument PadraoXMLInfExtratoV3
Informe de Fundo 157 InfFundo157 InfFundo157Document PadraoXMLInf157
Informe Mensal FIDC (ICVM 576) InfMensalFidc InfMensalFidcDocument PadraoXMLMensalFIDC576
Informe Diário V4 InformeDiario InformeDiarioDocument PadraoXMLInfoDiarioNetV4
Informe Diário V3 InformeDiarioV3 InformeDiarioV3Document PadraoXMLInfoDiarioNetV3
Informe Diário V2 InformeDiarioV2 InformeDiarioV2Document PadraoXMLInfoDiarioNet739
Informe de Portabilidade InformePortabilidade InformePortabilidadeDocument PadraoXMLInfoPortabilidade
Informe Quadrimestral V2 InformeQuadrimestral InformeQuadrimestralDocument PadraoXMLInfoTrimV2
Informe Trimestral V1 InformeTrimestralV1 InformeTrimestralV1Document PadraoXMLInfoTrim
Informe Mensal de Investidor Não Residente InrMensal InrMensalDocument PadraoXMLInfoMensalINR
Lâmina de Fundos V3 Lamina LaminaDocument PadraoXMLLaminaV3
Lâmina de Fundos V1 LaminaV1 LaminaV1Document PadraoXMLLamina
Lâmina de Fundos V2 LaminaV2 LaminaV2Document PadraoXMLLaminaV2
Perfil Mensal V4 PerfilMensal PerfilMensalDocument PadraoXMLPerfilV4
Perfil Mensal (original) PerfilMensalOriginal PerfilMensalOriginalDocument PadraoXMLPerfil
Perfil Mensal V3 PerfilMensalV3 PerfilMensalV3Document PadraoXMLPerfilV3

Documentation

The documentation site lives at https://guilhermegor.github.io/layouts-cvm/. Serve it locally with bash bin/poe_exec.sh docs_serve.

Getting Started

Python 3.10+ is the only prerequisite; bin/venv.sh installs Poetry when it is missing.

Install

pip install layouts-cvm

Or from source:

git clone https://github.com/guilhermegor/layouts-cvm.git
cd layouts-cvm
bash bin/venv.sh
bash bin/poe_exec.sh init

poe lives inside the virtualenv, so bin/venv.sh creates it first; bin/poe_exec.sh then runs poe init without activating anything. Once the virtualenv exists, poetry run poe init does the same.

Usage

from layouts_cvm import InformeDiario

dict_payload = {
    "header": {"dt_compt": "15/01/2025", "dt_gerac_arq": "15/01/2025"},
    "informs": [
        {
            "cnpj_fdo": "11222333000181",
            "data_prox_pl": "16/01/2025",
            "vl_total": "0",
            "vl_quota": "0",
            "patrim_liq": "0",
            "captc_dia": "0",
            "resg_dia": "0",
            "vl_total_sai": "0",
            "vl_total_atv": "0",
            "nr_cotst": 0,
        }
    ],
}

xml = InformeDiario().export(dict_payload)                  # returns the XML text
InformeDiario().export(dict_payload, "informe_diario.xml")  # or writes it, atomically

The payload is plain data: the writer validates it against the layout's document model before serialising. The document models are private (layouts_cvm._internal) and not part of the public API; each layout's page in the documentation lists its fields.

Each layout has its own page under the Layouts section of the documentation.

Project Structure

layouts-cvm/
├── .github/        workflows, CODEOWNERS, PR template
├── .specs/         feature specs and backlog trackers
├── bin/            gate scripts and helpers
├── docs/           published documentation
├── src/layouts_cvm/
│   ├── <layout>.py one writer module per layout, exported in __init__.py
│   └── _internal/  private: config/schemas/ (the document models), utils/
├── tests/
│   ├── unit/
│   ├── integration/
│   └── golden/     byte-parity fixture against the original filings-cvm writers
├── pyproject.toml
└── poe_tasks.toml  task runner entry points

Development

After the bootstrap under Install, any task can be run with the bootstrap script: bash bin/poe_exec.sh <task>, and bash bin/poe_exec.sh with no task lists them.

bash bin/poe_exec.sh unit_tests
bash bin/poe_exec.sh integration_tests

Once the first release's docs deploy has created the gh-pages branch, run bash bin/poe_exec.sh enable_pages once: until that branch exists, init leaves Pages untouched.

Public API

The public surface is whatever the package __init__.py lists in __all__; everything under _internal/ is private. That surface is the writers: the document models live in _internal/config/schemas/ and a writer takes plain data (or a built model). The check-public-all-not-internal gate fails if __all__ ever exports a name defined there.

Publishing

Releases go out from the release workflows under .github/workflows/; the git tag is the version.

The path from 0.x to 1.0.0, and the release gate that guards it, is in docs/releasing-1-0-0.md.

Contributing

See CONTRIBUTING.md for the branch, commit and review rules.

License

This project is licensed under MIT; see LICENSE.

Authors


Generated from the lib-minimal template via BlueprintX. Unofficial, community library. Not affiliated with or endorsed by the Comissão de Valores Mobiliários (CVM); the emblem is theirs and is not covered by this project's MIT license.

Metadata

Release files for layouts-cvm 0.2.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 layouts-cvm 0.2.1
File Size Uploaded Provenance Actions
layouts_cvm-0.2.1.tar.gz 135.3 kB With provenance Details for layouts_cvm-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for layouts-cvm 0.2.1
File Interpreter ABI Platform Actions
layouts_cvm-0.2.1-py3-none-any.whl Python 3 none any Details for layouts_cvm-0.2.1-py3-none-any.whl

Total release size: 329.9 kB

Release files / layouts_cvm-0.2.1.tar.gz

Download URL layouts_cvm-0.2.1.tar.gz
Size 135.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e11b9665af4943aaf12d94b4a1cf3c14c4bb90f42e926049cbd4063aa938a60e
BLAKE2b-256 checksum
How to use checksums
48a66bea94c1ce740a536ba3b32e44a709a42cfc059d16474062c7d830fd4fd8
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 4, 2026.

Transparency log

Release files / layouts_cvm-0.2.1-py3-none-any.whl

Download URL layouts_cvm-0.2.1-py3-none-any.whl
Size 194.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d3a889803b1574e6099963caff8ba7fc7fdc617666adf802b6bcbbf91c030e64
BLAKE2b-256 checksum
How to use checksums
60057962aebf6442d4251b48852e20a943d4fc8e7bb692a5183307dc2ff94ab4
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 4, 2026.

Transparency log

Security for layouts-cvm 0.2.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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for layouts_cvm-0.2.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 4, 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.

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