Skip to content

Remove deprecated Extension import alias#4210

Open
Ckk3 wants to merge 2 commits intostrawberry-graphql:mainfrom
Ckk3:deprecation/extension-alias
Open

Remove deprecated Extension import alias#4210
Ckk3 wants to merge 2 commits intostrawberry-graphql:mainfrom
Ckk3:deprecation/extension-alias

Conversation

@Ckk3
Copy link
Copy Markdown
Collaborator

@Ckk3 Ckk3 commented Feb 10, 2026

Description

Remove the deprecated Extension import alias from strawberry.extensions, deprecated since 0.160.0.

Migration guide

Before (deprecated):

from strawberry.extensions import Extension

class MyExtension(Extension):
    ...

After:

from strawberry.extensions import SchemaExtension

class MyExtension(SchemaExtension):
    ...

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Documentation

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

Summary by Sourcery

Remove deprecated Extension alias from the extensions module and document the change for release notes.

Enhancements:

  • Remove the deprecated Extension import alias in favour of SchemaExtension to complete the deprecation cycle.

Documentation:

  • Add release notes outlining the removal of the Extension alias and providing a migration guide.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Feb 10, 2026

Reviewer's Guide

Removes the deprecated Extension attribute alias from strawberry.extensions and adds a release note with a migration guide instructing users to import and subclass SchemaExtension directly.

File-Level Changes

Change Details Files
Remove dynamic Extension alias and its deprecation warning from the extensions package.
  • Delete the __getattr__ implementation that intercepted Extension accesses, emitted a DeprecationWarning, and returned SchemaExtension.
  • Rely on explicit exports via __all__ so Extension is no longer available from strawberry.extensions.
strawberry/extensions/__init__.py
Document the removal and provide a migration guide in release notes.
  • Add a new release note file declaring a minor release type.
  • Document that Extension imports from strawberry.extensions must be replaced with SchemaExtension, including before/after code examples.
RELEASE.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@Ckk3 Ckk3 self-assigned this Feb 10, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Feb 10, 2026

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing Ckk3:deprecation/extension-alias (486295e) with main (9c3bced)

Open in CodSpeed

@Ckk3 Ckk3 marked this pull request as ready for review February 15, 2026 19:40
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@botberry
Copy link
Copy Markdown
Member

Thanks for adding the RELEASE.md file!

Here's a preview of the changelog:


Remove deprecated Extension import alias from strawberry.extensions, deprecated since 0.160.0.

Migration guide

Before (deprecated):

from strawberry.extensions import Extension


class MyExtension(Extension): ...

After:

from strawberry.extensions import SchemaExtension


class MyExtension(SchemaExtension): ...

Here's the tweet text:

🆕 Release (next) is out! Thanks to Luis Gustavo for the PR 👏

Get it here 👉 https://strawberry.rocks/release/(next)

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 15, 2026

Greptile Summary

Removes the deprecated Extension import alias from strawberry.extensions, which was deprecated since v0.160.0. The module-level __getattr__ fallback that redirected Extension to SchemaExtension with a deprecation warning is deleted, along with the now-unused import warnings. Users must now import SchemaExtension directly. A release note with migration guide is included.

  • Removed __getattr__ function from strawberry/extensions/__init__.py that provided the deprecated ExtensionSchemaExtension alias
  • Removed unused import warnings statement
  • Added RELEASE.md with minor release type and clear migration instructions
  • No remaining references to the deprecated import exist in library source code or tests

Confidence Score: 5/5

  • This PR is safe to merge — it only removes a previously-deprecated alias with no remaining internal references.
  • The change is minimal, well-scoped, and only removes code that was explicitly deprecated since v0.160.0. No source files or tests in the repository use from strawberry.extensions import Extension. The release type (minor) is appropriate for a 0.x project removing deprecated functionality.
  • No files require special attention.

Important Files Changed

Filename Overview
strawberry/extensions/init.py Removes the module-level __getattr__ that provided the deprecated Extension alias, and the import warnings statement. Clean removal with no remaining references in source code.
RELEASE.md Adds release note with minor type and a migration guide showing how to replace the deprecated Extension import with SchemaExtension.

Flowchart

flowchart TD
    A["from strawberry.extensions import Extension"] -->|Before PR| B["__getattr__ intercepts"]
    B --> C["DeprecationWarning emitted"]
    C --> D["Returns SchemaExtension"]
    A -->|After PR| E["ImportError raised"]
    F["from strawberry.extensions import SchemaExtension"] -->|Both Before & After| G["Direct import succeeds"]
Loading

Last reviewed commit: 486295e

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@patrick91 patrick91 added this to the V1 milestone Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants