Skip to content

Unable to create pre-release with an empty token #344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vincent-herlemont opened this issue Nov 30, 2021 · 2 comments
Closed

Unable to create pre-release with an empty token #344

vincent-herlemont opened this issue Nov 30, 2021 · 2 comments
Labels
Bug Error, flaw or fault to produce incorrect or unexpected results

Comments

@vincent-herlemont
Copy link

Situation

Unable to create pre-release with an empty token.

To Reproduce

Run this script:

ver = semver.VersionInfo.parse('1.0.0')
ver = ver.bump_prerelease('');
print(ver)
# 1.0.0-rc.1

Expected Behavior

.bump_prerelease('') should generate an version like 1.0.0-1.

Environment

  • OS: Linux ubuntu 5.11.0-40-generic
  • Python version: Docker image python:3.8
  • Version of semver library: semver==2.13.0

Additional context

Pre-release documentation https://semver.org/#spec-item-9

@vincent-herlemont vincent-herlemont added the Bug Error, flaw or fault to produce incorrect or unexpected results label Nov 30, 2021
@tomschr
Copy link
Member

tomschr commented Dec 7, 2021

Thank you @vincent-herlemont, much appreciated. Sorry for the late response.

I suppose, this should be fixed. This behaviour is the same for the method .bump_build(). So both need to be adapted.

@tomschr
Copy link
Member

tomschr commented Oct 8, 2022

@vincent-herlemont One question. What would you expect if you have already a prerelease and pass an empty string? Like this:

>>> ver = semver.VersionInfo.parse('1.0.0-rc.1')
>>> ver.bump_prerelease('')
# ???

I could think of two solutions:

  1. Basically ignore the token argument in .bump_prerelease(). In our case above, you would get 1.0.0-rc.2.
  2. Overwrite with the token argument in .bump_prerelease(). In our case above, you would get 1.0.0-0.

If you already have a prerelease, you would like to continue when using .bump_prerelease(), right? Solution 2 would be more flexible.

In other words: If prerelease isn't set, the token is taken into account, otherwise it's ignored (regardless of the value).

tomschr added a commit to tomschr/python-semver that referenced this issue Oct 8, 2022
The methods .bump_prerelease('') and .bump_build('') generates
a prerelease and build part without the token.
tomschr added a commit to tomschr/python-semver that referenced this issue Dec 18, 2022
The methods .bump_prerelease('') and .bump_build('') generates
a prerelease and build part without the token.
tomschr added a commit to tomschr/python-semver that referenced this issue Dec 21, 2022
The methods .bump_prerelease('') and .bump_build('') generates
a prerelease and build part without the token.
tomschr added a commit to tomschr/python-semver that referenced this issue Feb 20, 2023
The methods .bump_prerelease('') and .bump_build('') generates
a prerelease and build part without the token.
tomschr added a commit to tomschr/python-semver that referenced this issue Mar 5, 2023
The methods .bump_prerelease('') and .bump_build('') generates
a prerelease and build part without the token.
tomschr added a commit to tomschr/python-semver that referenced this issue Mar 5, 2023
The methods .bump_prerelease('') and .bump_build('') generates
a prerelease and build part without the token.
tomschr added a commit to tomschr/python-semver that referenced this issue Mar 5, 2023
The methods .bump_prerelease('') and .bump_build('') generates
a prerelease and build part without the token.
tomschr added a commit to tomschr/python-semver that referenced this issue Mar 5, 2023
The methods .bump_prerelease() and .bump_build() allow now
different types for the token argument:

* A string. This was already allowed and default was "rc".
  If the string is empty, we get only the raised number (without
  the "rc" part).
* None. Is the same as calling the method without any argument.
tomschr added a commit to tomschr/python-semver that referenced this issue Mar 5, 2023
The methods .bump_prerelease() and .bump_build() allow now
different types for the token argument:

* A string. This was already allowed and default was "rc".
  If the string is empty, we get only the raised number (without
  the "rc" part).
* None. Is the same as calling the method without any argument.
@tomschr tomschr closed this as completed in f8a182f Mar 5, 2023
tomschr added a commit that referenced this issue Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Error, flaw or fault to produce incorrect or unexpected results
Projects
None yet
Development

No branches or pull requests

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy