Skip to content
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

Extend poetry version xxx commands to support -beta.# and -rc.# #1959

Closed
2 tasks done
joeb1415 opened this issue Jan 29, 2020 · 9 comments · Fixed by #8089
Closed
2 tasks done

Extend poetry version xxx commands to support -beta.# and -rc.# #1959

joeb1415 opened this issue Jan 29, 2020 · 9 comments · Fixed by #8089
Labels
good first issue kind/feature Feature requests/implementations status/accepted Feature request accepted for the roadmap

Comments

@joeb1415
Copy link

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request

poetry version prepatch (or prerelease, etc.) is great for incrementing the version from 1.2.3 to 1.2.4-alpha.0, and then to 1.2.4-alpha.1, etc. but this is the extent of the functionality.
https://python-poetry.org/docs/cli/#version

It would be great if we could add a few other commands to allow for pre-release name patterns. Adding alpha, beta, and rc would make sense as the other available commands to support other pre-release versions. This could work as:

$ poetry version alpha
Bumping version from 1.2.3 to 1.2.4-alpha.0
$ poetry version alpha
Bumping version from 1.2.4-alpha.0 to 1.2.4-alpha.1
$ poetry version beta
Bumping version from 1.2.4-alpha.1 to 1.2.4-beta.0
$ poetry version rc
Bumping version from 1.2.4-beta.0 to 1.2.4-rc.0
$ poetry version rc
Bumping version from 1.2.4-rc.0 to 1.2.4-rc.1
$ poetry version patch
Bumping version from 1.2.4-rc.1 to 1.2.4

This would adhere to the pre-release precedence order described here:
https://semver.org/#spec-item-11

Thanks for considering!

@joeb1415 joeb1415 added the kind/feature Feature requests/implementations label Jan 29, 2020
@joeb1415
Copy link
Author

joeb1415 commented Feb 6, 2020

Perhaps adding an options flag --modifier=xxx here:

arguments = [
argument(
"version",
"The version number or the rule to update the version.",
optional=True,
)
]

Where modifier matches these:

m = re.match(r"(?i)^(a|alpha|b|beta|c|pre|rc|dev)[-.]?(\d+)?$", pre)

@timorkal
Copy link

will it ever be made?
I need to bump versions between branches with bash commands because "poetry version" command doesn't support it.

@finswimmer finswimmer added good first issue status/accepted Feature request accepted for the roadmap labels Oct 20, 2022
@PabloEmidio
Copy link
Contributor

@python-poetry/triage

@q-wertz
Copy link

q-wertz commented Apr 19, 2023

A problem is that the library semantic_version crashes on the current poetry pre* version strings as it is strictly following the semver specification.

import semantic_version

semantic_version.Version("0.19.0a1")

Results in

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[48], line 1
----> 1 semantic_version.Version("0.19.0a1")

File ~/VCS/ads-b_simulator/.venv/lib/python3.11/site-packages/semantic_version/base.py:105, in Version.__init__(self, version_string, major, minor, patch, prerelease, build, partial)
    102     raise ValueError("Call either Version('1.2.3') or Version(major=1, ...).")
    104 if has_text:
--> 105     major, minor, patch, prerelease, build = self.parse(version_string, partial)
    106 else:
    107     # Convenience: allow to omit prerelease/build.
    108     prerelease = tuple(prerelease or ())

File ~/VCS/ads-b_simulator/.venv/lib/python3.11/site-packages/semantic_version/base.py:318, in Version.parse(cls, version_string, partial, coerce)
    316 match = version_re.match(version_string)
    317 if not match:
--> 318     raise ValueError('Invalid version string: %r' % version_string)
    320 major, minor, patch, prerelease, build = match.groups()
    322 if _has_leading_zero(major):

ValueError: Invalid version string: '0.19.0a1'

@peterwwillis
Copy link

This is still an issue... would like to be able to iterate on prepatch versions of a patch without overwriting previous alpha versions. Bumping the patch version isn't what we want because the patch hasn't been released yet.

@radoering
Copy link
Member

To those who are still waiting this feature: Can you please have a look whether #8089 satisfies your use cases? It's different from the original proposal in this issue, but seems to offer similar functionality from my perspective. (Since I'm not using poetry version to bump versions myself, I don't have strong feelings.)

@eliorc
Copy link

eliorc commented Aug 13, 2023

To those who are still waiting this feature: Can you please have a look whether #8089 satisfies your use cases? It's different from the original proposal in this issue, but seems to offer similar functionality from my perspective. (Since I'm not using poetry version to bump versions myself, I don't have strong feelings.)

looks awesome

@froy001
Copy link

froy001 commented Aug 23, 2023

To those who are still waiting this feature: Can you please have a look whether #8089 satisfies your use cases? It's different from the original proposal in this issue, but seems to offer similar functionality from my perspective. (Since I'm not using poetry version to bump versions myself, I don't have strong feelings.)

It's works for my usecase requiring an RC version.
Is there an estimate on when this will be released?

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue kind/feature Feature requests/implementations status/accepted Feature request accepted for the roadmap
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants