Injector の仕様変更
Flask-Injector を使っていて以下の様な警告が出た。
Injector Modules (ie. configure) should not be injected. This can result in non-deterministic initialization. Support will be removed in the next release of Injector.
configure を直接注入するのはダメというのはどういう事かというと、注入の設定をしている箇所で以下の様にしている。
injector = init_app(app=app, modules=[configure]) post_init_app(app, injector) @inject(app=Flask) def configure(binder, app): pass
この modules=[configure] が次のバージョンからサポートされなくなるよう。
以下のようにする。
injector = init_app(app=app, modules=[MyModule]) post_init_app(app, injector) @inject(app=Flask) class MyModule(Module): def configure(self, binder): pass