DOC: fix the dev version label in the version dropdown
State: closed

Fixing the version in dev distributions

- [X] closes #55160

Labels:
name: Docs
name: Sprints
description: Sprint Pull Requests

Comments:
@jorisvandenbossche done at in-person sprint session :)
IIUC, we have some existing code that is supposed to do the conversion here.
https://github.com/pandas-dev/pandas/blob/c25370810ecb485d25258c069bc3c4ae81d2b6f9/doc/source/conf.py#L234-L238
(the .dev part is the relevant line)

Do you know if that broke somehow?
> IIUC, we have some existing code that is supposed to do the conversion here.
> 
> https://github.com/pandas-dev/pandas/blob/c25370810ecb485d25258c069bc3c4ae81d2b6f9/doc/source/conf.py#L234-L238
> 
> 
> (the .dev part is the relevant line)
> Do you know if that broke somehow?

Seems the `switcher_version` variable is only used for the HTML metadata. Therefore I have followed the previous implementation modifying `version` variable.
So, the issue here is that now (with the change to the new build system), the output of ``pd.__version__`` is
``'2.2.0dev0+290.gc8e7a98d6e.dirty'``

Notice how there is a . missing before the dev, so the ``if ".dev" in version`` check will return False, and not change the displayed version to dev.

Can you try updating the if statement there?
> So, the issue here is that now (with the change to the new build system), the output of `pd.__version__` is `'2.2.0dev0+290.gc8e7a98d6e.dirty'`
> 
> Notice how there is a . missing before the dev, so the `if ".dev" in version` check will return False, and not change the displayed version to dev.
> 
> Can you try updating the if statement there?

Definitely ;) Now you have both changes and the version fixed on both the dropdown menu and the HTML info
> So, the issue here is that now (with the change to the new build system), the output of `pd.__version__` is `'2.2.0dev0+290.gc8e7a98d6e.dirty'`
> 
> Notice how there is a . missing before the dev, so the `if ".dev" in version` check will return False, and not change the displayed version to dev.

Actually, I think we need to fix the version instead. According to https://peps.python.org/pep-0440/ there needs to be a `.` to be a valid version specifier (in contrast to `rc`, which should not use a dot, to make it confusing). 

I also assume this is not related to the switch of the build system, but just a tiny mistake in the tagging. Looking at are past tags:

```
$ git tag -l
...
v2.0.0
v2.0.0.dev0
v2.0.0rc0
v2.0.0rc1
v2.0.1
v2.0.2
v2.0.3
v2.1.0
v2.1.0.dev0
v2.1.0rc0
v2.1.1
v2.2.0dev0
```

You can see how the last tag deviates from the previous ones. I think we can still fix that by pushing a new tag on the same commit?

> > So, the issue here is that now (with the change to the new build system), the output of `pd.__version__` is `'2.2.0dev0+290.gc8e7a98d6e.dirty'`
> > Notice how there is a . missing before the dev, so the `if ".dev" in version` check will return False, and not change the displayed version to dev.
> 
> Actually, I think we need to fix the version instead. According to https://peps.python.org/pep-0440/ there needs to be a `.` to be a valid version specifier (in contrast to `rc`, which should not use a dot, to make it confusing).
> 
> I also assume this is not related to the switch of the build system, but just a tiny mistake in the tagging. Looking at are past tags:
> 
> ```
> $ git tag -l
> ...
> v2.0.0
> v2.0.0.dev0
> v2.0.0rc0
> v2.0.0rc1
> v2.0.1
> v2.0.2
> v2.0.3
> v2.1.0
> v2.1.0.dev0
> v2.1.0rc0
> v2.1.1
> v2.2.0dev0
> ```
> 
> You can see how the last tag deviates from the previous ones. I think we can still fix that by pushing a new tag on the same commit?

Thanks for checking it out :) @lithomas1 feel free to put the tag and revert my last commit. Let me know in case of any help
> > So, the issue here is that now (with the change to the new build system), the output of `pd.__version__` is `'2.2.0dev0+290.gc8e7a98d6e.dirty'`
> > Notice how there is a . missing before the dev, so the `if ".dev" in version` check will return False, and not change the displayed version to dev.
> 
> Actually, I think we need to fix the version instead. According to https://peps.python.org/pep-0440/ there needs to be a `.` to be a valid version specifier (in contrast to `rc`, which should not use a dot, to make it confusing).
> 
> I also assume this is not related to the switch of the build system, but just a tiny mistake in the tagging. Looking at are past tags:
> 
> ```
> $ git tag -l
> ...
> v2.0.0
> v2.0.0.dev0
> v2.0.0rc0
> v2.0.0rc1
> v2.0.1
> v2.0.2
> v2.0.3
> v2.1.0
> v2.1.0.dev0
> v2.1.0rc0
> v2.1.1
> v2.2.0dev0
> ```
> 
> You can see how the last tag deviates from the previous ones. I think we can still fix that by pushing a new tag on the same commit?

Thanks for the catch !!!

I was wondering where the missing dot was coming from. This is totally on me - it looks like I botched the tag name when I repushed the 2.2.0 tag. 

Interestingly, enough, the packaging package seems to recognize this as a proper version.
```
import pandas as pd
from packaging.version import Version
Version(pd.__version__)
```

gives
```<Version('2.2.0.dev0+290.gc8e7a98d6e.dirty')>```

I guess that's why the nightly builds version seem fine.

I'll push the new tag on Friday, sorry for the hassle all!
The tag has been updated, so this should be fixed now.

I will close this PR, but thanks for helping me debug this!