# Hatch vs Poetry: Qual ferramenta de projeto Python para CI?

> Hatch vs Poetry para CI Python: configuração baseada em padrões, ambientes, locking e builds. Qual gerenciador de projeto se encaixa no seu empacotamento e pipeline.

Source: https://latchkey.dev/pt/learn/tool-comparisons/hatch-vs-poetry  
Updated: 2026-06-25

O Hatch se apoia em padrões PEP e ambientes de matrix; o Poetry oferece um fluxo integrado, com lockfile em primeiro lugar.

O Hatch é um gerenciador de projetos da PyPA focado em configuração pyproject.toml compatível com padrões, ambientes scriptáveis e um build backend rápido. O Poetry reúne resolução de dependências, um lockfile e empacotamento em uma única ferramenta opinativa.

## Comparison

|  | Hatch | Poetry |
| --- | --- | --- |
| Configuração | pyproject.toml (PEP 621) | pyproject.toml (historicamente específico do Poetry) |
| Lockfile | Via plugin / suporte mais recente | poetry.lock (nativo) |
| Ambientes | Gerenciamento de ambientes em matrix | Único venv de projeto |
| Build backend | hatchling (rápido, popular) | poetry-core |
| Melhor para | Bibliotecas, testes multi-ambiente | Apps que querem dependências fixadas por padrão |

## No CI

O Hatch se destaca quando você testa sobre uma matrix de versões do Python e conjuntos de dependências - seu modelo de ambientes se mapeia de forma limpa às matrizes de CI, e o hatchling é um build backend amplamente usado e amigável aos padrões. O Poetry se destaca quando você quer instalações determinísticas a partir de um lockfile comitado com configuração mínima. Muitos autores de bibliotecas preferem o Hatch para builds; muitas equipes de apps preferem o Poetry para o locking.

## Escolhendo para pipelines

Publicar uma biblioteca e rodar uma matrix de versões/dependências: Hatch. Construir um app onde um lockfile comitado e uma instalação em um comando importam mais: Poetry. Faça cache do venv relevante ou do cache de wheels com chave no seu lock ou entradas fixadas em ambos os casos.

## Decide with your own numbers, not a feature table

Feature comparisons age badly and rarely decide anything, because both tools in a mature category can do the job. What differs is how each behaves on your repository, and that takes one afternoon to measure.

```Terminal
# time a cold install with each candidate, cache cleared
hyperfine --prepare "rm -rf node_modules" --warmup 1 \
  "<tool-a> install" "<tool-b> install"

# and the thing CI actually pays for: a cold run with no local cache
docker run --rm -v "$(pwd):/w" -w /w node:22 sh -c "<tool> install"
```

> Measure the cold path. Warm local benchmarks favour whichever tool you already have cached, which is exactly the condition a CI runner never has.

## What actually changes when you switch

- Lockfile format. A switch is a one-way door for anyone still on the old tool until everyone migrates, so plan it as a single coordinated change.
- Resolution strictness. Tools differ on whether an undeclared transitive import works, and the stricter one will surface latent bugs as new failures.
- CI cache configuration. The cache path and key differ per tool; carrying over the old ones silently disables caching.
- Everyone on the team and every runner must move together. Pin the version so they cannot drift.

## O veredito

Biblioteca com testes multi-ambiente e configuração no padrão PEP: Hatch. App que quer gerenciamento de dependências com lockfile em primeiro lugar e tudo incluído: Poetry. Escolha a ferramenta conforme você esteja empacotando ou fixando versões.

## FAQ

### Hatch vs Poetry: Which Python Project Tool for CI?

Hatch is a PyPA project manager focused on standards-compliant pyproject.toml config, scriptable environments, and a fast build backend. Poetry bundles dependency resolution, a lockfile, and packaging in one opinionated tool.

### In CI?

Hatch shines when you test across a matrix of Python versions and dependency sets - its environment model maps cleanly onto CI matrices, and hatchling is a widely-used, standards-friendly build backend. Poetry shines when you want deterministic installs from a committed lockfile with minimal setup.

### Choosing for pipelines?

Publishing a library and running a version/dependency matrix: Hatch. Building an app where a committed lockfile and one-command install matter most: Poetry. Cache the relevant venv or wheel cache keyed on your lock or pinned inputs in both.

### Which should I choose?

Library with multi-environment testing and PEP-standard config: Hatch. App wanting lockfile-first, batteries-included dependency management: Poetry. Match the tool to whether you are packaging or pinning.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
