pydantic / logfire

Uncomplicated Observability for Python and beyond! 🪵🔥
https://logfire.pydantic.dev/docs/
MIT License
1.96k stars 59 forks source link

Vendor Version logic from packaging #183

Closed Kludex closed 4 months ago

cloudflare-workers-and-pages[bot] commented 4 months ago

Deploying logfire-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: ea181d0
Status:🚫  Build failed.

View logs

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 51.26904% with 96 lines in your changes are missing coverage. Please review. Files Patch % Lines
logfire/_vendor/packaging/version.py 49.38% 72 Missing and 10 partials :warning:
logfire/_vendor/packaging/_structures.py 56.25% 14 Missing :warning:

:loudspeaker: Thoughts on this report? Let us know!

alexmojaki commented 4 months ago

I don't feel good about this. If we don't want to rely on other packages for version parsing then I'd rather find a different solution. For example:

version = '2.5.3'
parts = tuple(map(int, version.split('.')[:2]))
print(parts < (2, 6))
print(parts < (2, 5))

Parsing a full version requires accounting for betas and stuff (which might be easy enough for known packages like pydantic) but in this case we don't even need the full version, just the first two parts.