rollbar / pyrollbar

Error tracking and logging from Python to Rollbar
https://docs.rollbar.com/docs/python/
MIT License
213 stars 133 forks source link

Replace FastAPI pure str comparison with SemVer comparison #433

Closed ayharano closed 10 months ago

ayharano commented 1 year ago

Description of the change

This is a solution proposal for #432: the current FastAPI version comparison fails for version 0.100.0-beta2 because the lexicographic comparison of the string value fails because "1" is less than "4" even if the numerical value 100 is higher than 41.

Before:

ipdb> self.min_version
'0.41.0'
ipdb> fastapi.__version__
'0.100.0-beta2'
ipdb> fastapi.__version__ < self.min_version  # due to lexicographic comparison, not proper SemVer comparison
True

After:

ipdb> self.min_version
'0.41.0'
ipdb> fastapi.__version__
'0.100.0-beta2'
ipdb> not is_current_version_higher_or_equal(fastapi.__version__, self.min_version)
False

Type of change

Related issues

Shortcut stories and GitHub issues (delete irrelevant)

Checklists

Development

Code review

cforcey commented 11 months ago

Checking in on any progress getting this merged? We are a little stuck on upgrades to fast-api while Rollbar misinterprets their 100 version as < 0.41+. FastAPI 0.41.0+ is required to use add_to() function