dependabot / dependabot/dependabot-core

Improve handling of Python versioning strings

Open
#6,300 2 comments 1 reaction 0 assignees View on GitHub
L: python:pip L: python:pipenv L: python:poetry needs-triage python T: tech-debt ⚙️ versioning
Dominant language
Ruby
Stars
5.8k
Forks
1.5k
Avg merge
2d 18h
Merged PRs (30d)
149

Description

While working on https://github.com/dependabot/dependabot-core/pull/4928 Jake noticed that some of the ordering and parsing wasn't quite up to [PEP 440](https://peps.python.org/pep-0440)'s standards. In that PEP they have a list of version strings in order:

```
1.dev0
1.0.dev456
1.0a1
1.0a2.dev456
1.0a12.dev456
1.0a12
1.0b1.dev456
1.0b2
1.0b2.post345.dev456
1.0b2.post345
1.0rc1.dev456
1.0rc1
1.0
1.0+abc.5
1.0+abc.7
1.0+5
1.0.post456.dev34
1.0.post456
1.0.15
1.1.dev1
```

He tried those with our current setup and it failed in several ways. So this issue is to circle back and use the official regex and normalization logic to make that list ☝️ pass in a test.

Also we need to make sure that doing this doesn't break any current assumptions. One thought was since "Post releases" don't add anything substantial to the release we might want to ignore them completely otherwise Dependabot might annoy customers with unnecessary bumps.

I suspect we will see more bugs around Dependabot bumping versions incorrectly until we match the PEP standard.

Related:
* https://github.com/pypa/pip/issues/12012
* https://github.com/pypa/pip/issues/12063

Contributor guide

Open the contributing guide

Research direction

Start with PEP 440's official version-string regex, normalization rules, and ordering example from the issue. Add a test covering the listed versions in order, then verify existing assumptions remain intact, including whether post releases should be ignored or retained.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, ruby
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.