Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto extend with Sanic Extensions #2308

Merged
merged 21 commits into from Dec 25, 2021
Merged

Auto extend with Sanic Extensions #2308

merged 21 commits into from Dec 25, 2021

Conversation

ahopkins
Copy link
Member

@ahopkins ahopkins commented Nov 9, 2021

This PR makes Sanic Extensions automatically setup when it is in the environment. This will make it much easier for anyone that wants to add this funcitonality:

pip install sanic[ext]

If a developer wishes to opt out of this behavior:

app.config.AUTO_EXTEND = False

The goal is to replace this pattern:

from sanic import Sanic
from sanic_ext import Extend

app = Sanic("MyHelloWorldApp")
Extend(app)

With this:

from sanic import Sanic

app = Sanic("MyHelloWorldApp")

Any configuration that would have occurred on the Extend object can now be done:

app.extend(...)

TODO

  • Support early usage of app.ext before it is setup
  • Fail gracefully when manually extended

@ahopkins ahopkins marked this pull request as ready for review November 15, 2021 18:52
@ahopkins ahopkins requested review from a team as code owners November 15, 2021 18:52
@codeclimate
Copy link

codeclimate bot commented Nov 15, 2021

Code Climate has analyzed commit 8cbdbe1 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 96.8% (86% is the threshold).

This pull request will bring the total coverage in the repository to 86.9% (0.3% change).

View more on Code Climate.

@ahopkins ahopkins added the needs review the PR appears ready but requires a review label Nov 15, 2021
@ahopkins ahopkins marked this pull request as draft November 17, 2021 10:27
@ahopkins ahopkins removed the needs review the PR appears ready but requires a review label Nov 17, 2021
@ahopkins ahopkins marked this pull request as ready for review November 23, 2021 17:01
@ahopkins ahopkins marked this pull request as draft November 25, 2021 07:27
@ahopkins ahopkins marked this pull request as ready for review December 18, 2021 22:07
@ahopkins ahopkins marked this pull request as draft December 18, 2021 22:34
@ahopkins ahopkins marked this pull request as ready for review December 19, 2021 20:59
@ahopkins ahopkins added the needs review the PR appears ready but requires a review label Dec 19, 2021
@ahopkins ahopkins merged commit dc3ccba into main Dec 25, 2021
@ahopkins ahopkins deleted the ext-integration branch December 25, 2021 20:20
ChihweiLHBird pushed a commit to ChihweiLHBird/sanic that referenced this pull request Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review the PR appears ready but requires a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant