ashleysommer / sanic-plugin-toolkit

Easily create Plugins for Sanic!
MIT License
51 stars 9 forks source link

Deprecation of variables set on Sanic instances #19

Closed schneider8357 closed 3 years ago

schneider8357 commented 3 years ago

Python version: 3.9.2 Sanic version: 21.3.2 (latest)

UserWarning: Setting variables on Sanic instances is deprecated and will be removed in version 21.9. You should change your Sanic instance to use instance.ctx.handle_request instead.
UserWarning: Setting variables on Sanic instances is deprecated and will be removed in version 21.9. You should change your Sanic instance to use instance.ctx._run_request_middleware instead.
UserWarning: Setting variables on Sanic instances is deprecated and will be removed in version 21.9. You should change your Sanic instance to use instance.ctx._run_response_middleware instead.
ashleysommer commented 3 years ago

Hi, sorry, I thought I left a comment on this already. Yes I know about this issue. Yes I'm working on a fix. Unfortunately until sanic v21.6 releases with system-signals support, this is the way SPTK needs to inject itself into the sanic app.

These warnings are harmless. They only appear once, and don't affect the operation of Sanic nor the SPTK library.

I am however working a fix which would suppress these warnings in the meantime.

ashleysommer commented 3 years ago

Ok, good news. This is fixed in the v1.0.1 release of sanic-plugin-toolkit.

ashleysommer commented 3 years ago

Fixed by https://github.com/ashleysommer/sanic-plugin-toolkit/commit/8e8d183ca1fa4193d7e70b26f12fc0b1c9b3b5f2

schneider8357 commented 3 years ago

Awesome! Thanks.

comic31 commented 3 years ago

Thanks !