strawberry-graphql / strawberry

A GraphQL library for Python that leverages type annotations πŸ“
https://strawberry.rocks
MIT License
4.02k stars 533 forks source link

use graphql's built-in version object #3622

Closed bollwyvl closed 2 months ago

bollwyvl commented 2 months ago

Description

Alternative to to #3621.

Uses graphql.version.VersionInfo instead of packaging to do version sniffing instead of packaging (or even importlib.metadata.version, as that only provides strings).

That API has been there for five years, certainly above the current minimum dependency.

Types of Changes

Issues Fixed or Closed by This PR

Checklist

Summary by Sourcery

Use GraphQL's built-in VersionInfo for version checking instead of the packaging library, simplifying dependencies and ensuring compatibility with GraphQL core.

Bug Fixes:

Chores:

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.75%. Comparing base (4ada2cc) to head (30e90fb). Report is 5 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #3622 +/- ## ========================================== - Coverage 96.77% 96.75% -0.02% ========================================== Files 521 521 Lines 33731 33715 -16 Branches 5627 5622 -5 ========================================== - Hits 32643 32622 -21 - Misses 856 861 +5 Partials 232 232 ```
codspeed-hq[bot] commented 2 months ago

CodSpeed Performance Report

Merging #3622 will not alter performance

Comparing bollwyvl:gh-3621-use-graphql-versioning (30e90fb) with main (a1f3275)

Summary

βœ… 15 untouched benchmarks

sourcery-ai[bot] commented 2 months ago

Reviewer's Guide by Sourcery

This pull request updates the version checking mechanism for GraphQL in the Strawberry project. It replaces the use of the packaging library with GraphQL's built-in VersionInfo object for version comparison. This change simplifies the dependency structure and potentially improves performance.

File-Level Changes

Change Details Files
Replace packaging library with GraphQL's built-in VersionInfo for version checking
  • Import VersionInfo and version_info from graphql.version instead of using packaging.version
  • Replace Version(graphql.version) with version_info
  • Use VersionInfo.from_str() to create version object for comparison
  • Remove import of graphql module
strawberry/utils/__init__.py
Add release notes for the version checking update
  • Specify release type as patch
  • Describe the change in version checking mechanism
  • Mention the removal of dependency on the packaging package
RELEASE.md

Tips - Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request. - Continue your discussion with Sourcery by replying directly to review comments. - You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai): - Enable or disable the Sourcery-generated pull request summary or reviewer's guide; - Change the review language; - You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.
botberry commented 2 months ago

Thanks for adding the RELEASE.md file!

Here's a preview of the changelog:


This release updates how we check for GraphQL core's version to remove a dependency on the packaging package.

Here's the tweet text:

πŸ†• Release (next) is out! Thanks to Nicholas Bollweg for the PR πŸ‘

This release updates how we check for GraphQL core's version to remove a
dependency on the `packaging` package.

Get it here πŸ‘‰ https://strawberry.rocks/release/(next)
botberry commented 2 months ago

Thanks for contributing to Strawberry! πŸŽ‰ You've been invited to join the Strawberry GraphQL organisation 😊

You can also request a free sticker by filling this form: https://forms.gle/dmnfQUPoY5gZbVT67

And don't forget to join our discord server: https://strawberry.rocks/discord πŸ”₯