Python: Controlando versionamento com poetry

Python: Controlando versionamento com poetry

O que é o poetry?

Poetry é uma ferramenta para gerenciamento de dependências e empacotamento em Python. Ele permite que a declaração das bibliotecas de dependência do seu projeto e as gerencia (instalar/atualizar) de forma simples e prática.

O Poetry incorpora varias funcionalidades em uma só ferramenta, e uma delas é o gerenciamento do número de versão. Similar a utilização do bumpversion.

Vantagens

O poetry segue a "semântica de versionamento tratada na PEP440".

Totalmente aderente ao novo modelo de pacotes do python com pyproject.toml.

Desvantagens

Não persebidas para gestão de versionamento dos pacotes.

Utilização

A utilização é bastante simples.

poetry version prepatch

poetry version patch

poetry version preminor

poetry version minor

poetry version premajor

poetry version major

poetry version prerelease

poetry version 0.1.1-rc.0

Criar Ambiente virtual com poetry

$ poetry new teste01
Created package teste01 in teste01

Exemplos

$ poetry version
teste01 0.1.0

$ poetry version prerelease
Bumping version from 0.1.0 to 0.1.1-alpha.0

$ poetry version prerelease
Bumping version from 0.1.1-alpha.0 to 0.1.1-alpha.1

$ poetry version patch
Bumping version from 0.1.1-alpha.1 to 0.1.1

$ poetry version prerelease
Bumping version from 0.1.1 to 0.1.2-alpha.0

$ poetry version preminor
Bumping version from 0.1.2-alpha.0 to 0.2.0-alpha.0

$ poetry version prerelease
Bumping version from 0.2.0-alpha.0 to 0.2.0-alpha.1

$ poetry version patch
Bumping version from 0.2.0-alpha.1 to 0.2.0

poetry version minor
Bumping version from 0.2.0 to 0.3.0

$ poetry version patch
Bumping version from 0.3.0 to 0.3.1

$ poetry version prepatch
Bumping version from 0.3.1 to 0.3.2-alpha.0

$ poetry version patch
Bumping version from 0.3.2-alpha.0 to 0.3.2

$ poetry version premajor
Bumping version from 0.3.2 to 1.0.0-alpha.0

$ poetry version 1.0.0-rc.0
Bumping version from 1.0.0-alpha.0 to 1.0.0-rc.0

$ poetry version prerelease
Bumping version from 1.0.0-rc.0 to 1.0.0-rc.1

$ poetry version prerelease
Bumping version from 1.0.0-rc.1 to 1.0.0-rc.2

$ poetry version patch
Bumping version from 1.0.0-rc.2 to 1.0.0

$ poetry version major
Bumping version from 1.0.0 to 2.0.0

Comentários