fix: Allow to correctly compare parsed versions - #7184
Conversation
Codecov Results 📊✅ 113478 passed | ⏭️ 6769 skipped | Total: 120247 | Pass Rate: 94.37% | Execution Time: 399m 45s 📊 Comparison with Base Branch
➖ Removed Tests (1)View removed tests
All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 2491 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 90.21% 90.20% -0.01%
==========================================
Files 193 193 —
Lines 25433 25429 -4
Branches 9346 9342 -4
==========================================
+ Hits 22945 22938 -7
- Misses 2488 2491 +3
- Partials 1436 1439 +3Generated by Codecov Action |
ericapisani
left a comment
There was a problem hiding this comment.
The comment left by bugbot regarding sanic looks legit. Looks like a quick fix though so approving in order to not block because the changes LGTM otherwise
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 882ff7a. Configure here.
|
|
||
| try: | ||
| from celery import VERSION as CELERY_VERSION # type: ignore | ||
| from celery import __version__ as CELERY_VERSION # type: ignore |
There was a problem hiding this comment.
VERSION is celery's own namedtuple that they parse out of __version__. Use the raw version instead now -- the namedtuple won't compare natively anymore.
|
Re-tagging you for a review @ericapisani since I've changed this PR substantially 🙏🏻 |

Originally raised by a bot here: the
parse_versionfunction parses version strings as is (e.g. 3.1 becomes(3, 1)). We use these parsed version tuples in integrations to compare the installed version against the minimum (defined inintegrations/__init__.py). The minimum versions are often three-part, e.g.(3, 1, 0).This means that we can mistakenly consider a valid version to be below the minimum, because in pure tuple terms,
(3, 1) < (3, 1, 0)is true.This can also happen in reverse (package version has three parts, while our min version boundary has two).
In this PR, we make the internal version comparison work as expected regardless of mismatches in the length of the version strings/tuples.