question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add an easy way to maintain PEP 440 compatible version identifiers

See original GitHub issue

PEP 440 defines a new scheme for identifying versions of Python software distributions. bumpversion should offer an easy way to maintain all kinds of version identifiers supported by PEP 440.

Example

If I want to use “dev” releases to allow my users to download development releases from PyPI I have to use the following bumpversion configuration:

[bumpversion]
files = setup.py docs/conf.py
commit = True
current_version = 0.2.0.dev0
parse = 
    (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(?:\.dev(?P<dev>\d+))?
serialize = 
    {major}.{minor}.{patch}.dev{dev}
    {major}.{minor}.{patch}

[bumpversion:part:dev]
values = 
    0
    1
    2
    3
    4
optional_value = 4

After releasing 0.1.2 users can execute bumpversion minor and will move the version to 0.2.0.dev0 which is fine.

But to have no “dev” release at all or to stop doing “dev” releases optional_value has to be set manually to the value of the release to be skipped. So I would appreciate it if users could use an option to move from 0.2.0.dev0 to 0.2.0.

Currently I have no idea how options for this behaviour could look like.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

18reactions
alanbriolatcommented, Aug 13, 2015

@keimlink: I realise this issue is closed, but I had the same problem as you and solved it slightly differently, by adding a dev part (with no special configuration) and also a release part (like bumpversion’s own). Perhaps somebody will find this useful.

[bumpversion]
current_version = 0.1.0
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<dev>\d+))?
serialize = 
    {major}.{minor}.{patch}.{release}{dev}
    {major}.{minor}.{patch}

[bumpversion:part:release]
optional_value = gamma
values = 
    dev
    gamma

[bumpversion:part:dev]

Using the release part removes the problem of needing to define an endpoint for dev. So, from this starting point:

  • bumpversion patch: 0.1.0 -> 0.1.1.dev0
  • bumpversion release: 0.1.1.dev0 -> 0.1.1
  • bumpversion minor: 0.1.1 -> 0.2.0.dev0
  • bumpversion dev: 0.2.0.dev0 -> 0.2.0.dev1
  • bumpversion release: 0.2.0.dev1 -> 0.2.0

(I would combine tag = False in the config with using bumpversion --tag release, to prevent tagging all the non-release versions.)

0reactions
perituscommented, Mar 11, 2015

It’s actually a duplicate of #50, not 55.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PEP 440 – Version Identification and Dependency Specification
This PEP describes a scheme for identifying versions of Python software ... In order to maintain better compatibility with existing versions there are...
Read more >
Specifying Your Project's Version - Setuptools
dev0 is PEP 440-compliant. If you want to be certain that your chosen numbering scheme works the way you think it will, you...
Read more >
How to correctly create Python feature branch releases in ...
i am too thinking about this. Although not intended for this use, you could misuse the local version identifier noted in the PEP-440, ......
Read more >
5 Best Practices for Versioning Your Python Packages
Fortunately, learning how to version Python packages doesn't mean you'll need to parse PEP 440 - I've already done that for you!
Read more >
FAQ | master | Documentation | Poetry - Python dependency ...
Why does Poetry enforce PEP 440 versions? #. This is done so to be compliant with the broader Python ecosystem. For example, if...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found