Skip to main content

nfetoolkit

Ferramenta de linha de comando para organizar, corrigir, ler e exportar arquivos XML de Nota Fiscal Eletrônica (NF-e).


📦 Instalação de dependências

Certifique-se de ter o Python 3.9+ instalado.

Instale as dependências com:

pip install -r requirements.txt

▶️ Como usar

Execute a ferramenta com o comando:

python manage.py <comando> [opções]

🔁 Comandos disponíveis

🗂️ organize

Organiza os arquivos XML em subpastas por tipo: nfe, canc, cce, inut.

python manage.py organize <source_dir> <dest_dir> [--no-verbose]

Exemplo:

python manage.py organize C:\xmls_originais C:\xmls_organizados

📤 export

Exporta os dados estruturados dos XMLs encontrados para um arquivo .txt.

python manage.py export <xml_dir> [--output <arquivo_saida>] [--no-verbose]

Exemplo:

python manage.py export C:\xmls_organizados --output export.txt

Se não especificar --output, será gerado ./nfe_data.txt no diretório atual.


🛠️ fix

Aplica correções definidas em um arquivo config.json a todos os XMLs de um diretório.

python manage.py fix <input_dir> <config.json> [--output_dir <destino>] [--no-verbose]

Exemplo:

python manage.py fix C:\xmls_organizados config.json --output_dir C:\xmls_corrigidos

Se --output_dir não for informado, os arquivos corrigidos serão salvos no mesmo diretório de origem.


📄 read

Gera o DANFE (arquivo PDF) de uma NF-e.

python manage.py read <xml_file> [--output <arquivo_pdf>]

Exemplo:

python manage.py read nfe.xml --output nota.pdf

🔧 Exemplo de config.json para o comando fix

{
  "rules": [
    {
      "namespace": {
        "ns": "http://www.portalfiscal.inf.br/nfe"
      },
      "path": ".//ns:det",
      "tag": ".//ns:imposto/ns:ICMS/ns:ICMS00/ns:orig",
      "condition": {
        ".//ns:prod/ns:NCM": "85142011",
        ".//ns:imposto/ns:ICMS/ns:ICMS00/ns:orig": "0"
      },
      "new_value": "2"
    }
  ]
}

📌 Observações

  • O padrão é exibir barra de progresso (verbose=True). Use --no-verbose se quiser ocultar.
  • A estrutura esperada dos XMLs segue o padrão da SEFAZ.
  • Os dados exportados seguem o layout dos blocos SPED (RegistroN100, N170, Z100, etc.).

📁 Estrutura recomendada do projeto

nfetoolkit/
├── core/
│   ├── handler.py
│   ├── fix.py
│   ├── organizer.py
│   ├── repository.py
├── manage.py
├── config.json
├── requirements.txt

🔗 Licença

Este projeto é distribuído sob a licença MIT.

Metadata

Release files for nfetoolkit 0.3.3

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

Source distribution (sdist)

Source distribution for nfetoolkit 0.3.3
File Size Uploaded Provenance Actions
nfetoolkit-0.3.3.tar.gz 14.3 kB Without provenance Details for nfetoolkit-0.3.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nfetoolkit 0.3.3
File Interpreter ABI Platform Actions
nfetoolkit-0.3.3-py3-none-any.whl Python 3 none any Details for nfetoolkit-0.3.3-py3-none-any.whl

Total release size: 27.5 kB

Release files / nfetoolkit-0.3.3.tar.gz

Download URL nfetoolkit-0.3.3.tar.gz
Size 14.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5f4b24fb75b04abfe1059f066509fb399d243e20d50bc4d75926d6a58368870e
BLAKE2b-256 checksum
How to use checksums
ea579c92401abc178867eff3ab9b70dcd812247674a371df06b9a7b2d4b154fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.1

Release files / nfetoolkit-0.3.3-py3-none-any.whl

Download URL nfetoolkit-0.3.3-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ddf48115a046e21a9864ffd501827b1c0e5a1453a5fad9b4442f2e393d96f2a6
BLAKE2b-256 checksum
How to use checksums
0e1d1ce9038814c7f3bd8488f7268c749fe77e4a9ab367616036acfdf2652e61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.1

Security for nfetoolkit 0.3.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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