Commit Graph

36 Commits

Author SHA1 Message Date
Roman Mogylatov
47aa8c11fe Move Self provider docs to providers section 2021-02-09 07:34:46 -05:00
Roman Mogylatov
feed916f46
Async resources and injections (#352)
* Add support of async injections into wiring

* Add support of async functions and async generators for resources

* Update resource provider typing stub for stutdown

* Add resource base class for async resources

* Fix tests

* Add tests for async injections in wiring @inject

* Refactor provider tests

* Add tests for async resources

* Rework async resources callbacks to .add_done_callback() style (fixes pypy3 issue)

* Add awaits into async resource class test

* Refactor FastAPI tests

* Implement async resources initialization in container

* Move container async resource tests to a separate module for Python 3.6+

* Fix init async resources in container on Python 2

* Add first dirty async injections implementation

* Fix isawaitable error

* Turm asyncio import to conditional for safer Py2 usage

* Refactor kwargs injections

* Implement positional injections, add tests and make refactoring

* Implement attribute injections and add tests

* Add singleton implementation + tests for all singleton types

* Implement injections in thread-local and thread-safe singleton providers

* Update .provided + fix resource concurent initialization issue

* Implement async mode for Dependency provider

* Add async mode for the provider

* Add overload for Factory typing

* Add typing stubs for async resource

* Refactor abstract* providers __call__()

* Add async mode API + tests

* Add typing stubs & tests for async mode API

* Add tests for async mode auto configuration

* Refactor Provider.__call__() to use async mode api

* Refactor Dependency provider to use async mode api

* Add tests for Dependency provider async mode

* Add support of async mode for FactoryAggregate provider + tests

* Refactor Singleton provider to use async mode api

* Refactor ThreadSafeSingleton provider to use async mode api

* Refactor ThreadLocalSingleton provider to use async mode api

* Finish Singleton refactoring to use async mode api

* Refactor Resource provider to use async mode api

* Add Provider.async_() method + tests

* Add typing stubs for async_() method + tests

* Refactor Singleton typing stubs to return singleton from argument methods

* Refactor provider typing stubs

* Improve resource typing stub

* Add tests for async context kwargs injections

* Fix typo in resource provider tests

* Cover shutdown of not initialized resource

* Add test to cover resource initialization with an error

* Fix Singleton and ThreadLocalSingleton to handle initialization errors

* Add FastAPI + Redis example

* Make cosmetic fixes to FastAPI + Redis example

* Add missing development requirements

* Update module docblock in fastapi + redis example

* Add FastAPI + Redis example docs

* Add references to FastAPI + Redis example

* Refactor resource docs

* Add asynchronous resources docs

* Refactor wiring docs

* Add async injections docs for wiring

* Add async injections page and update docs index, readme, and key features pages

* Add providers async injections example

* Add docs on provider async mode enabling

* Reword async provider docs

* Add provider async mode docs

* Add cross links to async docs

* Mute flake8 errors in async provider examples

* Update changelog

* Make cosmetic fix to containers.pyx
2021-01-10 19:26:15 -05:00
Roman Mogylatov
47c79b2772
Resources (#312)
* Add prototype

* Add example

* Remove typing erros in Python 2.7 and 3.4

* Move resources example

* Draft resources docs

* Update resources docs

* Fix repr

* Rename dict provider test

* Add more tests

* Add tests + refactoring

* Add more tests

* Update tests to run only on 3.5+

* Update setup.py

* Add typing tests

* Update changelog

* Fix generator iteration

* Remove contextlib

* Hotfix aiohttp issue

* Move aiohttp fix to tox.ini

* Move aiohttp fix to a different place in tox
2020-10-24 20:56:32 -04:00
Roman Mogylatov
b54bcb7b31
Dict provider (#311)
* Add tests

* Add implementation and typing stubs

* Update README and docs pages

* Add example and docs

* Update changelog

* Add long description to the doc block
2020-10-22 14:49:39 -04:00
Roman Mogylatov
d8439a28b1
Make provider generic type (#293)
* Add __class_getitem__ for Provider to null the typing in runtime

* Make Provider stub generic and remove types module

* Update types module tests

* Return types module with deprecation warning

* Return types module with deprecation warning

* Update changelog

* Add docs page
2020-09-13 20:32:21 -04:00
Roman Mogylatov
505ccf5a1d Fix a few typos 2020-09-09 22:23:14 -04:00
Roman Mogylatov
c2426d2a09 Update providers index page 2020-09-02 21:17:25 -04:00
Roman Mogylatov
3eb7b9bc69 Add reference to provider overriding page 2020-09-02 17:25:20 -04:00
Roman Mogylatov
1ad852d193
Factory provider docs update (#287)
* Update index page

* Update providers index page

* Make a little wording fix on containers index page

* Refactor factory provider docs header

* Update factory injection docs

* Update factory init injections example and picture

* Start work on underlying providers

* Finish the docs for factory arguments to the underlying providers

* Edit providers delegation section

* Edit section about specialized factory provider

* Edit abstract factory section

* Edit FactoryAggregate docs

* Add meta keywords and description
2020-08-31 21:26:21 -04:00
Roman Mogylatov
cf862fe8b5
Provided attributes (#282)
* Add sketch

* Cythonize MethodCaller

* Cythonize ItemGetter, AttributeGetter & ProvidedInstance providers

* Add docblock for .provided attribute

* Refactor repr methods

* Add .provided attribute to the Dependency provider

* Add tests for the .provided attribute to the majority of the providers

* Add docblock for the ProvidedInstance provider

* Add docblocks for the rest of the providers

* Add example of the provided instance usage

* Add tests for provided instance* providers

* Add complex provided instance example

* Update example provided_instance.py

* Add docs
2020-08-20 21:52:12 -04:00
Roman Mogylatov
1674cecc8d
Flask tutorial (#265)
* Add a piece of the tutorial

* Add "Make it pretty" tutorial step

* Add section about github client setup

* Make minor fixes

* Add search service section + table of contents

* Make various fixes

* Make more fixes

* Update make the search section

* Update ghnav-flask example & README

* Update base.html markup

* Finish section: Make the search work

* Update ghnav-flask screenshot

* Update tutorials

* Add flaks tutorial link to the DI in Python page
2020-07-20 16:58:18 -04:00
Roman Mogylatov
2513d1f600
Selector provider (#258)
* Add Selector provider

* Add Selector provider example

* Add tests for selector provider

* Update changelog

* Add pydocstyle ignore D101 for examples

* Fix repr() test

* Update changelog

* Add D203,D213 to examples pydocstyle ignore

* Add selector provider docs
2020-06-29 16:32:12 -04:00
Roman Mogylatov
62e1995a7d Add configuration provider docs 2020-06-25 17:12:16 -04:00
Roman Mogylatov
2beafb9a51
List provider (#251)
* Add List provider

* Add List provider example

* Add List provider unit tests

* Add docs

* Upstream changes from develop

* Update API docs

* Update unit tests

* Add support of positional context argument injections

* Update changelog
2020-06-14 17:32:12 -04:00
Roman Mogylatov
9a785de4b5
Coroutine provider (#206)
* Add coroutine provider examples

* Add coroutine provier

* Update changelog

* Update static analysis travis jobs to python 3.7

* Update coroutine provider implementation for python 3.4

* Update static analysis travis jobs to python 3.6

* Make pycode style happy

* Add tests for coroutine providers

* Make coroutine tests python 2 syntax friendly

* Split tests to python2 and python3

* Refactor coroutine provider tests

* Modify pypy tests running command

* Update coroutine provider docs
2018-10-18 19:39:19 +03:00
Roman Mogylatov
c5d8032e95 Update docs & examples 2017-12-21 22:54:44 +02:00
Roman Mogilatov
bf00e5c0fa Update docs 2016-11-11 17:05:25 +02:00
Roman Mogilatov
486353bbea Update object provider docs 2016-06-09 17:49:09 +03:00
Roman Mogilatov
b5337fefa6 Update provider docs index page 2016-06-09 01:46:32 +03:00
Roman Mogilatov
c5518e0ec3 Update callable provider docs
+ Add providers class diagram
2016-06-09 01:43:25 +03:00
Roman Mogilatov
14ca5651df Update factory provider docs 2016-06-08 16:41:13 +03:00
Roman Mogilatov
319128260a Add DelegatedCallable, DelegatedFactory & DelegatedSingleton providers 2015-12-28 17:25:25 +02:00
Roman Mogilatov
8d0b82cf36 Update providers index docs page 2015-11-23 21:46:21 +02:00
Roman Mogilatov
1bfa0be26b 0.9.4 Release
Add minor documentation fixes
2015-09-04 10:17:13 +03:00
Roman Mogilatov
650ee014ec Implement thread-safety 2015-09-04 02:34:24 +03:00
Roman Mogilatov
20fc743a22 Updating index page of providers documentation 2015-07-28 01:31:19 +03:00
Roman Mogilatov
fd8be77635 Provider overriding first pages 2015-07-21 09:57:13 +03:00
Roman Mogilatov
2690d9b9d4 Adding docs for factories delegation 2015-07-20 18:46:45 +03:00
Roman Mogilatov
3b9d36f2d2 Adding fixes for ExternalDependecy provider docs 2015-07-17 10:01:27 +03:00
Roman Mogilatov
54eb60698b Reverting removing of Callable docs 2015-07-16 00:48:30 +03:00
Roman Mogilatov
295c6b56eb Removing of Callable provider docs 2015-07-15 16:15:45 +03:00
Roman Mogilatov
a612e42a99 First steps with providers delegation docs 2015-06-19 12:44:46 +03:00
Roman Mogilatov
e3ea517d72 Minor ExternalDependency provider updates, Adding ExternalDependency provider docs 2015-06-18 16:34:26 +03:00
Roman Mogilatov
7f439137d6 Adding callable provider docs and some minor changes to factory docs 2015-06-16 11:05:12 +03:00
Roman Mogilatov
91ea2a54f6 Adding static provider docs 2015-06-16 10:37:57 +03:00
Roman Mogilatov
3123574cf6 Changing provider docs structure 2015-06-10 09:53:15 +03:00