How tadasoftware/pynfe works
PyNFe is a Python library for assembling Brazilian electronic fiscal documents and interacting with SEFAZ, Receita Federal, and municipal NFS-e services. The main workflow is to create document and party entities, serialize them to XML, optionally sign and validate the XML, then communicate with the relevant service and handle its response. The README documents NF-e/NFC-e, MDF-e, and NFS-e capabilities; CT-e emission is explicitly listed as unfinished. Relationships are limited to the README example and the source imports or calls visible in the supplied excerpts and index.
Main entry points: comunicacao.py SEFAZ communication · serializacao.py XML serialization · notafiscal.py NF-e / NFC-e · manifesto.py MDF-e
Components 23
Fiscal entities
- NF-e / NFC-e
pynfe/entidades/notafiscal.py - MDF-e
pynfe/entidades/manifesto.py - NFS-e data
pynfe/entidades/servico.py - Parties and products
pynfe/entidades/cliente.py - Fiscal events
pynfe/entidades/evento.py - Document lots
pynfe/entidades/lotes.py - Entity base
pynfe/entidades/base.py - Entity data source
pynfe/entidades/fonte_dados.py
Document processing
- XML serialization
pynfe/processamento/serializacao.py - XML signature
pynfe/processamento/assinatura.py - XML validation
pynfe/processamento/validacao.py - Response handling
pynfe/processamento/resposta.py
Service integrations
- SEFAZ communication
pynfe/processamento/comunicacao.py - NFS-e serializers
pynfe/processamento/autorizador_nfse.py
Shared utilities
- Digital certificate
pynfe/entidades/certificado.py - Service endpoints
pynfe/utils/webservices.py - Fiscal constants
pynfe/utils/flags.py - XML utilities
pynfe/utils/xml_writer.py - Ginfes schema types
pynfe/utils/nfse/ginfes/_tipos.py - Ginfes signature types
pynfe/utils/nfse/ginfes/_dsig.py
Other components
- Library caller
- SEFAZ services
- Municipal services
Connections 25
- Library caller → SEFAZ communication: requests service status
- Library caller → NF-e / NFC-e: builds documents
- Library caller → MDF-e: builds manifests
- Library caller → NFS-e data: builds service invoices
- Entity base → Entity data source: registers entities
pynfe/entidades/base.py - NF-e / NFC-e → Entity base: inherits
pynfe/entidades/notafiscal.py - MDF-e → Entity base: inherits
pynfe/entidades/manifesto.py - Parties and products → Entity base: inherits
pynfe/entidades/cliente.py - XML serialization → NF-e / NFC-e: serializes
pynfe/processamento/serializacao.py - XML serialization → MDF-e: serializes
- XML serialization → NFS-e serializers: dispatches NFS-e
pynfe/processamento/serializacao.py - XML serialization → XML utilities: uses XML writer
pynfe/processamento/serializacao.py - XML signature → Digital certificate: uses certificate
pynfe/processamento/assinatura.py - SEFAZ communication → XML signature: uses signing
pynfe/processamento/comunicacao.py - SEFAZ communication → NFS-e serializers: delegates NFS-e
pynfe/processamento/comunicacao.py - SEFAZ communication → Service endpoints: resolves endpoints
pynfe/processamento/comunicacao.py - SEFAZ communication → Digital certificate: loads certificate
pynfe/processamento/comunicacao.py - SEFAZ communication → SEFAZ services: posts requests
pynfe/processamento/comunicacao.py - SEFAZ communication → Municipal services: posts requests
pynfe/processamento/comunicacao.py - SEFAZ communication → Response handling: returns responses
- NFS-e serializers → Ginfes schema types: loads schema types
pynfe/processamento/autorizador_nfse.py - Ginfes schema types → Ginfes signature types: imports signature types
pynfe/utils/nfse/ginfes/_tipos.py - NF-e / NFC-e → Fiscal constants: uses fiscal constants
pynfe/entidades/notafiscal.py - MDF-e → Fiscal constants: uses fiscal constants
pynfe/entidades/manifesto.py - XML validation → Fiscal constants: uses fiscal constants
pynfe/processamento/validacao.py