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

Version("1.0.0.dev1").is_prerelease is true, should be false #875

Open
JakeSummers opened this issue Feb 14, 2025 · 4 comments
Open

Version("1.0.0.dev1").is_prerelease is true, should be false #875

JakeSummers opened this issue Feb 14, 2025 · 4 comments

Comments

@JakeSummers
Copy link

Bug Report

v = Version("1.0.0.dev1")

assert v.is_devrelease == True
assert v.is_prerelease == True # Fails

Reproducibility

$ poetry run python --version
Python 3.11.5
 poetry show packaging
 name         : packaging
 version      : 23.2
 description  : Core utilities for Python packages

required by
 - black >=22.0
 - pytest *
@JakeSummers
Copy link
Author

Looking at this a bit further, it looks like this is the desired behaviour:

Image

See: https://packaging.pypa.io/en/stable/version.html#packaging.version.Version.is_prerelease

I suppose that dev and release candidate may be a subclass of a pre-release..

Question: Where can I find the definition of what a pre-release is?

@notatallshaw
Copy link
Member

Question: Where can I find the definition of what a pre-release is?

https://packaging.python.org/en/latest/specifications/version-specifiers/#pre-releases

I think one could read just that part of the spec and say dev-releases are not pre-releases, unless they are dev-releases of pre-releases.

This is problamatic though because other parts of the spec clearly consider dev releases to be part of pre-releases:

Pre-releases of any kind, including developmental releases

IMO the spec should be updated for clarity here. But perhaps a packaging maintainer might want to weigh in.

@brettcannon
Copy link
Member

IMO the spec should be updated for clarity here. But perhaps a packaging maintainer might want to weigh in.

I agree that the spec needs to be clarified before we make a breaking change in the meaning of is_prerelease, so someone would need to take this to https://discuss.python.org/c/packaging/ for clarification.

@notatallshaw
Copy link
Member

notatallshaw commented Feb 22, 2025

As this question has come up a couple of times now I created such discussion: https://discuss.python.org/t/are-developmental-releases-a-type-of-pre-release/81666

If it's decided that dev-releases are a form of pre-release then one thing missing from packaging's current API is a way to distguish between a dev-release of a final release, and a dev-release of a pre-release, e.g. 1.0dev1 and 1.0a1dev1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants