Skip to content

Conversation

@julien-lang
Copy link
Contributor

No description provided.

@julien-lang julien-lang requested a review from Copilot October 9, 2025 18:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a deprecation warning for the init_engine method in the Engine class to notify users that it will be removed in future versions and should be replaced with pre_app_init.

  • Adds a deprecation warning that triggers when init_engine method is accessed
  • Implements the warning using __getattribute__ method override to intercept attribute access

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +298 to +307
def __getattribute__(self, attr):
if attr == "init_engine":
warnings.warn(
f"The method Engine.init_engine is deprecated and will be removed in future versions. "
f"Please use pre_app_init instead.",
DeprecationWarning,
)

return super().__getattribute__(attr)

Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

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

The __getattribute__ method is called for every attribute access on Engine instances, which could impact performance. Consider using a decorator on the init_engine method itself or checking if the attribute exists before issuing the warning to avoid unnecessary overhead for non-existent attributes.

Suggested change
def __getattribute__(self, attr):
if attr == "init_engine":
warnings.warn(
f"The method Engine.init_engine is deprecated and will be removed in future versions. "
f"Please use pre_app_init instead.",
DeprecationWarning,
)
return super().__getattribute__(attr)
# Removed __getattribute__ override. Deprecation warning will be added to init_engine.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants