Selva
Selva

Reputation: 1153

Python Poetry: How to add a label in version?

I usually have multiple feature branches and share those features with our users for their testing. Then, when satisfied we merge to develop branch. Usually, we do somthing like 0.1.1a0+date or 0.1.1a0+jiraTaskNumber or 0.1.1a0+gitBranchName manually.

I would like to automate this and I am not able to see how to achieve this in poetry because it supports only poetry version prepatch|major|so_on.

Can someone help me with how I can achieve this?

Upvotes: 1

Views: 616

Answers (1)

finswimmer
finswimmer

Reputation: 15192

poetry version also takes any valid version number to set the version directly. So you can do:

poetry version 0.1.1a0+gitBranchName

If you want to combine bumping to the next minor, major etc. and a label you can do it like this, from Poetry 1.2 on:

poetry version "$(poetry version major --dry-run -s)+local"

Upvotes: 2

Related Questions