Compare commits

...

2043 Commits

Author SHA1 Message Date
ZipFile
6e4794bab1
Remove code for EOL Python versions (#864) 2025-03-02 14:33:31 +02:00
ZipFile
f3b3b1baa4 Merge branch 'release/4.46.0' into master 2025-02-25 15:14:15 +00:00
ZipFile
9b66d4bf16 Bump version to v4.46.0 2025-02-23 17:22:13 +00:00
ZipFile
7d4ebecd19
Add option to disable env var interpolation in configs (#861) 2025-02-23 19:01:01 +02:00
ZipFile
09efbffab1
Fix Closing dependency resolution (#852)
Co-authored-by: federinik <federico.tomasi@outlook.com>
Co-authored-by: jazzthief <mynameisyegor@gmail.com>
2025-02-23 18:31:34 +02:00
ZipFile
8b625d81ad
Use Annotated for DI in FastAPI examples (#853) 2025-02-23 18:21:31 +02:00
ZipFile
23acf01c15
Add support for inspect.iscoroutinefunction() in Coroutine provider (#830) 2025-02-23 18:20:38 +02:00
Martin Lafrance
0d6fdb5b78
Fix broken wiring of sync inject-decorated methods (#673)
Co-authored-by: Martin Lafrance <mlafrance@cae.com>
Co-authored-by: ZipFile <zipfile.d@protonmail.com>
2025-02-23 18:17:45 +02:00
Taein Min
2330122de6
Add support for typing.Annotated (#721) 2025-01-20 17:37:28 +02:00
ZipFile
29ae3e1337 Make flake8 config black-compatible 2025-01-18 17:39:07 +00:00
ZipFile
50643e0dfb Run black 2025-01-18 17:02:55 +00:00
ZipFile
3893e1df81 Use native GHA ubuntu-24.04-arm image for building wheels 2025-01-16 19:15:49 +00:00
ZipFile
0fd35baee6 Use ubuntu-24.04 GHA image 2025-01-16 19:13:11 +00:00
Ilya Kazakov
3df95847d5
[movie-lister] Added test fixture and updated documentation (#747)
* test: add fixture for finder mock

* docs: update tests code example, emphasize-lines & test coverage report results
2025-01-12 15:46:29 +02:00
ZipFile
6d9d34c0f6 Add test case for Provider.provider type propagation 2025-01-12 12:18:21 +00:00
Philip Bjorge
de50666a13
fix: type provider (#744) 2025-01-12 14:14:12 +02:00
ZipFile
ccbd5bbb80 Migrate CI pipeline to actions/upload-artifact@v4 2025-01-08 13:07:04 +00:00
Philip Bjorge
00326e9a22
fix: type propogation through provided (#733)
Co-authored-by: Gonzalo Martinez <gonzarmv@gmail.com>
2025-01-08 13:31:00 +02:00
Roman Mogylatov
46646b1acf Merge branch 'release/4.45.0' into master 2025-01-05 15:20:12 -05:00
Roman Mogylatov
9f38db6ef3 Bump version to 4.45.0 2025-01-05 15:19:57 -05:00
Roman Mogylatov
9f4e2839d2
Remove unused imports from the starlette extension (#846) 2025-01-05 14:57:55 -05:00
ZipFile
41e18dfa90
Add Starlette lifespan handler implementation (#683) 2025-01-05 14:39:26 -05:00
František Trebuňa
f9db578c59
🎨 Raise exception instead of hiding it in finally (#845) 2025-01-05 14:33:09 -05:00
ZipFile
d82d9fb822
Improve debugability of deepcopy errors (#839) 2025-01-01 21:22:29 +02:00
ZipFile
3ba4704bc1 Remove six 2024-12-14 13:24:28 +00:00
JC (Jonathan Chen)
aa56b70dc8
docs: fix grammar (#709) 2024-12-09 10:54:30 +02:00
ZipFile
7f586246b4
Update examples (#838) 2024-12-08 18:53:29 +02:00
ZipFile
87741edb53
Upgrade testing deps (#837) 2024-12-08 18:53:08 +02:00
Roman Mogylatov
be7abb3ec7 Merge branch 'release/4.44.0' into master 2024-12-07 13:44:32 -05:00
ZipFile
15400dea7d
Fix sdist build for publishing (#836) 2024-12-07 13:42:27 -05:00
Roman Mogylatov
704e36a642 Merge branch 'release/4.44.0' into master 2024-12-07 11:52:05 -05:00
Roman Mogylatov
83d71acb70 Bump version to 4.44.0 2024-12-07 11:51:44 -05:00
ZipFile
c61fc16b8d
Yet another Pydantic 2 support (#832)
* Add support for Pydantic v2 settings

* Configure pipeline to run tests against different pydantic versions

* Update Pydantic docs and examples for v2

* Fix compatibility with httpx v0.27.0
2024-12-07 11:38:08 -05:00
Roman Mogylatov
cab75cb9c7 Update changelog 2024-11-10 00:05:25 -05:00
ZipFile
494c457643
PEP-517 (#829)
* Convert to PEP-517 project

* Move pylint and coverage configs to pyproject.toml

* Remove autogenerated C files
2024-11-10 00:01:30 -05:00
Roman Mogylatov
abf2a2577c Merge branch 'release/4.43.0' into master 2024-11-04 00:03:25 -05:00
Roman Mogylatov
3777a947ea Update version to 4.43.0 2024-11-04 00:02:52 -05:00
Roman Mogylatov
c92129dcb0
Add support for Python 3.13 (#828)
* Update tests pipeline and setup.py

* Update tox coverage command

* Add setuptools to the dev requirements file

* Enforce coverage version in tox

* Leave coveralls CI/CD job on Python 3.12 because coveralls 4.0.1 doesn't support Python 3.13

* Update changelog and publishing jobs
2024-11-04 00:01:28 -05:00
Roman Mogylatov
37486900cd Add ZipFile to the list of contributors and update changelog 2024-11-03 21:01:45 -05:00
Roman Mogylatov
9071583981 Pin Cython version 2024-11-03 20:55:53 -05:00
ZipFile
595daebd3a
Migrate to Cython3 (#813)
* Fix asyncio tests

* Convert class-private attributes to just private

* Upgrade to Cython 3

* Regenerate C files

* Fix tox coverage report
2024-11-03 20:48:40 -05:00
Roman Mogylatov
13a7ef609b Merge branch 'release/4.42.0' into master 2024-09-09 22:24:12 -04:00
Roman Mogylatov
7a88a8ee8d Update version 2024-09-09 22:23:27 -04:00
Roman Mogylatov
938091b6ea Add Github Sponsors button 2024-09-09 22:23:19 -04:00
Roman Mogylatov
4bda5105c2 Remove obsolete disqus javascript file 2024-09-09 22:22:09 -04:00
Roman Mogylatov
46034cbeb1 Update the copuright in the docs 2024-09-09 21:53:37 -04:00
Roman Mogylatov
39ac098ca2 Fix the Disqus comment widget 2024-09-09 21:52:11 -04:00
Roman Mogylatov
f54604fc14 Fix the bug in the docs step of the publishing job 2024-08-08 21:29:02 -04:00
Roman Mogylatov
2c998b8448 Merge branch 'release/4.42.0b1' into master 2024-08-07 22:11:07 -04:00
Roman Mogylatov
5697f1d5d8 Update macos version in the publishing job 2024-08-07 22:10:03 -04:00
Roman Mogylatov
086d82f13d Merge branch 'release/4.42.0b1' into master 2024-08-07 21:22:25 -04:00
Roman Mogylatov
3375436eb3 Remove Python 3.13 builds from the publishing job 2024-08-07 21:21:36 -04:00
Roman Mogylatov
fec2b08210 Merge branch 'release/4.42.0b1' into master 2024-08-07 21:04:56 -04:00
Roman Mogylatov
8a44027f3d Update cibuildwheel to version 2.20.0 2024-08-07 21:04:37 -04:00
Roman Mogylatov
f56453f59f Merge branch 'release/4.42.0b1' into master 2024-08-07 20:51:40 -04:00
Roman Mogylatov
1b9e079524 Add explicit setuptools installation to the publishing job 2024-08-07 20:48:41 -04:00
Roman Mogylatov
b1a3a69428 Merge branch 'release/4.42.0b1' into master 2024-08-06 22:52:17 -04:00
Roman Mogylatov
a8b54423dc Update version to 4.42.0b1 2024-08-06 22:51:59 -04:00
Roman Mogylatov
3e56fef461 Update version to 4.42.0b 2024-08-06 22:45:40 -04:00
Roman Mogylatov
5d1e5ee485 Update the year in the licensing file 2024-08-06 22:45:21 -04:00
Roman Mogylatov
f7c6cb2647 Add Anton Petrov to CONTRIBUTORS.rst 2024-08-06 22:44:57 -04:00
Roman Mogylatov
a5166bf591
Add Python 3.12 Support (#752) (#765)
* Add Python 3.12 Support (#752)

* Ignore .vscode

* Python 3.12 Support

* Change base python to 3.12 and pin pydantic to V1

* all tests passed

* ci: change default python to 3.12

* remove legacy python versions

* annotate pydantic models for tests

* Update publishing pipeline to use Python 3.12

* Test environment updates

* Update Cython to the latest prior 3.0 version and remove tracing from CI/CD

* Give up using editable tox installation in the coverage job

* Add mypy test fixes

* Remove tracing from the coverage job

* Fix typing test

* Remove PyPy 2.7

* Fix typing test

* Fix the typing issue with pydantic

* Remove pypy 3.9

* Fix the typing issue with mypy

* Update pydantic version to the latest from 1.x

* Update scipy deprecation warning filter

* Fix the tox job running coveralls

* Update changelog

---------

Co-authored-by: Anton Petrov <anton.a.petrov@gmail.com>
2024-08-06 22:41:24 -04:00
Roman Mogylatov
98d5867743 Add a link to my profile (#806) 2024-08-06 21:28:50 -04:00
Roman Mogylatov
68da747ce0
Add a link to my profile (#806) 2024-08-06 21:27:23 -04:00
Roman Mogylatov
cc2304e46e Merge branch 'release/4.41.0' into master 2022-12-18 22:14:24 -05:00
Roman Mogylatov
4bfdf89142 Bump version 2022-12-18 22:14:00 -05:00
Roman Mogylatov
659d242503 Update builds badge 2022-12-18 22:12:38 -05:00
Roman Mogylatov
6b13b6dbaf Update line length to 120 2022-12-18 22:04:03 -05:00
Roman Mogylatov
d3320f5f06 Fix typing in wiring 2022-12-18 22:02:11 -05:00
Roman Mogylatov
31c1f7c2d6 Update setup.py 2022-12-18 21:59:31 -05:00
Roman Mogylatov
d0c8f328b3 Update changelog 2022-12-18 21:52:32 -05:00
Jamie Stumme
3b76a0d091
Allow Closing to detect dependent resources (#636) 2022-12-18 21:49:23 -05:00
Roman Mogylatov
a79ea1790c Update custom provider docs formatting 2022-12-18 21:43:02 -05:00
Kirill Shershen
781d3b9c4c
fixed bug in windows build with default charset (#635)
Co-authored-by: kirill-shershen <kirill.shershen@alao.ch>
2022-12-18 21:42:23 -05:00
thatguysimon
6f491a6cae
Explicitly mention the required usage of "memo" (#598) 2022-12-18 21:38:12 -05:00
Roman Mogylatov
88a2b96102 Update FastAPI + Redis example 2022-12-18 21:35:43 -05:00
Yan
f0d9eda566
Update aioredis to 2.0.1 (#613)
* Update aioredis to 2.0.1

* Rearranged aioredis.from_url parameters
2022-12-18 21:27:36 -05:00
Roman Mogylatov
55f81bd754 Update changelog 2022-12-18 21:25:16 -05:00
Eugene Brodsky
a9cd0de886
(setup) fix install crash on non-utf8 systems (#644)
fixes https://github.com/ets-labs/python-dependency-injector/issues/643
2022-12-18 21:23:24 -05:00
Roman Mogylatov
aaff333f01
Python 3.11 Support (#647)
* Update tests

* Enable tests on 3.11

* Fix coverage config in tox.ini

* feat: re cythonize to support python 3.11 (#646)

* feat: re cythonize to support python 3.11

* misc: added tox env for python 3.11

* misc: add classifiers for python 3.11

* fix: skip tests for removed functions

* misc: CI updates for python 3.11

Co-authored-by: Roman Mogylatov <rmogilatov@gmail.com>

* Update tests and linters job

* Update test skip decorators

* Fix tox.ini

* Update 3.10 to be explicit string literal

* Move pypy3 to legacy job

* Fix error in resourse typing test

* Update publishing job

* Update actions and setup-python versions

* Update changelog

* Update pypy

* Update tox.ini with new pypy versions

* Update publishing job

* Update actions/upload-artifact@v3

* Update ubuntu to 22.04 on docs publishing job

* Update actions/download-artifact@v3 and pypa/gh-action-pypi-publish@release/v1

Co-authored-by: Gen Xu <xgbarry@gmail.com>
2022-12-18 21:09:14 -05:00
Roman Mogylatov
3858cef657 Merge branch 'release/4.40.0' into master 2022-08-03 21:20:52 -04:00
Roman Mogylatov
8cf86826eb Bump version to 4.40.0 2022-08-03 21:20:38 -04:00
Roman Mogylatov
6f859e4aa2
(#454) (#597) Fix @inject + @wraps, refactor patched callables registry and injections storage principles (#610)
* Refactor patched callables registry and injections storage principles

* Rename properties of PatchedRegistry

* Add typing improvements in wiring module

* Add __slots__ for PatchedAttribute

* Minor code style fixes

* Add test

* Rename test

* Update typing in test

* Make minor style fixes to test

* Update changelog

* Add documentation on the @inject decorator
2022-07-26 21:37:15 -04:00
Roman Mogylatov
0668295543 Fix code layout in tests/unit/schema/test_integration_py36.py 2022-07-19 20:33:43 -04:00
Roman Mogylatov
142b91921a
Upgrade Cython to 0.29.30 (#605) 2022-07-10 21:23:25 -04:00
Roman Mogylatov
753e863d02
Add `Configuration.from_json()` method (#602)
* Add implementation and tests

* Refactor naming in configuration fixtures

* Add typing for .from_json()

* Move get/set_ini_files() methods upper

* Add init implementation and tests

* Refactor typing tests

* Add examples

* Add docs

* Update docs index and readme

* Update changelog
2022-07-10 21:08:45 -04:00
Roman Mogylatov
14b5ddae4f Update pytest configuration 2022-07-02 15:11:25 -04:00
Roman Mogylatov
bf356ec565 Update wording in introduction docs 2022-04-17 10:55:17 -04:00
Roman Mogylatov
9bc11a7828 Improve wording in docs 2022-04-16 22:29:19 -04:00
Roman Mogylatov
a0bb7c4ede Update changelog 2022-04-16 21:46:01 -04:00
Roman Mogylatov
450407bf7a Update year 2021 -> 2022 2022-04-16 21:39:47 -04:00
Roman Mogylatov
4666a15092 Update copyright year 2022-04-16 21:35:03 -04:00
Illia Volochii
daca85d555
Fix a few issues in the introduction (#580)
* Fix a statement about coupling and cohesion that is not always true

https://enterprisecraftsmanship.com/posts/cohesion-coupling-difference/#_types_of_code_from_a_cohesion_and_coupling_perspective

* Fix a typing issue in an example

`ApiClient` expects timeout to be an integer (based on a type hint), but `os.getenv` returns a string when `TIMEOUT` is set.

* Specify the `None` return type where it is missed

* Fix typing issues in some other places

* Edit a statement about coupling and cohesion

Co-authored-by: Roman Mogylatov <rmogilatov@gmail.com>

Co-authored-by: Roman Mogylatov <rmogilatov@gmail.com>
2022-04-16 21:29:35 -04:00
Roman Mogylatov
20bf3c0a01 Pin jinja2 2022-03-30 00:14:25 -04:00
Roman Mogylatov
4188f721d6 Merge branch 'release/4.39.1' into master 2022-03-29 22:52:00 -04:00
Roman Mogylatov
cfed30cf07 Hotfix issue #574, bump version to 4.39.1 2022-03-29 22:51:40 -04:00
Roman Mogylatov
13cae77d57 Fix docs publishing error "The unauthenticated git protocol on port 9418 is no longer supported." 2022-03-28 00:33:48 -04:00
Roman Mogylatov
8b0745d43e Merge branch 'release/4.39.0' into master 2022-03-27 22:22:02 -04:00
Roman Mogylatov
93c8cbc83b Bump version to 4.39.0 2022-03-27 22:21:51 -04:00
Roman Mogylatov
77b5cdebd3
Optimization r1 (#571)
* Add isfuture() and iscoroutine() optimization

* Apply async mode optimization

* Wiring changes

* Add optimization for wiring of async coroutines

* Remove unused imports

* Update changelog

* Refactor async mode checks
2022-03-27 22:20:05 -04:00
Roman Mogylatov
f0c55cda22 Fix a typo 2022-03-27 14:23:35 -04:00
Roman Mogylatov
f00fa16bd0 Update changelog 2022-03-27 14:23:27 -04:00
Roman Mogylatov
c2877777af Refactor + add tests to #569 2022-03-27 14:18:46 -04:00
Vlad Fisher
8fe00bcff0
569 fix numpy typing wiring (#570)
* change erroneous issubclass call to isinstance

* import numpy.typing in tests

* better subclass check

* fix return
2022-03-27 14:11:04 -04:00
Roman Mogylatov
c26b260c73 Merge branch 'release/4.38.0' into master 2022-01-30 23:28:11 -05:00
Roman Mogylatov
ad0d430229 Bump version to 4.38.0 2022-01-30 23:27:58 -05:00
Roman Mogylatov
0235d68265 Refactor string imports 2022-01-30 23:19:09 -05:00
Roman Mogylatov
86df7f91f6
531 Provider import from string (#555)
* Implement string imports for Factory, Callable, Singletons, and Resource

* Refactor the implementation

* Add tests

* Update tests to pass on Python 2

* Update typing and add typing tests

* Update changelog

* Update docs
2022-01-30 23:16:55 -05:00
Roman Mogylatov
38ca1cdeed Fix #550 2022-01-28 23:12:08 -05:00
Roman Mogylatov
8dc3dd2f09 Update quotes in Cython and Python modules 2022-01-16 20:32:42 -05:00
Roman Mogylatov
a38ca647c3 Update quotes in typing stubs 2022-01-16 19:46:18 -05:00
Roman Mogylatov
d4933baec1 Update logo, v4 2022-01-16 18:39:36 -05:00
Roman Mogylatov
742e73af1a
Aggregate provider (#544)
* Add implementation and typing stubs

* Add tests

* Add typing tests

* Refactor FactoryAggregate

* Update changelog

* Add Aggregate provider docs and example

* Update cross links between Aggregate, Selector, and FactoryAggregate docs

* Add wording improvements to the docs
2022-01-09 21:45:20 -05:00
Roman Mogylatov
cfadd8c3fa
Add config.from_env(as_=...) (#541)
* Add implementation and typing stub

* Add unit tests

* Update demo example

* Add typing tests

* Update changelog

* Update docs

* Add tests for an empty environment variable

* Improve wording in di_in_python.rst

* Update wording in changelog and docs

* Update doc blocks
2021-12-20 23:46:51 +01:00
Roman Mogylatov
cc17052acc Fix mypy issues 2021-11-29 00:13:17 +02:00
Roman Mogylatov
7238482402 Add .providers attribute and .set_providers() method to FactoryAggregate provider 2021-11-26 19:50:19 +03:00
Roman Mogylatov
541131e338 Merge branch 'release/4.37.0' into master 2021-10-31 21:12:54 -04:00
Roman Mogylatov
72d0e2610d Add announce of Python 3.5 support dropping 2021-10-31 21:00:28 -04:00
Roman Mogylatov
0b3bcf334e Bump version to 4.37.0 2021-10-31 20:50:16 -04:00
Roman Mogylatov
99d858e2fb Upgrade Cython to 0.29.24 2021-10-31 20:48:23 -04:00
Roman Mogylatov
fe01ad41d9
Update examples to use config __init__ args (#527)
* Update application-single-container example

* Update application-multiple-containers example

* Update decoupled-packages example

* Update movie lister example

* Update CLI tutorial

* Update sanic example

* Update sanic example with wiring_config

* Update fastapi example

* Update fastapi-simple example

* Update fastapi-sqlalchemy example

* Update flask-blueprints example

* Update flask example and tutorial

* Update aiohttp example and tutorial

* Update asyncio-daemon example and tutorial
2021-10-31 20:31:39 -04:00
Roman Mogylatov
6030950596
Configuration(pydantic_settings=[...]) (#525)
* Add implementation

* Update changelog

* Fix deepcopy()

* Add example

* Add tests

* Add docs
2021-10-26 21:08:47 -04:00
Roman Mogylatov
34902db86e
Configuration(ini_files=[...]) (#524)
* Update changelog

* Add implementation

* Add tests

* Add more tests and example

* Update changelog

* Update documentation
2021-10-26 20:27:11 -04:00
Roman Mogylatov
b16b190ff7
Configuration(yaml_files=[...]) (#522)
* Add provider changes and tests

* Move config test fixtures

* Fix issue with explicit providing of envs_required=False for configuration from_*()

* Implement container API

* Increase priority of overriding from context

* Add docs and example

* Update changelog

* Update changelog
2021-10-23 21:46:50 -04:00
Roman Mogylatov
b97862cb9f
Python 3.10 (#520)
* Add GA test and linter jobs

* Remove not used async run() functions from tests

* Update aiohttp ext test

* Add botocore warning ignores

* Update changelog

* Update publishing job config for testing

* Publishing test #1

* Update GA tests-and-linters job to use latest ubuntu for tests

* Update publishing GA job
2021-10-20 12:10:05 -04:00
Roman Mogylatov
94aca21fb8
Pytest migration (#519)
* Add pytest and pytest-asyncio to the requirements

* Update aiohttp ext test

* Update setup.cfg

* Update tox.ini

* Add pytest to the tox requirements

* Update tox.ini

* Move configuration to tox.ini

* Add pytest configs

* Rename pytest-py34-py35.ini -> pytest-py35.ini

* Update config file paths

* Update makefile

* Migrate common tests to pytest

* Migrate FastAPI and Flask wiring tests

* Rename flask and fastapi wiring test files

* Move wiring autoloader tests

* Add pytest-asyncio to the tox.ini

* Migrate wiring async injection tests

* Migrate main wiring tests

* Migrate wiring string module and package names tests

* Migrate wiring config tests

* Migrate misc wiring tests

* Update tests structure

* Migrate misc wiring tests

* Refactor container.from_schema() API tests

* Migrate container.from_schema() integration tests

* Rename schema samples

* Update sample imports

* Migrate container tests

* Refactor container tests

* Migrate container self tests

* Migrate container instance tests

* Migrate container custom string attribute name tests

* Migrate container async resource tests

* Fix py2 container tests

* Migrate container cls tests

* Migrate container class custom string cls as atrribute name tests

* Migrate ext.aiohttp tests

* Migrate ext.flasks tests

* Update ext package tests doc block

* Migrate provider utils tests

* Migrate Factory async mode tests

* Migrate async tests

* Rename common test module

* Refactor asserts in provider tests

* Migrate factory tests

* Migrate selector provider tests

* Migrate object provider tests

* Migrate self provider tests

* Migrate delegate provider tests

* Migrate provider tests

* Migrate dependency provider tests

* Migrate dependencies container provider tests

* Fix warnings

* Migrate list provider tests

* Migrate dict provider tests

* Migrate callable tests

* Migrate injection tests

* Migrate container provider tests

* Migrate coroutine providers

* Migrate traversal tests

* Migrate resource tests

* Migrate configuration tests

* Migrate provided instance provider tests

* Update doc blocks and imports

* Migrate singleton tests

* Update changelog and cosmetic fixes
2021-10-18 16:19:03 -04:00
Roman Mogylatov
4cc4ca9188
Drop Python 3.4 support (#518)
* Update gitignore

* Drop Python 3.4 support

* Update change log

* Fix typo in changelog
2021-10-12 12:16:49 -04:00
Roman Mogylatov
284dee6e58
Add with support for container.override_providers() (#517)
* Add implementation, tests, and typing stub

* Update documentation

* Update changelog
2021-10-06 21:36:41 -04:00
Roman Mogylatov
73a43e6191
Wiring config (#516)
* Implement POC

* Implement concept with WiringConfiguration object

* Update changelog

* Add docs

* Update changelog
2021-10-03 20:35:48 -04:00
Roman Mogylatov
08ea99759d Update versions 2021-09-30 20:36:42 -04:00
Roman Mogylatov
f82a6b5445 Update versions in the docs 2021-09-30 20:18:23 -04:00
Roman Mogylatov
1e198a3ebd Add disqus comments to typing docs page 2021-09-30 20:15:57 -04:00
Roman Mogylatov
4f977c7cf0 Update quotes in docs conf 2021-09-30 20:13:26 -04:00
Roman Mogylatov
8ade2b7839 Update quotes in tests 2021-09-30 20:09:42 -04:00
Roman Mogylatov
0b1e214135 Fix flast wiring test 2021-09-30 19:32:18 -04:00
Roman Mogylatov
98f036e14c Update quotes in the docs 2021-09-30 19:26:04 -04:00
Roman Mogylatov
023d766267 Update django example 2021-09-30 19:19:34 -04:00
Roman Mogylatov
196d86f4b3 Update quotes in factory-patterns example 2021-09-30 19:09:47 -04:00
Roman Mogylatov
6b4c7e50b5 Update fastapi-simple example 2021-09-30 19:08:49 -04:00
Roman Mogylatov
3c52756d3f Update quotes in fastapi-sqlalchemy example 2021-09-30 19:05:57 -04:00
Roman Mogylatov
274d1fe53b Update quotes in password-hashing example 2021-09-30 19:02:23 -04:00
Roman Mogylatov
8bea62eeee Update quotes in use-cases example 2021-09-30 19:01:31 -04:00
Roman Mogylatov
b64c9b7a05 Update sanic example 2021-09-30 18:59:09 -04:00
Roman Mogylatov
31bed0651f Update sanic example 2021-09-30 18:56:29 -04:00
Roman Mogylatov
e670377bb3 Update quotes in fastapi example 2021-09-30 16:55:50 -04:00
Roman Mogylatov
a9173496b4 Update quotes in commands-and-handlers example 2021-09-30 16:53:27 -04:00
Roman Mogylatov
02b9793189 Fix boto3 example 2021-09-30 16:02:49 -04:00
Roman Mogylatov
4a52595a9d Update quotes in boto3 example 2021-09-30 15:57:34 -04:00
Roman Mogylatov
c92a941fe5 Update quotes in flask tutorial and example 2021-09-30 15:55:10 -04:00
Roman Mogylatov
7e794c41dd Update quotes in aiohttp tutorial 2021-09-30 15:44:15 -04:00
Roman Mogylatov
93dad6bbd0 Update quotes in aiohttp example 2021-09-30 15:37:21 -04:00
Roman Mogylatov
320d837bea Update quotes in provider examples 2021-09-30 15:32:21 -04:00
Roman Mogylatov
d827f93816 Update quotes in container examples 2021-09-30 15:16:17 -04:00
Roman Mogylatov
b3732281a1 Update changelog 2021-09-30 15:08:22 -04:00
Roman Mogylatov
7d160cb4a5
Wiring with string module names (#515)
* Update main example

* Updating wiring module

* Update wiring test case name

* Implement string imports for wiring

* Update example

* Refactor implementation

* Update front example

* Fix a typo in README

* Update wiring docs

* Update single container example

* Update multiple containers example

* Update quotes in multiple containers example

* Update quotes in single container example

* Update decoupled-packages example

* Update single and multiple containers example

* Update quotes

* Update fastapi+redis example

* Update resource docs

* Update quotes in CLI tutorial

* Update CLI application (movie lister) tutorial

* Update monitoring daemon example

* Update python version in asyncio daemon example

* Update asyncio daemon tutorial

* Update quotes in wiring docs

* Update wiring docs
2021-09-30 15:03:19 -04:00
Roman Mogylatov
258c55dd22 Merge branch 'release/4.36.2' into master 2021-09-28 14:59:28 -04:00
Roman Mogylatov
0b5987bf84 Bump version to 4.36.2 2021-09-28 14:59:11 -04:00
Roman Mogylatov
cf039a0c2b Merge branch 'release/4.36.1' into master 2021-09-28 14:51:54 -04:00
Roman Mogylatov
980914c2f7 Bump version to 4.36.1 2021-09-28 14:51:39 -04:00
Roman Mogylatov
5c7bdf4fc6 Update docs author 2021-09-28 14:50:45 -04:00
Roman Mogylatov
4733aad44e
Fix provide issue (#514) 2021-09-25 15:36:48 -04:00
Roman Mogylatov
d8aa70c70b
Update changelog.rst 2021-09-16 12:55:14 -04:00
whysage
8377f2a82d
Fix boto3 url (#511) 2021-09-16 12:52:58 -04:00
Roman Mogylatov
cc4235257c Update changelog 2021-09-12 20:15:03 -04:00
Rajan Jha
ff5b81fecb
Fixed a typo in Factory provider docs "service.add_attributes(clent=client)" #499 (#504) 2021-09-12 20:10:25 -04:00
Roman Mogylatov
cef6d35cfd Merge branch 'release/4.36.0' into master 2021-08-25 12:06:37 -04:00
Roman Mogylatov
902913ccff Bump version to 4.36.0 2021-08-25 12:06:22 -04:00
Roman Mogylatov
14d8ed909b
FactoryAggregate - non string keys (#496)
* Improve FactoryAggregate typing stub

* Add implementation, typing stubs, and tests

* Update changelog

* Fix deepcopying

* Add example

* Update docs

* Fix errors formatting for pypy3
2021-08-25 10:20:45 -04:00
Roman Mogylatov
6af818102b Update list of contributors 2021-08-23 21:27:24 -04:00
Roman Mogylatov
e0825041b0 Update changelog 2021-08-23 21:25:32 -04:00
Thiago Hiromi
b4df3dd2c9
Fix type annotations for .provides (#491)
* Fix type annotations for .provides

* Fix type hinting for .provides

as @rmk135 suggested
2021-08-23 21:24:36 -04:00
Roman Mogylatov
cf2861c4b4 Update changelog 2021-08-23 21:14:22 -04:00
Roman Mogylatov
49e2cc75c2 Make #492 follow-up fix of configuration provider docs for environment variables interpolation 2021-08-23 21:07:58 -04:00
Felipe Rubio
eda67e42d0
Fix yaml configuration-envs-interpolation examples (#494)
the interpolation of the environment variables in yaml is wrong, I have changed the example from {$ ENV_VAR} to $ {ENV_VAR}
2021-08-23 21:01:45 -04:00
Roman Mogylatov
ea9aa2370e Update changelog 2021-08-23 21:00:47 -04:00
Roman Mogylatov
36bfd2ed58
Improve resource subclasses typing and make shutdown definition optional (#492)
* Improve resource subclasses typing and make shutdown definition optional

* Update mypy tests
2021-08-23 20:54:17 -04:00
Roman Mogylatov
83c2af0e7e Fix resource subclass abc tests on Python 3.7 2021-08-16 18:27:42 -04:00
Roman Mogylatov
1163ac59d4 Return ABCMeta class for resource classes and add tests for abc 2021-08-16 18:19:40 -04:00
Roman Mogylatov
4286013ca0
Remove generic meta class from resource and async resource classes (#490)
* Remove generic meta class from resource and async resource classes

* Add link to the issue into the tests

* Update changelog
2021-08-16 10:05:50 -04:00
Roman Mogylatov
48df949cd5 Merge branch 'release/4.35.3' into master 2021-08-11 21:25:25 -04:00
Roman Mogylatov
9637d97d48 Bump version to 4.35.3 2021-08-11 21:25:18 -04:00
Roman Mogylatov
c4639e555e Add typing fix for container.override_providers() 2021-08-11 21:24:34 -04:00
Roman Mogylatov
7b19fa0964
477 Containers @copy fix and refactoring (#485)
* Rename local variables

* Make code layout enhancements

* Add fix and tests

* Add more refactoring

* Update changelog
2021-08-11 21:18:37 -04:00
Roman Mogylatov
cde7dee4b3 Merge branch 'release/4.35.2' into master 2021-08-06 16:50:53 -04:00
Roman Mogylatov
5acde87a6e Bump version to 4.35.2 2021-08-06 16:50:42 -04:00
Roman Mogylatov
7bdcc33eda Update wiring to support modules provided as packages 2021-08-06 15:56:24 -04:00
Roman Mogylatov
b4ddf61939 Merge branch 'release/4.35.1' into master 2021-08-05 17:05:43 -04:00
Roman Mogylatov
f376628dfa Bump version to 4.35.1 2021-08-05 17:05:17 -04:00
Roman Mogylatov
384117db9c Update declarative container to support custom string types 2021-08-05 17:01:53 -04:00
Roman Mogylatov
06f9855140
Update types and add tests (#480) 2021-08-05 16:52:08 -04:00
Roman Mogylatov
547b7fd844 Merge branch 'release/4.35.0' into master 2021-07-29 16:41:36 -04:00
Roman Mogylatov
04117938d2 Bump version to 4.35.0 2021-07-29 16:41:23 -04:00
Roman Mogylatov
c23a48c28e Update six upper bound to 1.16.0 2021-07-29 16:18:45 -04:00
Roman Mogylatov
98a4b06a12 Merge branch 'release/4.34.2' into master 2021-07-24 16:35:10 -04:00
Roman Mogylatov
c19969a6ed Bump version to 4.34.2 2021-07-24 16:33:16 -04:00
Roman Mogylatov
aa251a44ba Fix reverse shutdown order bug in container.shutdown_resources() 2021-07-24 16:32:44 -04:00
Roman Mogylatov
f44924f285 Merge branch 'release/4.34.1' into master 2021-07-20 18:48:39 -04:00
Roman Mogylatov
a126df4764 Bump version to 4.34.1 2021-07-20 18:48:23 -04:00
Roman Mogylatov
3d1bb5d7b3
432 resource shutdown order (#473)
* Add PoC

* Add tests for init and shutdown ordering

* Add circular dependencies breaker tests

* Refactoring and sync + async test

* Update changelog
2021-07-20 18:46:44 -04:00
Roman Mogylatov
54de3a9d2c Merge branch 'release/4.34.0' into master 2021-06-24 16:03:37 +03:00
Roman Mogylatov
6ffb98af67 Bump version to 4.34.0 2021-06-24 16:03:11 +03:00
Roman Mogylatov
ef049daae5
463 Config environment variables interpolation required and nones (#467)
* Make prototype with enterpolation before parsing

* Add test for option.from_yaml() with missing env not required

* Make some cosmetic changes to _resolve_config_env_markers()

* Add test for option.from_ini() missing envs not required

* Skip schema test cause it requires internet connection

* Add tests for .from_yaml() for config and config option

* Add tests for .from_ini() for config and config option

* Add example for os.environ.setdefault() and envs interpolation

* Add/update docs on environment variables interpolation

* Update changelog
2021-06-24 16:00:36 +03:00
Roman Mogylatov
9abf34cb88 Merge branch 'release/4.33.0' into master 2021-06-13 22:06:36 -04:00
Roman Mogylatov
31beb54979 Bump version to 4.33.0 2021-06-13 22:06:27 -04:00
Roman Mogylatov
dbbf5fdcf1
462 Config.from_value() (#465)
* Implement .from_value() method for config provider

* Add tests for config.from_value() method

* Add example for config.from_value()

* Add docs

* Update changelog
2021-06-13 22:05:29 -04:00
Roman Mogylatov
bbd623c719
459 Add default value for environment variable for yaml and ini config files (#461)
* Add tests for partial yaml interpolation

* Add tests for partial ini interpolation

* Add yaml config env defaults parsing

* Implement default interpolation for ini files

* Add tests for ini files env interpolation

* Update docs

* Update docs

* Update config docs keywords
2021-06-13 15:07:30 -04:00
Roman Mogylatov
585c717650 Merge branch 'release/4.32.3' into master 2021-05-20 18:12:09 -04:00
Roman Mogylatov
e06dd782cd Bump version to 4.32.3 2021-05-20 18:12:00 -04:00
Ngo Thanh Loi (Leonn)
c2a1351612
Fix typo (#456) 2021-05-20 17:58:15 -04:00
Roman Mogylatov
64574dff4d Merge branch 'release/4.32.2' into master 2021-04-26 22:11:08 -04:00
Roman Mogylatov
39fb88a0e9 Bump version to 4.32.2 2021-04-26 22:09:35 -04:00
Roman Mogylatov
eacb190907 Improve wiring fault tolerance 2021-04-26 22:07:48 -04:00
Roman Mogylatov
fcba4cc989 Merge branch 'release/4.32.1' into master 2021-04-25 17:37:19 -04:00
Roman Mogylatov
b4a23670c1 Fix Windows builds 2021-04-25 17:37:08 -04:00
Roman Mogylatov
ce157eeab9 Merge branch 'release/4.32.1' into master 2021-04-25 13:45:43 -04:00
Roman Mogylatov
0f3e170711 Bump version to 4.32.1 2021-04-25 13:45:34 -04:00
Roman Mogylatov
fab4e3e5be Merge branch 'release/4.32.0' into master 2021-04-18 21:47:56 -04:00
Roman Mogylatov
42deda7eb5 Bump version to 4.32.0 2021-04-18 21:47:47 -04:00
Roman Mogylatov
a34bd456e8 Update Cython to 0.29.22 2021-04-18 21:47:34 -04:00
RK
9cb8e60280
Feature: Context local provider (#442)
Co-authored-by: Rollo Konig Brock <rollo@b2c2.com>
2021-04-18 21:37:55 -04:00
Roman Mogylatov
155f598699 Merge branch 'release/4.31.2' into master 2021-03-30 14:02:22 -06:00
Roman Mogylatov
57b4913b9b Bump version to 4.31.2 and update changelog 2021-03-30 14:02:12 -06:00
Roman Mogylatov
664a6ca5d9 Add sonthonaxrk to the list of contributors 2021-03-30 14:01:22 -06:00
RK
9ed13a4023 Fix provider documentation (#440)
Make example more realistic.  This would break if you're running flask with multiple threads.
2021-03-30 13:59:06 -06:00
Roman Mogylatov
7b70f46601 Fix an issue with Dict provider non-string keys 2021-03-30 10:25:45 -04:00
Roman Mogylatov
d04596be73 Merge branch 'release/4.31.1' into master 2021-03-23 21:14:47 -04:00
Roman Mogylatov
37dd617260 Bump version to 4.31.1 2021-03-23 21:14:35 -04:00
Roman Mogylatov
1aef599606
Fix ThreadSafeSingleton synchronization issue (#434)
* Fix ThreadSafeSingleton synchronization issue

* Update changelog
2021-03-23 21:14:03 -04:00
Roman Mogylatov
fca9fd498c Merge branch 'release/4.31.0' into master 2021-03-20 21:42:57 -04:00
Roman Mogylatov
88455d10ff Bump version to 4.31.0 2021-03-20 21:42:40 -04:00
Roman Mogylatov
41e698f633
Fix configuration cache reset (#430)
* Implement fix

* Improve providers copying

* Add tests and implement cache reset for configuration option

* Update changelog

* Add link to the issue
2021-03-20 21:41:39 -04:00
Roman Mogylatov
f961ff536a
Schemas (#429)
* Add single container prototype

* Add multiple containers prototype

* Add integration tests

* Implement from_*() methods and add tests

* Prototype inline injections

* Add integration test for inline providers

* Refactor integration tests

* Add integration test for reordered schema

* Remove unused imports from tests

* Refactor schema module

* Update tests to match latest schemas

* Add mypy_boto3_s3 to the test requirements

* Add boto3 to the test requirements

* Add set_provides for Callable, Factory, and Singleton providers

* Fix warnings in tests

* Add typing stubs for Callable, Factory, and Singleton .set_provides() attributes

* Fix singleton children to have optional provides

* Implement provider to provider resolving

* Fix pypy3 tests

* Implement boto3 session use case and add tests

* Implement lazy initialization and improve copying for Callable, Factory, Singleton, and Coroutine providers

* Fix Python 2 tests

* Add region name for boto3 integration example

* Remove f-strings from set_provides()

* Fix schema flake8 errors

* Implement lazy initialization and improve copying for Delegate provider

* Implement lazy initialization and improve copying for Object provider

* Speed up wiring tests

* Implement lazy initialization and improve copying for FactoryAggregate provider

* Implement lazy initialization and improve copying for Selector provider

* Implement lazy initialization and improve copying for Dependency provider

* Implement lazy initialization and improve copying for Resource provider

* Implement lazy initialization and improve copying for Configuration provider

* Implement lazy initialization and improve copying for ProvidedInstance provider

* Implement lazy initialization and improve copying for AttributeGetter provider

* Implement lazy initialization and improve copying for ItemGetter provider

* Implement lazy initialization and improve copying for MethodCaller provder

* Update changelog

* Fix typing in wiring module

* Fix wiring module loader uninstallation issue

* Fix provided instance providers error handing in asynchronous mode

Co-authored-by: Roman Mogylatov <rmk@Romans-MacBook-Pro.local>
2021-03-20 13:16:51 -04:00
Roman Mogylatov
8cad8c6b65 Merge branch 'release/4.30.0' into master 2021-03-19 20:23:39 -04:00
Roman Mogylatov
9ea8709ed9 Bump version to 4.30.0 2021-03-19 20:23:20 -04:00
Roman Mogylatov
6c1b7cc677 Remove restriction to wire a dynamic container 2021-03-19 20:23:10 -04:00
Roman Mogylatov
ee89476db0 Merge branch 'release/4.29.2' into master 2021-03-08 16:33:46 -05:00
Roman Mogylatov
e42d7dc05e Bump version to 4.29.2 2021-03-08 16:33:32 -05:00
Roman Mogylatov
bbbed8972a
Wiring import fixes numpy scipy (#422)
* Add signature guards

* Fix flake8 errors and update changelog

* Fix slow numpy/scipy installs on pypy3
2021-03-08 16:32:34 -05:00
Roman Mogylatov
b3bcf60ced Merge branch 'release/4.29.1' into master 2021-03-05 20:20:10 -05:00
Roman Mogylatov
ed0b93bdbe Pin ubuntu to 18.04 for publishing jobs 2021-03-05 20:19:31 -05:00
Roman Mogylatov
d4ebb1b786
Remove unittest2 (#419)
* Remove unittest2 framework

* Skip a couple of tests on Python 2.7

* Update changelog
2021-03-05 20:17:28 -05:00
Roman Mogylatov
6b57ce9f15 Merge branch 'release/4.29.1' into master 2021-03-05 17:28:56 -05:00
Roman Mogylatov
dbad7949b0 Bump version to 4.29.1 2021-03-05 17:28:46 -05:00
Roman Mogylatov
22629544a4 Fix recursive copying issue in `Delegate` provider 2021-03-05 17:24:48 -05:00
Roman Mogylatov
c14ff96773 Remove legacy css file 2021-03-05 17:23:57 -05:00
Roman Mogylatov
2cab6c687a Add docs and example for `Factory.add_attributes()` method 2021-03-03 16:06:53 -05:00
Roman Mogylatov
f1a3ad0b82 Merge branch 'release/4.29.0' into master 2021-03-03 09:06:29 -05:00
Roman Mogylatov
3f026887bf Bump version to 4.29.0 2021-03-03 09:06:19 -05:00
Roman Mogylatov
1304e596d6
Container provider override API (#418)
* Implement override API

* Add tests

* Update changelog
2021-03-03 09:05:15 -05:00
Roman Mogylatov
2bf3601695
Singleton reset context (#417)
* Add implementation and typing stubs

* Make some refactoring and add tests

* Pin ubuntu version to 18.04

* Add docs and example

* Add changelog

* Add container docs
2021-03-03 08:28:10 -05:00
Roman Mogylatov
e0b0a1e968 Merge branch 'release/4.28.1' into master 2021-03-01 09:06:24 -05:00
Roman Mogylatov
e6a0973be3 Bump version to 4.28.1 2021-03-01 09:06:11 -05:00
Roman Mogylatov
346451819e Fix async mode mode exception handling issue in `Dependency` provider 2021-03-01 09:01:51 -05:00
Roman Mogylatov
26571e805a Fix links to `boto3` example 2021-03-01 08:28:22 -05:00
Roman Mogylatov
25c966f7af Merge branch 'release/4.28.0' into master 2021-02-28 21:08:59 -05:00
Roman Mogylatov
cc05b42200 Bump version to 4.28.0 2021-02-28 21:08:50 -05:00
Roman Mogylatov
da13341453
Wiring: attribute injections (#414)
* Add implementation

* Add tests for module and class

* Add tests for module and class for string ids

* Update tests with typing

* Add tests for invalid type of marker

* Add docs and the example

* Update changelog

* Fix Python 3.6 tests and flake8
2021-02-28 21:07:50 -05:00
Roman Mogylatov
c787ac2f63 Merge branch 'release/4.27.0' into master 2021-02-27 09:47:11 -05:00
Roman Mogylatov
48392beff2 Bump version to 4.27.0 2021-02-27 09:46:58 -05:00
Roman Mogylatov
73b8a4aac4
Introduce wiring inspect filter (#412)
* Introduce wiring inspect filter

* Upgrade exclusion filter

* Refactor wiring
2021-02-27 09:45:49 -05:00
Roman Mogylatov
6763ad2934 Update changelog 2021-02-25 17:02:01 -05:00
Shubhendra Singh Chauhan
4ac798014a
Integration: DeepSource (#407)
* Refactor unnecessary `else` / `elif` when `if` block has a `return` statement

* Remove unused imports

* Use literal syntax to create data structure

* revert "remove unused import"

* Create .deepsource.toml
2021-02-25 16:57:34 -05:00
Roman Mogylatov
9788a1888f Add `boto3` example 2021-02-25 11:06:08 -05:00
Roman Mogylatov
3cf14c139f Add @withshubh to the list of contributors 2021-02-25 09:52:24 -05:00
Roman Mogylatov
95b0356edc Update changelog 2021-02-25 09:51:33 -05:00
Shubhendra Singh Chauhan
43eb15ed65
fix: code quality issues (#406)
* Refactor unnecessary `else` / `elif` when `if` block has a `return` statement

* Remove unused imports

* Use literal syntax to create data structure

* revert "remove unused import"
2021-02-25 09:44:15 -05:00
Roman Mogylatov
5f6777db19 Add tests for `.as_float()` modifier usage with wiring 2021-02-23 10:20:04 -05:00
Roman Mogylatov
d3720bd6dd Merge branch 'release/4.26.0' into master 2021-02-21 10:35:42 -05:00
Roman Mogylatov
0149338bb6 Bump version to 4.26.0 2021-02-21 10:35:33 -05:00
Roman Mogylatov
a4a84bea54
Wiring by string id (#403)
* Add prototype implementation

* Implement wiring by string id

* Fix pydocstyle errors

* Refactor wiring module

* Fix flake8 errors

* Update changelog

* Fix flake8 errors

* Add example and docs
2021-02-21 10:34:28 -05:00
Roman Mogylatov
d9d811a4d4 Improve error message for `Dependency` provider missing attribute 2021-02-19 08:50:14 -05:00
Roman Mogylatov
0026f48cb6 Merge branch 'release/4.25.1' into master 2021-02-19 08:12:43 -05:00
Roman Mogylatov
e5017347c7 Bump version to 4.25.1 2021-02-19 08:11:18 -05:00
Roman Mogylatov
a85d89e6f2 Amend docs and add another example for `@containers.copy()` decorator 2021-02-19 08:11:05 -05:00
Roman Mogylatov
6a73b9d3fd Merge branch 'release/4.25.0' into master 2021-02-18 17:52:46 -05:00
Roman Mogylatov
a71154e05f Bump version to 4.25.0 2021-02-18 17:52:29 -05:00
Roman Mogylatov
2dc78a6875 Add new multiple containers example 2021-02-18 17:49:39 -05:00
Roman Mogylatov
990fd3a554 Add attributes forwarding for the `Dependency` provider 2021-02-18 17:49:23 -05:00
Roman Mogylatov
c0d1e48f7b Merge branch 'release/4.24.0' into master 2021-02-18 08:51:24 -05:00
Roman Mogylatov
1d588cf9f6 Bump version to 4.24.0 2021-02-18 08:51:11 -05:00
Roman Mogylatov
8806405f0f Add docs on @containers.copy() decorator 2021-02-18 08:38:35 -05:00
Roman Mogylatov
13aa5fa53d Refactor @containers.copy() decorator 2021-02-18 08:25:22 -05:00
Roman Mogylatov
64a7a18f79 Improve doc blocks in declarative_override_decorator.py example 2021-02-18 08:18:35 -05:00
Roman Mogylatov
c7ba58c0af Refactor async mode support in containers module 2021-02-18 08:17:05 -05:00
Roman Mogylatov
18051522d7 Merge branch 'release/4.23.5' into master 2021-02-17 11:32:44 -05:00
Roman Mogylatov
763d42d532 Bump version to 4.23.5 2021-02-17 11:31:54 -05:00
Roman Mogylatov
f9a2ffaad6 Merge branch 'release/4.23.4' into master 2021-02-17 10:08:57 -05:00
Roman Mogylatov
6c45eb4eee Bump version to 4.23.4 2021-02-17 10:08:43 -05:00
Roman Mogylatov
70bebf9075 Merge branch 'release/4.23.3' into master 2021-02-17 10:02:41 -05:00
Roman Mogylatov
24cfd13acb Bump version to 4.23.3 2021-02-17 10:02:20 -05:00
Roman Mogylatov
27d0e07718
Async mode awaitable fix (#400)
* Fix mistakenly processed awaitable objects

* Update changelog

* Replace __isawaitable() with __is_future_or_coroutine()

* Refactor async mode
2021-02-17 09:56:39 -05:00
Roman Mogylatov
6e59b4ab6f Merge branch 'release/4.23.2' into master 2021-02-16 12:28:13 -05:00
Roman Mogylatov
6402c5b6f1 Bump version to 4.23.2 2021-02-16 12:28:00 -05:00
Roman Mogylatov
de1181bdf7
Async mode fixes (#399)
* Fix double printing of exception when initializing resource causes error

* Improve async mode exceptions handling to prevent infinite hanging when exception occurs

* Improve async mode exceptions handling

* Update changelog

* Update tests
2021-02-16 12:26:23 -05:00
Roman Mogylatov
b2ea773c71 Merge branch 'release/4.23.1' into master 2021-02-15 18:13:21 -05:00
Roman Mogylatov
12d53c799d Bump version to 4.23.1 2021-02-15 18:13:01 -05:00
Roman Mogylatov
8cc2c1188b Fix issue #398 with FastAPI request importing 2021-02-15 17:47:03 -05:00
Roman Mogylatov
6c06548019 Merge branch 'release/4.23.0' into master 2021-02-15 09:13:00 -05:00
Roman Mogylatov
c28a4dc047 Bump version to 4.23.0 2021-02-15 09:12:46 -05:00
Roman Mogylatov
64d37efa37
Configuration provider aliases (#397)
* Add implementation, typing stubs, and tests

* Add docs and example

* Update changelog
2021-02-15 09:11:39 -05:00
Roman Mogylatov
93fa37728b Merge branch 'release/4.22.1' into master 2021-02-14 21:09:31 -05:00
Roman Mogylatov
ed0a413b67 Bump version to 4.22.1 2021-02-14 21:09:21 -05:00
Roman Mogylatov
368f50f0ba Fix typo in FastAPI + SQLAlchemy example docs 2021-02-14 21:08:19 -05:00
Roman Mogylatov
d9e946ff56 Pin Sphinx version to hotfix broken docs build 2021-02-14 21:05:32 -05:00
Roman Mogylatov
02dea7bce5 Merge branch 'release/4.22.0' into master 2021-02-14 19:10:06 -05:00
Roman Mogylatov
22bc447d14 Bump version to 4.22.0 2021-02-14 19:09:44 -05:00
Roman Mogylatov
8b770772a1 Add container name to the representation of the dependency provider 2021-02-14 19:09:08 -05:00
Roman Mogylatov
0d8f2ff44e Add cross-links between container singletons and reset container singletons docs pages 2021-02-14 18:51:55 -05:00
Roman Mogylatov
8eea9c4e45
Implement container.check_dependencies() (#396)
* Add implementation, typing stubs, and tests

* Add docs and example

* Update changelog
2021-02-14 18:47:15 -05:00
Roman Mogylatov
2c5bb45bf1 Merge remote-tracking branch 'origin/master' into develop 2021-02-14 18:30:26 -05:00
Roman Mogylatov
2127e3cef9 Merge branch 'release/4.21.0' into master 2021-02-13 09:18:12 -05:00
Roman Mogylatov
7fdd25e46f Bump version to 4.21.0 2021-02-13 09:17:59 -05:00
Roman Mogylatov
839a319831
Better error message for dependency provider (#395)
* Add prototype for flat resolving

* Add working prototype for sample 1 and 3

* Add working prototype, requires deep refactoring

* Update DependenciesContainer to handle Contrainer provider

* Fix Dependency provider copying issue

* Add hardening fix for Self provider to avoid copying bugs

* Fix flaky container copy issue

* Rename set_parent() to assign_parent()

* Refactor Dependency provider and its typing stub

* Add tests for Dependency provider

* Update makefile to run coverage when tests fail

* Clean up DependenciesContainer provider and add tests

* Clean up Container provider and add tests

* Clean up container instance and add tests

* Refactor isinstance() checks

* Clean up DeclarativeContainer and add tests

* Update docs and examples

* Update changelog

* Revoke makefile change
2021-02-13 09:16:38 -05:00
Roman Mogylatov
e65212e231 Revoke makefile change 2021-02-13 09:12:54 -05:00
Roman Mogylatov
2621e505cd Update changelog 2021-02-13 09:11:52 -05:00
Roman Mogylatov
50d05d43c6 Update docs and examples 2021-02-13 09:07:22 -05:00
Roman Mogylatov
21c0c82144 Clean up DeclarativeContainer and add tests 2021-02-13 08:36:45 -05:00
Roman Mogylatov
1d884b5101 Refactor isinstance() checks 2021-02-12 19:01:54 -05:00
Roman Mogylatov
3ba65da1ad Clean up container instance and add tests 2021-02-12 18:55:20 -05:00
Roman Mogylatov
cb7c13f1ba Clean up Container provider and add tests 2021-02-12 16:58:23 -05:00
Roman Mogylatov
351bdd282e Clean up DependenciesContainer provider and add tests 2021-02-12 09:16:21 -05:00
Roman Mogylatov
9677701626 Update makefile to run coverage when tests fail 2021-02-12 09:15:49 -05:00
Roman Mogylatov
b376836150 Add tests for Dependency provider 2021-02-12 08:35:04 -05:00
Roman Mogylatov
99e404650f Refactor Dependency provider and its typing stub 2021-02-12 08:02:44 -05:00
Roman Mogylatov
b68d4d8d08 Rename set_parent() to assign_parent() 2021-02-11 18:06:47 -05:00
Roman Mogylatov
dd6b0caffd Fix flaky container copy issue 2021-02-11 16:32:31 -05:00
Roman Mogylatov
980f9fc2bc Add hardening fix for Self provider to avoid copying bugs 2021-02-11 09:20:05 -05:00
Roman Mogylatov
e29040d2ee Fix Dependency provider copying issue 2021-02-11 09:09:52 -05:00
Roman Mogylatov
7ef3c63ca9 Update DependenciesContainer to handle Contrainer provider 2021-02-11 07:50:52 -05:00
Roman Mogylatov
5f34c7ce3f Add working prototype, requires deep refactoring 2021-02-10 08:52:13 -05:00
Roman Mogylatov
ff3ae95482 Add working prototype for sample 1 and 3 2021-02-10 07:57:04 -05:00
Roman Mogylatov
1c433ed0ad Add prototype for flat resolving 2021-02-09 08:57:31 -05:00
Roman Mogylatov
81da4e0451 Merge branch 'release/4.20.2' into master 2021-02-09 07:36:06 -05:00
Roman Mogylatov
5b18d609f1 Bump version to 4.20.2 2021-02-09 07:35:55 -05:00
Roman Mogylatov
47aa8c11fe Move Self provider docs to providers section 2021-02-09 07:34:46 -05:00
Roman Mogylatov
a9fd206aae Merge branch 'release/4.20.1' into master 2021-02-07 14:17:53 -05:00
Roman Mogylatov
719b61cf22 Bump version to 4.20.1 2021-02-07 14:17:40 -05:00
Roman Mogylatov
5e5531765d Merge branch 'release/4.20.0' into master 2021-02-07 14:14:35 -05:00
Roman Mogylatov
6b24cb84a5 Bump version to 4.20.0 2021-02-07 14:14:22 -05:00
Roman Mogylatov
674a6b0f9e
Container "self" injections (#392)
* Add implementation

* Add Self provider tests

* Add container tests

* Remove ellipsis from tests to make them pass on Python 2

* Add tests

* Add docs

* Improve traverse() typing stubs

* Update changelog
2021-02-07 14:13:23 -05:00
Roman Mogylatov
ce6d3df72c Merge branch 'release/4.19.0' into master 2021-02-05 18:28:44 -05:00
Roman Mogylatov
398d502981 Bump version to 4.19.0 2021-02-05 18:28:26 -05:00
Roman Mogylatov
19a2f551ae Update docs on creating custom providers with a requirement to specify `.related` property 2021-02-05 18:27:32 -05:00
Roman Mogylatov
2fe0e00cef
Singleton.full_reset() (#391)
* Improve .traverse() typing stubs

* Fix container.reset_singletons()

* Add implementation, tests, and typing stubs

* Add docs and example

* Update changelog
2021-02-05 18:17:44 -05:00
Roman Mogylatov
78f623c05b Merge branch 'release/4.18.0' into master 2021-02-05 17:24:00 -05:00
Roman Mogylatov
e80c56f9be Bump version to 4.18.0 2021-02-05 17:23:10 -05:00
Roman Mogylatov
b25356d2fa Fix tests 2021-02-05 17:21:26 -05:00
Roman Mogylatov
c964253204
Container.reset_singletons() (#390)
* Rename container tests

* Add implementation + tests

* Update changelog

* Add examples and docs
2021-02-05 17:14:10 -05:00
Roman Mogylatov
c4892af31e Refactor `container.apply_container_providers_overridings() to use container.traverse()` 2021-02-05 08:59:16 -05:00
Roman Mogylatov
c9ab7d540d Add tests for .provided & .call() 2021-02-05 08:48:25 -05:00
Roman Mogylatov
288284aa9c Make "make test" to be a default test command and run Python 3 tests 2021-02-05 08:36:36 -05:00
Roman Mogylatov
b3bd8e888b Add tests for selector provider 2021-02-05 08:34:20 -05:00
Roman Mogylatov
35f280ac8a Merge branch 'release/4.17.0' into master 2021-02-04 18:19:55 -05:00
Roman Mogylatov
2c1eb9f95f Bump version to 4.17.0 2021-02-04 18:19:40 -05:00
Roman Mogylatov
d45d98e300
Fastapi sqlalchemy example (#389)
* Add application

* Dockerize the app

* Fix 204 content-leength error

* Rename database file

* Add tests

* Add README

* Fix a typo in FastAPI example

* Add docs on FastAPI + SQLAlchemy example

* Update changelog

* Add link to the example to README and other docs pages

* Add EOF to the config.yml
2021-02-04 18:18:25 -05:00
Roman Mogylatov
a1f779a9f3 Merge branch 'release/4.16.0' into master 2021-02-03 15:40:53 -05:00
Roman Mogylatov
892330f43c Bump version to 4.16.0 2021-02-03 15:40:41 -05:00
Roman Mogylatov
cba5aefd65 Add container base class 2021-02-03 15:36:37 -05:00
Roman Mogylatov
6cc1a0c61f Merge branch 'release/4.15.0' into master 2021-02-03 09:22:58 -05:00
Roman Mogylatov
f48fd159f0 Bump version to 4.15.0 2021-02-03 09:22:40 -05:00
Roman Mogylatov
15fa6c301e
Pydantic settings support (#388)
* Add implementation and basic test

* Add full test coverage + bugfix

* Add test coverage for .from_yaml() method

* Update setup.py, tox and dev requirements

* Stop running pydantic tests on Python 3.5 and below

* Remove pydantic from tox Python < 3.6

* Add example and docs

* Update features block

* Add extra test

* Update changelog
2021-02-03 09:21:32 -05:00
Roman Mogylatov
1fabbf314b Merge branch 'release/4.14.0' into master 2021-02-01 09:57:43 -05:00
Roman Mogylatov
fbe51b95e8 Bump version to 4.14.0 2021-02-01 09:55:21 -05:00
Roman Mogylatov
e9a16d1f17 Fix #380: .init_resources() and .shutdown_resource() dont ignore nested resources 2021-02-01 09:54:36 -05:00
Roman Mogylatov
3ca6dd9af1
Providers traversal (#385)
* Implement providers traversal in first precision

* Implement traversal for all providers

* Update traverse interface + add some tests

* Refactor tests

* Add tests for callable provider

* Add configuration tests

* Add Factory tests

* Add FactoryAggrefate tests

* Add .provides attribute to singleton providers

* Add singleton provider tests

* Add list and dict provider tests

* Add resource tests

* Add Container provider tests

* Add Selector provider tests

* Add ProvidedInstance provider tests

* Add AttributeGetter provider tests

* Add ItemGetter provider tests

* Add MethodCaller provider tests

* Refactor container interface

* Update resource provider string representation

* Add .initializer attribute to Resource provider

* Add docs and examples

* Remove not needed EOL in the tests

* Make cosmetic refactoring

* Ignore flake8 line width error in traverse example
2021-02-01 09:42:21 -05:00
Roman Mogylatov
0c1a08174f Merge branch 'release/4.13.2' into master 2021-01-29 16:58:44 -05:00
Roman Mogylatov
cd949c6a0b Bump version to 4.13.2 2021-01-29 16:58:30 -05:00
Roman Mogylatov
4942f9c160 Fix PyCharm typing warning in container.wire() method 2021-01-29 16:58:08 -05:00
Roman Mogylatov
b7afbe2cdc Merge branch 'release/4.13.1' into master 2021-01-29 16:42:38 -05:00
Roman Mogylatov
fba00894ea Bump version to 4.13.1 2021-01-29 16:42:30 -05:00
Roman Mogylatov
39cb963351 367 Fix declarative container metaclass bug with child providers 2021-01-29 16:37:50 -05:00
Roman Mogylatov
f188811d87 Merge branch 'release/4.13.0' into master 2021-01-29 13:51:08 -05:00
Roman Mogylatov
a0ba7fd16c Bump version to 4.13.0 2021-01-29 13:50:53 -05:00
Roman Mogylatov
478ca18ae3
336 Dependency provider default (#382)
* Add implementation and tests

* Refactor dependency provider docs

* Update docs

* Update changelog
2021-01-29 13:49:40 -05:00
Roman Mogylatov
1f17bc6e08 Merge branch 'release/4.12.0' into master 2021-01-28 19:50:49 -05:00
Roman Mogylatov
ebeb258e96 Bump version to 4.12.0 2021-01-28 19:50:35 -05:00
Roman Mogylatov
eb587933f4
Implement wiring autoloader (#381)
* Implement wiring autoloader

* Add docs

* Update changelog
2021-01-28 19:49:24 -05:00
Roman Mogylatov
9225f9dcd6 Merge branch 'release/4.11.3' into master 2021-01-28 08:46:00 -05:00
Roman Mogylatov
aca67663b6 Bump version to 4.11.3 2021-01-28 08:44:10 -05:00
Roman Mogylatov
6224131a76 358 Replace configuration option weakref to root with regular ref 2021-01-28 08:40:43 -05:00
Roman Mogylatov
9136fdcbb5 Merge branch 'release/4.11.2' into master 2021-01-27 14:19:27 -05:00
Roman Mogylatov
725e3fa322 Bump version to 4.11.2 2021-01-27 14:03:08 -05:00
Roman Mogylatov
ba0fb38ad0 379 Fix a bug in `providers.Container` when it's declared not at class root level 2021-01-27 14:02:13 -05:00
Roman Mogylatov
874b13fdea Merge branch 'release/4.11.1' into master 2021-01-27 09:22:11 -05:00
Roman Mogylatov
92938b018d
Improve @containers.copy to replace subcontainer providers (#378)
* Improve @containers.copy to replace subcontainer providers

* Bump version to 4.11.1
2021-01-27 09:21:45 -05:00
Roman Mogylatov
78479c65e6 Merge branch 'release/4.11.0' into master 2021-01-27 07:50:18 -05:00
Roman Mogylatov
f5b2862354 Switch CD to prod 2021-01-27 07:49:53 -05:00
Roman Mogylatov
9efc8ed488 Test docs - ok 2021-01-27 07:45:48 -05:00
Roman Mogylatov
9bdce2d376 Test docs publishing 2021-01-27 07:41:25 -05:00
Roman Mogylatov
63dade0615 Bump version to 4.11.0 2021-01-27 07:39:38 -05:00
Roman Mogylatov
7b33733bdf Update badge 2021-01-27 07:38:35 -05:00
Roman Mogylatov
717f7a0497
Travis CI -> GitHub Actions (#377)
* Add tests config

* Try run tests on multiple versions

* Add jobs for Python 3.5, 3.6, 3.7

* Add Python 3.4

* Add Python 2.7 job

* Add PyPy and PyPy3 jobs

* Add tests coverage job

* Try to add manual trigger for tests

* Fix coveralls token passing

* Change coverage job name

* Update env sections

* Update run and env sections

* Add COVERALLS_GIT_BRANCH

* Try set branch name

* Set branch name and token

* Update tox.ini to pass env variables

* Update tox.ini

* Re-arrange run actions

* Refactor tests workflow

* Add linters workflow

* Move linters to tests workflow

* Move branch name

* Create common linters job

* Rename tests and linters workflow

* Add pull_request event for tests and linters jobs

* Add publishing workflow

* Try quote asteriks

* Update publishing workflow to publish to test server

* Change publishing workflow name

* Add linux x64 wheels publishing job

* Bump version

* Add publishing wheels on mac and windows

* Fix windows builds

* Refactor to two stages build

* Rename build wheels job

* Add experimental aarch64 builds

* Rename custom archs job

* Add tests & linters to publishing job

* Bump version

* Add docs publishing

* Rename aarch64 job

* Rename aarch64 job

* Revert version change

* Update coveralls job

* Experiment with coveralls

* Experiment with branch name

* Update tox.ini to pass github token

* Update tox.ini to pass all GH vars

* Remove coveralls branch

* Remove travis ci config
2021-01-26 21:11:27 -05:00
Roman Mogylatov
dfedead4f0 Add yaml tests skipping on Python 3.4 2021-01-25 17:32:22 -05:00
Roman Mogylatov
4cc39fc6eb
369 Add required argument to config from_* methods (#376)
* Update typing stubs

* Update from_yaml() method

* Update from_ini() method

* Update from_dict() method

* Update from_env() method

* Update documentation

* Update changelog

* Update changelog

* Make doc block fix

* Add extra test for from_ini()
2021-01-24 10:27:45 -05:00
Roman Mogylatov
2d49308c16
Configuration strict mode raise on non existing files (#375)
* Update from_yaml()

* Refactor YAML environment variables interpolation

* Update from_ini()

* Refactor UNDEFINED

* Update from_env()

* Update from_dict()

* Update docs

* Update changelog
2021-01-23 22:37:50 -05:00
Roman Mogylatov
500855895b
372 Change yaml loader to safe loader (#373)
* Add safe loader with env interpolation and an arg to provide custom loader

* Add docs

* Update changelog
2021-01-21 18:00:24 -05:00
Roman Mogylatov
582c232790 Update version to dev 2021-01-21 17:57:31 -05:00
Roman Mogylatov
d533ac110a Add extra tests for asynchronous injections 2021-01-21 11:42:22 -05:00
Roman Mogylatov
c16f974517 Refactor asynchronous injections 2021-01-21 11:20:24 -05:00
Roman Mogylatov
4b0272ab30 Fix #368 Async providers do not work with async dependencies 2021-01-21 10:58:49 -05:00
Roman Mogylatov
349c252b50 Merge branch 'release/4.10.3' into master 2021-01-20 09:04:24 -05:00
Roman Mogylatov
c865e7c90d Bump version to 4.10.3 2021-01-20 09:04:11 -05:00
Roman Mogylatov
e338309c10 Merge branch 'develop' of https://github.com/ets-labs/python-dependency-injector into develop 2021-01-20 08:59:49 -05:00
Roman Mogylatov
9f7dbe89f6 Merge branch 'release/4.10.2' into master 2021-01-20 08:58:32 -05:00
Roman Mogylatov
0cc63cd075 Merge branch 'release/4.10.2' into master 2021-01-19 17:51:00 -05:00
Roman Mogylatov
a635e46b59 Bump version to 4.10.2 2021-01-19 17:50:46 -05:00
Roman Mogylatov
21cc6ffc1b Fix bug #361: failure on async resource depends on other async resource 2021-01-19 17:47:25 -05:00
Roman Mogylatov
2cfc61aa37 Merge branch 'release/4.10.1' into master 2021-01-18 21:03:09 -05:00
Roman Mogylatov
50c5c81fd7 Bump version to 4.10.1 2021-01-18 21:02:56 -05:00
Roman Mogylatov
0ab0239d47 Switch Coveralls reporting Travis Job to run on Python 3.9. 2021-01-18 20:56:55 -05:00
Roman Mogylatov
4991c5d4b0 Fix a Python 3.9 GenericAlias introspection bug, issue #362 2021-01-18 20:49:56 -05:00
Roman Mogylatov
2ced67d52b Merge branch 'release/4.10.0' into master 2021-01-16 08:55:15 -05:00
Roman Mogylatov
7ada2dc938 Bump version to 4.10.0 2021-01-16 08:55:00 -05:00
Roman Mogylatov
d74e8248a1
Required config options and strict mode (#360)
* Add strict mode + tests

* Add .required() for configuration option

* Add wiring tests for required() modifier

* Add wiring support

* Add tests for defined None values in required/strict mode

* Add docs

* Update changelog

* Update example doc block
2021-01-16 08:53:40 -05:00
Roman Mogylatov
3b69ed91c6 Merge branch 'release/4.9.1' into master 2021-01-15 16:22:28 -05:00
Roman Mogylatov
21fb81dffb Bump version to 4.9.1 2021-01-15 16:22:12 -05:00
Roman Mogylatov
d9ff0a01fd Fix a bug in the `Configuration` provider to correctly handle undefined values 2021-01-15 16:21:57 -05:00
Roman Mogylatov
b873137614 Merge branch 'release/4.9.0' into master 2021-01-15 07:24:02 -05:00
Roman Mogylatov
07d6261e3f Bump version to 4.9.0 2021-01-15 07:23:45 -05:00
Roman Mogylatov
907a4f1887
Add dependencies attribute to declarative and dynamic containers (#359)
* Add .dependencies attribute to declarative and dynamic containers

* Update changelog

* Add typing tests
2021-01-15 07:20:37 -05:00
Roman Mogylatov
3e207a4f21 Merge branch 'release/4.8.3' into master 2021-01-15 06:44:54 -05:00
Roman Mogylatov
a996c142ac Bump version to 4.8.3 2021-01-15 06:44:41 -05:00
Roman Mogylatov
1c87a9973d Fix a bug in the `Configuration provider to correctly handle overriding by None`. 2021-01-15 06:44:24 -05:00
Roman Mogylatov
1cbd3a0215 Merge branch 'release/4.8.2' into master 2021-01-13 17:08:36 -05:00
Roman Mogylatov
21053b3fb1 Bump version to 4.8.2 2021-01-13 17:08:26 -05:00
Roman Mogylatov
1628cfaf28 Fix `Container` provider to apply context overridings on root container initialization 2021-01-13 17:07:41 -05:00
Roman Mogylatov
de6c3cda78 Fix side effect in `Container` provider overriding 2021-01-13 09:11:24 -05:00
Roman Mogylatov
d9f914dfeb Merge branch 'release/4.8.1' into master 2021-01-12 17:50:28 -05:00
Roman Mogylatov
b425ac955c Bump version to 4.8.1 2021-01-12 17:50:11 -05:00
Roman Mogylatov
dd57c68ce5 Fix declarative container multi-level inheritance issue 2021-01-12 17:49:48 -05:00
Roman Mogylatov
46422a6845 Merge branch 'release/4.8.0' into master 2021-01-12 08:42:38 -05:00
Roman Mogylatov
6b8239ebb4 Bump version to 4.8.0 2021-01-12 08:42:14 -05:00
Roman Mogylatov
cd4807b2f9 Add support of overriding for container provider 2021-01-12 08:41:59 -05:00
Roman Mogylatov
cebeb79b93 Merge branch 'release/4.7.0' into master 2021-01-11 08:19:59 -05:00
Roman Mogylatov
86c4a22b5f Bump version to 4.7.0 2021-01-11 08:19:34 -05:00
Roman Mogylatov
8dd8446d39
Wiring container injection (#353)
* Add container injections to wiring

* Add example

* Update docs

* Update changelog

* Improve typing
2021-01-11 08:18:02 -05:00
Roman Mogylatov
6e77a95909 Merge branch 'release/4.6.1' into master 2021-01-10 20:02:57 -05:00
Roman Mogylatov
ce1bf704f2 Bump version to 4.6.1 2021-01-10 20:02:46 -05:00
Roman Mogylatov
9cd201a493 Merge branch 'release/4.6.0' into master 2021-01-10 19:32:29 -05:00
Roman Mogylatov
dfb7bb5a93 Bump version to 4.6.0 2021-01-10 19:31:59 -05:00
Roman Mogylatov
48a2bcc039 Update copyright year 2021-01-10 19:31:01 -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
9f6d2bb522 Update changelog and list of contributors 2020-12-30 13:26:28 -05:00
Fotis Koutoupas
aad84476d0
Fix flask ext warning message (#345) 2020-12-30 13:19:42 -05:00
Roman Mogylatov
89aeca76c0
Arm builds (#343)
* Add arm64 wheels travis build job

* Update changelog
2020-12-23 20:03:00 -05:00
Roman Mogylatov
47278030ce Merge branch 'release/4.5.4' into master 2020-12-10 18:28:37 -05:00
Roman Mogylatov
468451d4c0 Bump version to 4.5.4 2020-12-10 18:28:29 -05:00
Roman Mogylatov
10becb316f Hotfix travis issue with not working uploading of manylinux wheels 2020-12-10 18:26:05 -05:00
Roman Mogylatov
1c00243c09 Restore regular travis config 2020-12-10 18:24:28 -05:00
Roman Mogylatov
d51a7565e4 Test twine dependency resolution 2020-12-10 18:12:08 -05:00
Roman Mogylatov
ca1404694a Test twine uploads for linux builds 2020-12-10 17:52:11 -05:00
Roman Mogylatov
873b0907ec Merge branch 'release/4.5.3' into master 2020-12-05 22:14:44 -05:00
Roman Mogylatov
730baf87d8 Bump version to 4.5.3 2020-12-05 22:14:35 -05:00
Roman Mogylatov
c1e53e5edd Replace AsyncMock with simple mock class in FastAPI wiring tests for better compatibility 2020-12-05 22:08:05 -05:00
Roman Mogylatov
0b7cf3254e Fix test dependencies 2020-12-05 21:49:54 -05:00
Roman Mogylatov
b49f158583 Fix bug #331 2020-12-05 21:40:51 -05:00
Roman Mogylatov
ec49d56751 Add tests for FastAPI wiring 2020-12-05 21:36:30 -05:00
Roman Mogylatov
c4dd923f37 Merge branch 'release/4.5.2' into master 2020-12-04 20:19:12 -05:00
Roman Mogylatov
de092023b8 Bump version to 4.5.2 2020-12-04 20:18:39 -05:00
Roman Mogylatov
afa39b148e Fix issue 330: FastAPI Depends directive does not work after patching with @inject 2020-12-04 20:11:21 -05:00
Roman Mogylatov
5c4c84b34e Merge branch 'release/4.5.1' into master 2020-11-20 18:16:39 -05:00
Roman Mogylatov
4ff1a6eb25 Bump version to 4.5.1 2020-11-20 18:16:29 -05:00
Roman Mogylatov
9f314fd7e9 Merge branch 'release/4.5.0' into master 2020-11-20 18:10:13 -05:00
Roman Mogylatov
57faa5f93f Bump version to 4.5.0 2020-11-20 18:10:04 -05:00
Roman Mogylatov
cd2c5697c3 Add commands and handlers example 2020-11-20 18:09:34 -05:00
Roman Mogylatov
fbaf35244c Add example and docs 2020-11-20 17:57:33 -05:00
Roman Mogylatov
034e4814da Add support of non-string keys for Dict provider 2020-11-20 17:30:42 -05:00
Roman Mogylatov
c8178cecda Add extra typing test for provided instance of `DependenciesContainer` provider 2020-11-20 12:25:35 -05:00
Roman Mogylatov
8092421727 Add simple FastAPI example 2020-11-18 11:13:31 -05:00
Roman Mogylatov
ee965f9782 Merge branch 'release/4.4.1' into master 2020-11-17 23:59:44 -05:00
Roman Mogylatov
d581a28b6e Bump version to 4.4.1 2020-11-17 23:59:33 -05:00
Roman Mogylatov
49921dcf9d Remove a typo from the Flask tutorial 2020-11-17 23:50:56 -05:00
Roman Mogylatov
950d5a5e6e Update FastAPI example 2020-11-17 23:46:30 -05:00
Roman Mogylatov
d37ae8e7db Improve FastAPI integration 2020-11-17 23:44:32 -05:00
Roman Mogylatov
262c035bc1 Merge branch 'release/4.4.0' into master 2020-11-15 18:20:48 -05:00
Roman Mogylatov
a2b09c57dc Bump version to 4.4.0 2020-11-15 18:19:34 -05:00
Roman Mogylatov
092be74145 Add docs page on flask blueprints example 2020-11-15 18:09:45 -05:00
Roman Mogylatov
ca671abea6 Add flask blueprints example 2020-11-15 18:07:39 -05:00
Roman Mogylatov
ae3024588c
Wiring reengineering (#324)
* Bump version to 4.3.9: FastAPI example

* Reengineer wiring

* Add @inject decorator

* Add .workspace dir to gitignore

* Add generic typing for @inject

* Add type cast for @inject

* Update movie lister example

* Update cli application tutorial

* Update demo example

* Update wiring docs and examples

* Update aiohttp example and tutorial

* Update multiple containers example

* Update single container example

* Update decoupled packages example

* Update django example

* Update asyncio daemon example and tutorial

* Update FastAPI example

* Update flask example and tutorial

* Update sanic example

* Add wiring registry

* Add new line to .gitignore

* Add @inject to the test samples

* Fix flake8 errors
2020-11-15 16:06:42 -05:00
Roman Mogylatov
b0b8820ac1 Merge branch 'release/4.3.9' into master 2020-11-12 21:29:37 -05:00
Roman Mogylatov
9bcf875ef0 Bump version to 4.3.9: FastAPI example 2020-11-12 21:29:22 -05:00
Roman Mogylatov
bece33fc21 Fix fastapi example flake8 error 2020-11-12 17:56:47 -05:00
Roman Mogylatov
59f25241cc Add FastAPI mini app 2020-11-12 17:48:07 -05:00
Roman Mogylatov
af742b980a Merge branch 'release/4.3.8' into master 2020-11-12 16:32:31 -05:00
Roman Mogylatov
cdce5247c8 Bump version to 4.3.8 2020-11-12 16:31:20 -05:00
Roman Mogylatov
97c33442e0 Add wiring hotfix for fastapi 2020-11-12 15:54:49 -05:00
Roman Mogylatov
26a89d664b Merge branch 'release/4.3.7' into master 2020-11-10 17:02:56 -05:00
Roman Mogylatov
ccf6ccad54 Bump version to 4.3.7 2020-11-10 17:02:42 -05:00
Roman Mogylatov
985be71a04 Regenerate C sources after PR#322 2020-11-10 17:02:21 -05:00
Roman Mogylatov
bbaed9c061 Add Dmitry Rassoshenko to the list of contributors 2020-11-10 17:01:14 -05:00
Dmitry Rassoshenko
fb0d99c1c9
Fix race in ThreadSafeSingleton (#322) 2020-11-10 14:57:10 -05:00
Roman Mogylatov
4120afd1c3 Merge branch 'release/4.3.6' into master 2020-11-05 12:37:37 -05:00
Roman Mogylatov
3ff5c8ce82 Bump version to 4.3.6 2020-11-05 12:37:25 -05:00
Roman Mogylatov
02acaba034 Merge branch 'release/4.3.5' into master 2020-11-05 12:27:48 -05:00
Roman Mogylatov
6b93c2e412 Bump version to 4.3.5 2020-11-05 12:23:47 -05:00
Roman Mogylatov
3c71ba4b2a Fix wiring multiple imports, issue #320 2020-11-05 12:20:09 -05:00
Roman Mogylatov
4579e35d33 Merge branch 'release/4.3.4' into master 2020-11-05 10:20:39 -05:00
Roman Mogylatov
f3ec74a31f Bump version to 4.3.4 2020-11-05 10:20:23 -05:00
Roman Mogylatov
18ef566aae Fix issue #319 resulting in configuration.reset_override() not working properly 2020-11-05 10:16:39 -05:00
Roman Mogylatov
e847c357a6 Merge branch 'release/4.3.3' into master 2020-11-03 16:06:52 -05:00
Roman Mogylatov
25549d7cfe Bump version to 4.3.3 2020-11-03 16:06:42 -05:00
Roman Mogylatov
fb2d927cae Fix wiring for @classmethod and @staticmethod 2020-11-03 15:59:02 -05:00
Roman Mogylatov
c1cf1bfa1c Merge branch 'release/4.3.2' into master 2020-10-30 17:06:19 -04:00
Roman Mogylatov
b0d3f08aa6 Bump version to 4.3.2 2020-10-30 16:56:13 -04:00
Roman Mogylatov
e4e77d0cdb Fix wiring decorator 2020-10-30 16:55:37 -04:00
Roman Mogylatov
63977a73b2 Refactor wiring to reduce complexity 2020-10-30 16:47:26 -04:00
Roman Mogylatov
c5f799a1ec Fix issue with wiring and resource initialization 2020-10-30 16:40:27 -04:00
Roman Mogylatov
4c46d34b20 Merge branch 'release/4.3.1' into master 2020-10-29 23:00:53 -04:00
Roman Mogylatov
f65f8b1af9 Bump version to 4.3.1 2020-10-29 23:00:43 -04:00
Roman Mogylatov
84b0029494 Merge branch 'release/4.3.0' into master 2020-10-29 22:57:23 -04:00
Roman Mogylatov
d65b31865b Bump version to 4.3.0 2020-10-29 22:57:14 -04:00
Roman Mogylatov
707446a70f
Closing wiring marker (#315)
* Add closing marker

* Add example

* Fix flake8 errors

* Add test

* Update docs and README
2020-10-29 22:55:09 -04:00
Roman Mogylatov
b18385a867 Merge branch 'release/4.2.0' into master 2020-10-29 15:48:22 -04:00
Roman Mogylatov
21f0658ef3 Bump version to 4.2.0 2020-10-29 15:48:04 -04:00
Roman Mogylatov
30bc505b79 Update README and docs index 2020-10-29 15:46:43 -04:00
Roman Mogylatov
c3a04cc340 Add Python 3.9 classifier 2020-10-29 15:44:14 -04:00
Roman Mogylatov
eadea64e0f Add travis job for Python 3.9 2020-10-29 14:23:07 -04:00
Roman Mogylatov
e615b9c48c Merge branch 'release/4.1.8' into master 2020-10-28 22:31:08 -04:00
Roman Mogylatov
e3ccb0e764 Bump version to 4.1.8 2020-10-28 22:30:52 -04:00
Roman Mogylatov
018102b4e2 Update asyncio daemon to use Resource provider 2020-10-28 22:28:49 -04:00
Roman Mogylatov
d3ec1ef532 Update application examples to use Resource provider 2020-10-28 22:20:49 -04:00
Roman Mogylatov
fea8c33cd4 Merge branch 'release/4.1.7' into master 2020-10-28 21:02:31 -04:00
Roman Mogylatov
f7499354ec Bump version to 4.1.7 2020-10-28 21:02:21 -04:00
Roman Mogylatov
cdc5e84e7f Remove alabaster pinning 2020-10-28 20:48:21 -04:00
Roman Mogylatov
bf82f594b4 Add google analytics id 2020-10-28 20:48:07 -04:00
Roman Mogylatov
b7e7d8a171 Make alabaster theme pinning like on RTD 2020-10-28 20:36:45 -04:00
Roman Mogylatov
e4ed0bab6f Add building and pushing docs to s3 2020-10-28 17:37:43 -04:00
Roman Mogylatov
c0e5eac016 Merge branch 'release/4.1.6' into master 2020-10-28 14:23:14 -04:00
Roman Mogylatov
5c09be46d2 Bump version to 4.1.6 2020-10-28 14:23:00 -04:00
Roman Mogylatov
871bd617d4 Fix wiring linter errors 2020-10-28 13:50:51 -04:00
Roman Mogylatov
776cb4eebf Fix multiple containers wiring issue 2020-10-28 13:44:11 -04:00
Roman Mogylatov
2565a1eab0 Fix wiring for @classmethod 2020-10-28 13:11:07 -04:00
Roman Mogylatov
467e7ec9aa Merge branch 'release/4.1.5' into master 2020-10-27 17:48:14 -04:00
Roman Mogylatov
c7d8645044 Bump version to 4.1.5 2020-10-27 17:48:05 -04:00
Roman Mogylatov
9d5ccfea85 Debug TCI #5 2020-10-27 17:32:29 -04:00
Roman Mogylatov
532e1e3033 Debug TCI #4 2020-10-27 17:19:32 -04:00
Roman Mogylatov
b0501ca92a Debug TCI #3 2020-10-27 17:18:38 -04:00
Roman Mogylatov
3e4abb78e7 Debug Travis windows build #2 2020-10-27 17:16:23 -04:00
Roman Mogylatov
3cd590fc70 Debug Travis windows build #1 2020-10-27 17:00:29 -04:00
Roman Mogylatov
a66256a629 Merge branch 'release/4.1.4' into master 2020-10-27 14:36:22 -04:00
Roman Mogylatov
279910410e Bump version to 4.1.4 2020-10-27 14:36:11 -04:00
Roman Mogylatov
84888224a9 Fix .travis.yml 2020-10-27 14:29:28 -04:00
Roman Mogylatov
8381caec1e Test travic-ci.com 2020-10-27 14:24:23 -04:00
Roman Mogylatov
dfd0575e16 Revert "Add nl to readme"
This reverts commit 0938ccd46d.
2020-10-27 14:17:53 -04:00
Roman Mogylatov
27cebeb2c7 Revert "Remove nl from readme"
This reverts commit df3300588f.
2020-10-27 14:17:51 -04:00
Roman Mogylatov
df3300588f Remove nl from readme 2020-10-27 14:13:49 -04:00
Roman Mogylatov
0938ccd46d Add nl to readme 2020-10-27 14:13:37 -04:00
Roman Mogylatov
dd6de523cf Merge branch 'release/4.1.3' into master 2020-10-27 14:05:24 -04:00
Roman Mogylatov
969849e4da Bump version to 4.1.3 2020-10-27 14:05:16 -04:00
Roman Mogylatov
3b4fae8dca Add installation of certifi for windows ci builds 2020-10-27 14:04:52 -04:00
Roman Mogylatov
25d626e92f Migrate from travis-ci.org to travis-ci.com 2020-10-27 14:02:50 -04:00
Roman Mogylatov
ec0f9636bf Merge branch 'release/4.1.2' into master 2020-10-27 13:28:14 -04:00
Roman Mogylatov
c6e7551e87 Bump version to 4.1.2 2020-10-27 13:28:02 -04:00
Roman Mogylatov
cabeb6da55 Merge branch 'release/4.1.1' into master 2020-10-26 13:39:30 -04:00
Roman Mogylatov
b01ee7709c Bump version to 4.1.1 2020-10-26 13:39:13 -04:00
Roman Mogylatov
90af46da98 Merge branch 'release/4.1.0' into master 2020-10-24 20:58:22 -04:00
Roman Mogylatov
a3c7296879 Bump version to 4.1.0 2020-10-24 20:57:48 -04: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
5c1486e1a3
Un deprecate container decorators (#310)
* Remove deprecation warnings

* Add example and docs

* Update changelog
2020-10-22 12:00:46 -04:00
Roman Mogylatov
97731db180 Update license year 2020-10-21 17:06:12 -04:00
Roman Mogylatov
081fccea93 Add favicon 2020-10-21 17:01:31 -04:00
Roman Mogylatov
c81194682b Remove redirect in bages 2020-10-21 16:55:28 -04:00
Roman Mogylatov
3a9e64af8f Merge branch 'release/4.0.6' into master 2020-10-20 17:50:47 -04:00
Roman Mogylatov
c90f6c1b97 Bump version to 4.0.6 2020-10-20 17:50:31 -04:00
Roman Mogylatov
4ddac663d9
Fix wiring for package init (#308)
* Add test

* Add fix

* Add extra test

* Remove package imports on discovery for Python versions < 3.6

* Move wiring samples to a different directory
2020-10-20 17:48:54 -04:00
Roman Mogylatov
fa81cadf29 Merge branch 'release/4.0.5' into master 2020-10-19 17:35:26 -04:00
Roman Mogylatov
ca54db6d05 Bump version to 4.0.5 2020-10-19 17:35:12 -04:00
Roman Mogylatov
ff4d24706e
Move "provided" attribute (#306)
* Update typing stub

* Move attribute

* Add typing test

* Update docs

* Add test

* Update changelog
2020-10-19 17:21:38 -04:00
Roman Mogylatov
452a13c9f7
Update all links to docs to use https (#305)
* Update README

* Update docs

* Update examples

* Update changelog
2020-10-19 17:18:39 -04:00
Roman Mogylatov
ca9a2a5692 Merge branch 'release/4.0.4' into master 2020-10-18 22:28:08 -04:00
Roman Mogylatov
81c67f8b27 Bump version to 4.0.4 2020-10-18 22:27:53 -04:00
Roman Mogylatov
0ffa1e8392 Fix typing stub for container.override() method 2020-10-18 22:22:11 -04:00
Roman Mogylatov
4e5083693d Merge branch 'release/4.0.3' into master 2020-10-16 21:44:27 -04:00
Roman Mogylatov
44e0a03148 Bump version to 4.0.3 2020-10-16 21:44:12 -04:00
Roman Mogylatov
f1867b6bf4
Deprecate declarative container decorators (#303) 2020-10-16 21:43:21 -04:00
Roman Mogylatov
11ac677d42 Merge branch 'release/4.0.2' into master 2020-10-16 16:38:56 -04:00
Roman Mogylatov
619fa1f25c Bump version to 4.0.2 2020-10-16 16:38:37 -04:00
Roman Mogylatov
56c9023b2d
Fix override and copy decorator stubs (#302)
* Fix stubs and add tests

* Fix tests

* Fix stubs
2020-10-16 16:36:07 -04:00
Roman Mogylatov
88b3482ced Merge branch 'release/4.0.1' into master 2020-10-16 14:10:37 -04:00
Roman Mogylatov
09d1c4ce9f Bump versionto 4.0.1 2020-10-16 14:10:14 -04:00
Rüdiger Busche
819023e7aa
Make Configuration.from_ methods accept Path (#300)
Co-authored-by: rbusche <rbusche@inserve.de>
2020-10-16 13:57:28 -04:00
Roman Mogylatov
39f3f3a623 Merge branch 'release/4.0.0' into master 2020-10-09 16:22:40 -04:00
Roman Mogylatov
a6838dcb74 Fix README 2020-10-09 16:18:55 -04:00
Roman Mogylatov
f97c486811 Merge branch 'release/4.0.0' into master 2020-10-09 15:17:39 -04:00
Roman Mogylatov
846deaa4dc Bump version to 4.0.0 2020-10-09 15:17:23 -04:00
Roman Mogylatov
07d4f7e74f
Develop 4.0 (#298)
* Add wiring (#294)

* Add wiring module

* Fix code style

* Fix package test

* Add version fix

* Try spike for 3.6

* Try another fix with metaclass

* Downsample required version to 3.6

* Introduce concept with annotations

* Fix bugs

* Add debug message

* Add extra tests

* Add extra debugging

* Update config resolving

* Remove 3.6 generic meta fix

* Fix Flake8

* Add spike for 3.6

* Add Python 3.6 spike

* Add unwire functionality

* Add support of corouting functions

* Bump version to 4.0

* Updaet demo example

* Add pydocstyle ignore for demo

* Add flake8 ignore for demo

* Update aiohttp example

* Update flask example

* Rename aiohttp example directory

* Rename views module to handlers in aiohttp example

* Add sanic example

* Remove not needed images

* Update demo

* Implement wiring for Provide[foo.provider]

* Implement Provide[foo.provided.bar.baz.call()]

* Make flake8 happy

* Wiring refactoring (#296)

* Refactor wiring

* Add todos to wiring

* Implement wiring of config invariant

* Implement sub containers wiring + add tests

* Add test for wiring config invariant

* Add container.unwire() typing stub

* Deprecate ext package modules and remove types module

* Deprecate provider.delegate() method

* Add __all__ for wiring module

* Add protection for wiring only declarative container instances

* Bump version to 4.0.0a2

* Add wiring docs

* Add wiring of class methods

* Remove unused import

* Add a note on individuals import to wiring docs

* Add minor improvement to wiring doc

* Update DI in Python page

* Update key features

* Update README concep and FAQ

* Add files via upload

* Update README.rst

* Update README.rst

* Update README.rst

* Update docs index page

* Update README

* Remove API docs for flask and aiohttp ext

* Add wiring API docs

* Update docs index

* Update README

* Update readme and docs index

* Change wording in README

* Django example (#297)

* Add rough django example

* Remove sqlite db

* Add gitignore

* Fix flake8 and pydocstyle errors

* Add tests

* Refactor settings

* Move web app to to the root of the project

* Add bootstrap 4

* Add doc blocks for web app

* Add coverage

* Fix typo in flask

* Remove not needed newlines

* Add screenshot

* Update django app naming

* Add django example to the docs

* Update changelog

* Update Aiohttp example

* Add sanic example to the docs

* Make a little fix in django example docs page

* Add flask example to the docs

* Add aiohttp example to the docs

* Update installation docs page

* Fix .delegate() deprecation

* Refactor movie lister to use wiring

* Make micro cosmetic changes to flask, aiohttp & sanic examples

* Refactor single container example to use wiring

* Refactor multiple container example to use wiring

* Add return type to main() in application examples

* Refactor decoupled packages example to use wiring

* Refactor code layout for DI demo example

* Update wiring feature message

* Add more links to the examples

* Change code layout in miniapps

* Update sanic example

* Update miniapp READMEs

* Update wiring docs

* Refactor part of cli tutorial

* Refactor CLI app tutorial

* Update test coverage results in movie lister example and tutorial

* Make some minor updates to aiohttp and cli tutorials

* Refactor flask tutorial

* Make cosmetic fix in flask example

* Refactor Flask tutorial: Connect to the GitHub

* Refactor Flask tutorial: Search service

* Refactor Flask tutorial: Inject search service into view

* Refactor Flask tutorial: Make some refactoring

* Finish flask tutorial refactoring

* Update tutorials

* Refactor  asyncio monitoring daemon example application

* Fix tutorial links

* Rename asyncio miniapp

* Rename tutorial image dirs

* Rename api docs tol-level page

* Refactor initial sections of asyncio daemon tutorial

* Refactor asyncio tutorial till Example.com monitor section

* Refactor asyncio tutorial example.com monitor section

* Refactor asyncio tutorial httpbin.org monitor tutorial

* Refactor tests section of asyncio daemon tutorial

* Update conclusion of asyncio daemon tutorial

* Rename tutorial images

* Make cosmetic update to flask tutorial

* Refactor aiohttp tutorial: Minimal application section

* Refactor aiohttp tutorial: Giphy API client secion

* Refactor aiohttp tutorial secion: Make the search work

* Refactor aiohttp tutorial tests section

* Refactor aiohttp tutorial conclusion

* Upgrade  Cython to 0.29.21

* Update changelog

* Update demo example

* Update wording on index pages

* Update changelog

* Update code layout for main demo
2020-10-09 15:16:27 -04:00
Roman Mogylatov
53b7ad0275 Merge branch 'release/3.44.0' into master 2020-09-13 20:56:13 -04:00
Roman Mogylatov
1f136e427d Bump version to 3.44.0 2020-09-13 20:51:10 -04:00
Roman Mogylatov
9ee4959f76 Update README 2020-09-13 20:48:25 -04:00
Roman Mogylatov
39368591b9 Move generic types test to separate module 2020-09-13 20:38:23 -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
f56b5398ef Merge branch 'release/3.43.1' into master 2020-09-09 23:48:30 -04:00
Roman Mogylatov
6febd03646 Bump version to 3.43.1 2020-09-09 23:48:08 -04:00
Roman Mogylatov
0cddc4cf25 Merge branch 'release/3.43.0' into master 2020-09-09 23:36:33 -04:00
Roman Mogylatov
07f050d2ad Bump version to 3.43.0 2020-09-09 23:36:13 -04:00
Roman Mogylatov
203427aa97 Fix few typos 2020-09-09 23:34:59 -04:00
Roman Mogylatov
ffc477d1ee Update API docs 2020-09-09 22:23:28 -04:00
Roman Mogylatov
505ccf5a1d Fix a few typos 2020-09-09 22:23:14 -04:00
Roman Mogylatov
5740dd6df5 Remove not relevant "speech" example 2020-09-09 21:34:30 -04:00
Roman Mogylatov
ac8212a95b Merge branch 'release/3.42.0' into master 2020-09-09 18:02:53 -04:00
Roman Mogylatov
a305660a08 Bump version to 3.42.0 2020-09-09 18:02:37 -04:00
Roman Mogylatov
21764dbeec Fix sphinx warning 2020-09-09 17:59:44 -04:00
Roman Mogylatov
172c175e89 Fix some wording 2020-09-09 17:58:28 -04:00
Roman Mogylatov
8dcf6d99ce Update README 2020-09-09 17:56:48 -04:00
Roman Mogylatov
5cb7917a68 Update changelog 2020-09-09 17:53:19 -04:00
Roman Mogylatov
b4772af2c1 Update README 2020-09-09 17:53:00 -04:00
Roman Mogylatov
7e11d56ad6 Delete "What is DI?" documentation page 2020-09-09 17:52:45 -04:00
Roman Mogylatov
81ab8f807a Update DI in Python docs page 2020-09-09 17:39:49 -04:00
Roman Mogylatov
2b4d211207 Add ref marker to key features page 2020-09-08 21:57:37 -04:00
Roman Mogylatov
f75d90b21b Change wording in the "What is DI?" page 2020-09-08 21:27:57 -04:00
Roman Mogylatov
31f15c0a13 Merge branch 'release/3.41.0' into master 2020-09-07 22:07:22 -04:00
Roman Mogylatov
ba574660d8 Bump version to 3.41.0 2020-09-07 22:07:09 -04:00
Roman Mogylatov
2d28bc0d02 Add a link to the decoupled packages example to the introduction 2020-09-07 22:06:59 -04:00
Roman Mogylatov
039e51d4ba Delete mail service example mini app 2020-09-07 22:04:50 -04:00
Roman Mogylatov
139e67dd95 Delete api client example mini app 2020-09-07 22:02:33 -04:00
Roman Mogylatov
e1844a3040 Refactor factory of factories pattern example 2020-09-07 21:57:43 -04:00
Roman Mogylatov
8284d1f169 Refactor chained factories pattern example 2020-09-07 21:45:03 -04:00
Roman Mogylatov
d93c4a419b Update changelog 2020-09-07 12:34:49 -04:00
Roman Mogylatov
36ece67586 Add docs for the use cases example 2020-09-07 12:31:59 -04:00
Roman Mogylatov
f84d3e6f4e Refactor main module of the decoupled packages example 2020-09-07 12:05:12 -04:00
Roman Mogylatov
af51937004 Refactor main module 2020-09-07 12:03:49 -04:00
Roman Mogylatov
098ecb4eec Fix declarative container mypy stub 2020-09-07 11:53:03 -04:00
Roman Mogylatov
5306b27c48 Refactor password hashing example 2020-09-07 11:51:17 -04:00
Roman Mogylatov
e257fd9cb0 Merge branch 'release/3.40.0' into master 2020-09-06 21:55:17 -04:00
Roman Mogylatov
6d2a0382a7 Bump version to 3.40.0 2020-09-06 21:54:58 -04:00
Roman Mogylatov
29f209d382
Update bundles example (#292)
* Fix dependency provider stub issue with required init arg

* Refactor bundles example app

* Rename bundles package

* Rename bundles example container

* Rename bundles mini app to decoupled packages

* Move decoupled packages example to main examples

* Fix a typo

* Add meta
2020-09-06 21:51:38 -04:00
Roman Mogylatov
06bc0f1bac Merge branch 'release/3.39.0' into master 2020-09-04 23:23:16 -04:00
Roman Mogylatov
5bb9d221a5 Bump version to 3.39.0 2020-09-04 23:22:58 -04:00
Roman Mogylatov
bf978601ba
Refactor services miniapps (#291)
* Refactor services mini app with single container

* Make few little fixes to single container app

* Update requirements.txt for single container example

* Refactor multiple containers example

* Add single container docs page

* Create multiple containers page
2020-09-04 23:19:32 -04:00
Roman Mogylatov
d16e8817db Merge branch 'release/3.38.1' into master 2020-09-03 23:25:47 -04:00
Roman Mogylatov
72b2d0570f Bump version to 3.38.1 2020-09-03 23:25:32 -04:00
Roman Mogylatov
4ec3cce1d0 Merge branch 'release/3.38.0' into master 2020-09-03 23:22:32 -04:00
Roman Mogylatov
d6dbef0a75 Bump version to 3.38.0 2020-09-03 23:22:11 -04:00
Roman Mogylatov
0a10f32233 Remove old di demo 2020-09-03 23:21:09 -04:00
Roman Mogylatov
f0004c805f Fix typo 2020-09-03 23:13:17 -04:00
Roman Mogylatov
74df2ed00d Fix typo 2020-09-03 23:11:43 -04:00
Roman Mogylatov
14c2ecae8f Update "What is What is dependency injection?" documentation page 2020-09-03 23:09:21 -04:00
Roman Mogylatov
2cf5efa031 Merge branch 'release/3.37.0' into master 2020-09-03 18:06:01 -04:00
Roman Mogylatov
5f7d978012 Bump version to 3.37.0 2020-09-03 18:05:45 -04:00
Roman Mogylatov
b5b6c1f680 Fix flake8 warning in factory provided type example 2020-09-03 18:05:28 -04:00
Roman Mogylatov
913ce01475 Update key features 2020-09-03 18:03:21 -04:00
Roman Mogylatov
441cc66427 Improve singleton provider docs 2020-09-03 17:57:26 -04:00
Roman Mogylatov
ad260fe709 Add container usage to the custom provider example 2020-09-03 17:56:54 -04:00
Roman Mogylatov
d6e4e8fb08 Add container usage to provided instance examples 2020-09-03 17:48:45 -04:00
Roman Mogylatov
4f111aae9b Update provider overriding example to use container and fix bug 2020-09-03 17:42:15 -04:00
Roman Mogylatov
d61281a0b9 Add usage of the container to the selector example 2020-09-03 17:38:52 -04:00
Roman Mogylatov
e48746d65f Add usage of the container to the configuration examples 2020-09-03 17:37:03 -04:00
Roman Mogylatov
2a23f3d2f4 Add container usage for list provider example 2020-09-03 17:03:28 -04:00
Roman Mogylatov
6528411271 Add container usage for object provider example 2020-09-03 17:00:14 -04:00
Roman Mogylatov
b074d2aeb7 Add container usage for coroutine provider example 2020-09-03 16:59:11 -04:00
Roman Mogylatov
a497cb2527 Add container usage for callable provider example 2020-09-03 16:57:35 -04:00
Roman Mogylatov
1eb9020a4e Add container usage for all singleton provider examples 2020-09-03 16:56:01 -04:00
Roman Mogylatov
a7afa66e40 Add container usage for all factory provider examples 2020-09-03 16:51:12 -04:00
Roman Mogylatov
33b4416c2c Update readme 2020-09-03 16:28:11 -04:00
Roman Mogylatov
8b13a809e6 Edit feedback documentation page 2020-09-03 16:26:32 -04:00
Roman Mogylatov
ca986698e9 Update key features page and remove structure page 2020-09-03 16:20:04 -04:00
Roman Mogylatov
13286783d0
Delete README - coupling cohesion.png 2020-09-03 14:52:41 -04:00
Roman Mogylatov
b2b8d2f4cf
Add files via upload 2020-09-03 14:52:16 -04:00
Roman Mogylatov
f32363d259 Edit key features pages 2020-09-03 13:36:56 -04:00
Roman Mogylatov
f5758d842f Merge branch 'release/3.36.0' into master 2020-09-02 21:28:29 -04:00
Roman Mogylatov
063301a0b3 Bump version to 3.36.0 2020-09-02 21:28:09 -04:00
Roman Mogylatov
27ea3e3156 Update copyright year in the docs 2020-09-02 21:27:44 -04:00
Roman Mogylatov
6012d97a70 Remove not needed image from the docs 2020-09-02 21:27:24 -04:00
Roman Mogylatov
e29bf348ea Rename the container overriding docs page 2020-09-02 21:21:18 -04:00
Roman Mogylatov
580a9a66b5 Fix a typo in the custom provider docs 2020-09-02 21:21:07 -04:00
Roman Mogylatov
c2426d2a09 Update providers index page 2020-09-02 21:17:25 -04:00
Roman Mogylatov
dd2ded7321 Update documentation and example on creating a custom provider 2020-09-02 21:09:08 -04:00
Roman Mogylatov
aeace8cba5 Update documentation on injecting provided object attributes, items or method calls 2020-09-02 17:59:31 -04:00
Roman Mogylatov
e4ca126188 Update provider doc page headers 2020-09-02 17:33:02 -04:00
Roman Mogylatov
3eb7b9bc69 Add reference to provider overriding page 2020-09-02 17:25:20 -04:00
Roman Mogylatov
f8648adaf7 Update providers overriding documentation and rework examples 2020-09-02 16:59:25 -04:00
Roman Mogylatov
dcc59ab0f4 Merge branch 'release/3.35.1' into master 2020-09-01 21:58:30 -04:00
Roman Mogylatov
806bd31735 Bump version to 3.35.1 2020-09-01 21:58:13 -04:00
Roman Mogylatov
89fec6c905 Merge branch 'release/3.35.0' into master 2020-09-01 21:40:31 -04:00
Roman Mogylatov
0985635ea6 Bump version to 3.35.0 2020-09-01 21:40:14 -04:00
Roman Mogylatov
c4b33749d2
Providers docs update (#289)
* Update callable provider docs

* Update coroutine provider docs

* Edit object docs

* Edit list provider docs

* Edit configuration provider docs

* Edit selector provider docs

* Fix mypy stub of the ``DeclarativeContainer`` to specify the ``__init__`` interface

* Edit Dependency provider docs
2020-09-01 21:39:23 -04:00
Roman Mogylatov
995b2165df Update changelog 2020-09-01 16:05:58 -04:00
Roman Mogylatov
0bb30f91ef
Singleton docs update (#288)
* Update docblocks of factory provider examples

* Edit singleton docs
2020-09-01 16:04:48 -04:00
Roman Mogylatov
520945483f Merge branch 'release/3.34.0' into master 2020-08-31 21:29:26 -04:00
Roman Mogylatov
0d9aaaac0b Bump version to 3.34.0 2020-08-31 21:29:05 -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
f83d8ce143 Merge branch 'release/3.33.0' into master 2020-08-26 22:25:41 -04:00
Roman Mogylatov
3c27cd6ab2 Bump version to 3.33.0 2020-08-26 22:25:22 -04:00
Roman Mogylatov
2e940adb50
Typing stubs (#286)
* Add basic setup

* Add more tests for factory

* Add mypy checks to CI

* Add mypy checks to makefile command

* Add typing for the factories

* Add stub for Callable providers

* Add typing module and object provider stubs

* Fix typing test issue

* Remove typing module

* Add Delegate stub

* Add stub for Dependency provider

* Add stub for ExternalDependency

* Add stubs for providers module functions

* Add stubs for the DependenciesContainer provider

* Add stub for the CallableDelegate provider

* Add stubs for Coroutine providers

* Add stubs for the configuration options

* Add stub for the FactoryDelegate

* Add stub for the FactoryAggregate provider

* Add singleton stubs

* Add stubs for singletons

* Add stub for the List provider

* Add stub for the Container provider

* Add stub for the Selector provider

* Add stubs for the dynamic container

* Add stub for the declarative container

* Add stubs for the extensions

* Add types module for explicit provider typing

* Set absolute import mode for the providers module and add types module test

* Skip typing test for Python 3.5

* Remove coroutine test from py35

* Fix py35 tests

* Add \n to the tox.ini
2020-08-26 22:24:20 -04:00
Roman Mogylatov
47f4279ccd Merge branch 'release/3.32.3' into master 2020-08-26 16:35:51 -04:00
Roman Mogylatov
15acccf48f Bump version to 3.32.3 2020-08-26 16:35:31 -04:00
Roman Mogylatov
0c868fc0db Merge branch 'release/3.32.2' into master 2020-08-26 16:25:20 -04:00
Roman Mogylatov
cc7ade89d7 Bump version to 3.32.2 2020-08-26 16:24:59 -04:00
Roman Mogylatov
9d85b63c3b Make a fix in the providers delegation example 2020-08-26 16:22:54 -04:00
Roman Mogylatov
2b30e172d1 Merge branch 'release/3.32.1' into master 2020-08-25 10:27:41 -04:00
Roman Mogylatov
3f94a900a4 Bump version to 3.32.1 2020-08-25 10:27:24 -04:00
Roman Mogylatov
6c7c9eaa47 Update example 2020-08-25 10:27:11 -04:00
Roman Mogylatov
0f952b5915 Merge branch 'release/3.32.0' into master 2020-08-24 13:38:25 -04:00
Roman Mogylatov
fcbab97db2 Bump version to 3.32.0 2020-08-24 13:38:08 -04:00
Roman Mogylatov
f5b97ca92e
Configuration option typed injections (#284)
* Add implementation and tests

* Add docs page and examples

* Revert the api_client miniapp accidental changes
2020-08-24 13:34:47 -04:00
Roman Mogylatov
69ebc19b5f Merge branch 'release/3.31.0' into master 2020-08-20 21:59:25 -04:00
Roman Mogylatov
cc8536b5e4 Bump version to 3.31.0 2020-08-20 21:59:09 -04:00
Roman Mogylatov
c05f2b2e42 Add JarnoRFB to the list of contributors 2020-08-20 21:53:16 -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
50a9dda192 Merge branch 'release/3.30.4' into master 2020-08-16 01:16:40 -04:00
Roman Mogylatov
e15a6dbb1d Bump version to 3.30.4 2020-08-16 01:16:25 -04:00
Roman Mogylatov
597f6794a9 Merge branch 'release/3.30.3' into master 2020-08-16 01:13:47 -04:00
Roman Mogylatov
01a18bc2ff Bump version to 3.30.3 2020-08-16 01:13:32 -04:00
Roman Mogylatov
d2828519b4 Update container overriding docs 2020-08-16 01:10:08 -04:00
Roman Mogylatov
75c65f334e Update container provider type specialization docs 2020-08-16 00:53:37 -04:00
Roman Mogylatov
cfdcbaa77a Improve declarative and dynamic container docs 2020-08-15 22:09:41 -04:00
Roman Mogylatov
e0fa746d7f Update DI Demo 2 2020-08-15 11:01:58 -04:00
Roman Mogylatov
e479e2cb94 Update the declarative container docs 2020-08-14 16:27:17 -04:00
Roman Mogylatov
925801c73f Add overriding demo to the README 2020-08-14 15:49:31 -04:00
Roman Mogylatov
684745a6b4 Add providers overriding to demo 2 2020-08-14 15:31:33 -04:00
Roman Mogylatov
88866d596b Merge branch 'release/3.30.2' into master 2020-08-13 22:57:51 -04:00
Roman Mogylatov
ac6412bd41 Bump version to 3.30.2 2020-08-13 22:57:34 -04:00
Roman Mogylatov
32a4add687 Merge branch 'release/3.30.1' into master 2020-08-13 21:55:02 -04:00
Roman Mogylatov
f67dab1f03 Bump version to 3.30.1 2020-08-13 21:53:13 -04:00
Roman Mogylatov
3ddf131180 Merge branch 'release/3.30.0' into master 2020-08-12 17:07:01 -04:00
Roman Mogylatov
2f42de9fa1 Bump version to 3.30.0 2020-08-12 17:06:40 -04:00
Roman Mogylatov
5358dd85f1
Movie lister example rework (#280)
* Rework movie lister example app

* Code style fix

* Doc block fix

* Update the container

* Make second round of the refactoring

* Rename name to title

* Remove old movie lister docs from the examples

* Add fixtures generator output on success

* Update docblock in the entities module

* Update example readme

* Add CLI app tutorial

* Update some wording in the other tutorials

* Spread link to the tutorial

* Fix code indentation issue
2020-08-12 17:04:46 -04:00
Roman Mogylatov
ca18fea26c Merge branch 'release/3.29.0' into master 2020-08-10 22:32:40 -04:00
Roman Mogylatov
3c69b4683f Bump version to 3.29.0 2020-08-10 22:32:29 -04:00
Roman Mogylatov
bb1403b5e9 Update docs index and key features page 2020-08-10 22:29:25 -04:00
Roman Mogylatov
1c189c47e2
Update README.rst (#279)
* Make the message direct
* Emphasise the differences
* Change example code
* Add FAQ
2020-08-10 22:23:12 -04:00
Roman Mogylatov
d8102a825f Merge branch 'release/3.28.1' into master 2020-08-10 15:51:01 -04:00
Roman Mogylatov
ed2a795581 Bump version to 3.28.1 2020-08-10 15:50:51 -04:00
Roman Mogylatov
c9762ce6fa Fix typos in asyncio daemon tutorial 2020-08-10 15:49:44 -04:00
Roman Mogylatov
2bef0229d9 Merge branch 'release/3.28.0' into master 2020-08-08 14:49:26 -04:00
Roman Mogylatov
d3f3b58389 Bump version to 3.28.0 2020-08-08 14:49:08 -04:00
Roman Mogylatov
3a61457be7
Asyncio daemon tutorial (#278)
* Fix a typo in the docblock of the Configuration provider

* Update the changelog

* Add tutorial sections

* Switch to use https for httpbin.org requests

* Add what we are going to build section

* Fix ``Makefile`` to run ``aiohttp`` integration tests on Python 3.5+

* Add prerequisities and prepare the env sections

* Add logging, config and the dispacher sections

* Change logging

* Fix multiple typos in the ``flask`` and ``aiohttp`` tutorials

* Add the initial and dirty version

* Fix multiple typos in the ``flask`` and ``aiohttp`` tutorials

* Fix the 3.27.0 changelog

* Finish all the parts before the dispatcher

* Finish dispatcher section

* Update http monitor logging format

* Finish the tutorial

* Fix docblock in the dispatcher module

* Update changelog

* Add meta keywords and description
2020-08-08 14:48:05 -04:00
Roman Mogylatov
2ff36b44ab Merge branch 'release/3.27.0' into master 2020-08-06 16:46:08 -04:00
Roman Mogylatov
0cb45bbc1c Update the docblock of the example 2020-08-06 16:45:00 -04:00
Roman Mogylatov
5bf5a7651b Bump version to 3.27.0 2020-08-06 16:42:49 -04:00
Roman Mogylatov
9b30752da2 Update docs 2020-08-06 16:42:31 -04:00
Roman Mogylatov
4a8133204c
Factory deep init injections (#277)
* Add factory deep context providing

* Add example

* Add test
2020-08-06 16:33:06 -04:00
Roman Mogylatov
2fc3606671
Asyncio daemon example (#276)
* Add prototype

* Update .pydocstylerc

* Add tests

* Remove one of the tests

* Fix typo in the giphynav-aiohttp

* Add README

* Fix flake8
2020-08-05 22:11:26 -04:00
Roman Mogylatov
dc9c1dde3f Merge branch 'release/3.26.0' into master 2020-08-03 18:09:10 -04:00
Roman Mogylatov
1f302ec74c Bump version to 3.26.0 2020-08-03 18:08:53 -04:00
Roman Mogylatov
a202335519 Update giphynav-aiohttp to remove doubled "if not query" 2020-08-03 18:07:04 -04:00
Roman Mogylatov
ea1e79885c
274 Configuration provider redesign (#275)
* Get 1st stable version

* Remove prototype module

* Try fix copying

* Add config itemselector example

* Add doc blocks
2020-08-03 18:01:20 -04:00
Roman Mogylatov
459ff5fcf5 Merge branch 'release/3.25.1' into master 2020-07-30 13:53:58 -04:00
Roman Mogylatov
6fccb6eec1 Bump version to 3.25.1 2020-07-30 13:53:37 -04:00
Roman Mogylatov
45e6b943f6 Fix typos in aiohttp tutorial 2020-07-30 13:52:42 -04:00
Roman Mogylatov
299a7bca89 Merge branch 'release/3.25.0' into master 2020-07-29 22:20:53 -04:00
Roman Mogylatov
978ebda9eb Bump version to 3.25.0 2020-07-29 22:20:34 -04:00
Roman Mogylatov
d2f4585a8b
Aiohttp tutorial (#273)
* Make a code style change to the giphynav-aiohttp app

* Make minimal punctuation changes for the flask tutorial

* Add parts of http tutorial

* Fix few issues in the flask tutorial

* Make some cosmetic changes to test data

* Fix typo in flask tutorial

* Add more tutorial sections
2020-07-29 22:17:56 -04:00
Roman Mogylatov
97577d84e4
Revert "Aiohttp tutorial (#271)" (#272)
This reverts commit adcea61657.
2020-07-29 22:16:40 -04:00
Roman Mogylatov
adcea61657
Aiohttp tutorial (#271)
* Make a code style change to the giphynav-aiohttp app

* Make minimal punctuation changes for the flask tutorial

* Add parts of http tutorial

* Fix few issues in the flask tutorial

* Make some cosmetic changes to test data

* Fix typo in flask tutorial
2020-07-29 22:16:02 -04:00
Roman Mogylatov
577c7854da Merge branch 'release/3.24.1' into master 2020-07-29 12:18:24 -04:00
Roman Mogylatov
4ca385d73b Bump version to 3.24.1 2020-07-29 12:18:09 -04:00
Roman Mogylatov
469cb37302 Merge branch 'release/3.24.0' into master 2020-07-28 20:57:46 -04:00
Roman Mogylatov
c190e049b5 Bump version to 3.24.0 2020-07-28 19:26:41 -04:00
Roman Mogylatov
ed2fc618f1 Fix coverage 2020-07-28 19:25:02 -04:00
Roman Mogylatov
e0d81c2d28
Aiohttp integration (#270)
* Add aiohttp extension module

* Add giphynav-aiohttp app

* Add missing docstrings

* Remove print() call

* Remove not needed import from flask extension tests

* Improve coroutine provider tests

* Add aiohttp extension tests

* Update tox.ini

* Add aiohttp extras

* Try fix Python 3.4 tests

* Try fix 3.6 tests

* Stop running coroutine tests for Python 3.4

* Rename tests

* Remove type hints

* Fix pypy and change python version for coverage job to 3.8

* Fix coveralls job

* Try fix Python 3.4, 3.5 tests

* Make coverage job to run 3.5+ tests

* Add tests

* Add readme

* Update the readmes

* Add API docs

* Add API docs page

* Update changelog
2020-07-28 19:19:05 -04:00
Roman Mogylatov
bed547cc91 Merge branch 'release/3.23.2' into master 2020-07-23 20:49:32 -04:00
Roman Mogylatov
8f5ea52303 Bump version to 3.23.2 2020-07-23 20:49:08 -04:00
Roman Mogylatov
adf77c2399
Fix flask tutorial (#269)
* Fix highlight

* Fix flask tutorial rst issues

* Fix some wording
2020-07-23 20:47:35 -04:00
Roman Mogylatov
4a1caf7300 Merge branch 'release/3.23.1' into master 2020-07-22 12:17:57 -04:00
Roman Mogylatov
00d91ae829 Bump version to 3.23.1 2020-07-22 12:17:37 -04:00
Roman Mogylatov
1f115111b2
Dependency provider issue with abc (#267)
* Fix the issue

* Add the test

* Update tests

* Update changelog

* Update tests
2020-07-22 12:14:26 -04:00
Roman Mogylatov
cfbed20a05 Merge branch 'release/3.23.0' into master 2020-07-20 17:02:52 -04:00
Roman Mogylatov
93adbe5207 Bump version to 3.23.0 2020-07-20 17:02:32 -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
3ee629eb5d Merge branch 'release/3.22.0' into master 2020-07-18 00:45:22 -04:00
Roman Mogylatov
78b7be218b Bump version to 3.22.0 2020-07-18 00:45:06 -04:00
Roman Mogylatov
b3c0a79725 Update the changelog 2020-07-18 00:44:11 -04:00
Roman Mogylatov
6eff213a68
Migrate to alabaster (#264)
* Add bootstrap and remove created at from ghnav-flask app

* Update readme

* Add logo to the docs

* Update key features description

* Update README

* Change headers of API docs

* Add alabaster theme config

* Update docs index

* Add tutorials section

* Update what is DI page

* Update DI in Python page

* Update tutorials index page

* Update provider docs

* Update container docs

* Update examples docs
2020-07-18 00:40:14 -04:00
Roman Mogylatov
8a2a88ccc9 Merge branch 'release/3.21.2' into master 2020-07-13 23:29:49 -04:00
Roman Mogylatov
8b2486c5e5 Bump version to 3.21.2 2020-07-13 23:29:32 -04:00
Roman Mogylatov
f05c6bef29 Merge branch 'release/3.21.1' into master 2020-07-13 23:10:18 -04:00
Roman Mogylatov
5ada7f24dd Bump version to 3.21.1 2020-07-13 23:09:42 -04:00
Roman Mogylatov
0c77e73d51 Merge branch 'release/3.21.0' into master 2020-07-13 22:50:22 -04:00
Roman Mogylatov
73cfc873ce Bump version to 3.21.0 2020-07-13 22:50:02 -04:00
Roman Mogylatov
72147b664e Re-design Flask integration 2020-07-13 22:45:15 -04:00
Roman Mogylatov
359dce2978 Make cosmetic fixes for `Selector` provider docs 2020-07-13 15:36:07 -04:00
Roman Mogylatov
70d6e8c68f Merge branch 'release/3.20.1' into master 2020-07-11 13:19:41 -04:00
Roman Mogylatov
24addb65eb Fix README 2020-07-11 13:18:52 -04:00
Roman Mogylatov
a2ac13c551
Update README.rst 2020-07-11 13:15:27 -04:00
Roman Mogylatov
a782170579 Update README 2020-07-11 13:10:46 -04:00
Roman Mogylatov
0b906be150
Update README.rst 2020-07-11 13:08:07 -04:00
Roman Mogylatov
b6bf490239 Update README 2020-07-11 13:07:28 -04:00
Roman Mogylatov
603ecf0838 Update README 2020-07-11 13:06:16 -04:00
Roman Mogylatov
8dc1e9d4a4 Update README with unicode for emoji 2020-07-11 13:02:30 -04:00
Roman Mogylatov
3c2b6bb558 Merge branch 'release/3.20.1' into master 2020-07-11 12:43:15 -04:00
Roman Mogylatov
4f753c8fd3 Bump version to 3.20.1 2020-07-11 12:42:55 -04:00
Roman Mogylatov
21cdd0aa3c Merge branch 'release/3.20.0' into master 2020-07-11 12:16:31 -04:00
Roman Mogylatov
d6176dc754 Bump version to 3.20.0 2020-07-11 12:16:08 -04:00
Roman Mogylatov
fa469618dd
Readme update (#263)
* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Add files via upload

* Update README.rst

* Rename Blank Diagram (1).svg to di-map.svg

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Add files via upload

* Rename Blank Diagram (2).svg to di-map2.svg

* Update README.rst

* Update README.rst

* Update README.rst

* Update README.rst

* Add files via upload

* Add files via upload

* Rename README.svg to di-map3.svg

* Update README.rst

* Add files via upload

* Rename README - Page 3.svg to di-map4.svg

* Update README.rst

* Add files via upload

* Rename README - Copy of Page 3.svg to di-map5.svg

* Update README.rst

* Delete di-map.svg

* Delete di-map2.svg

* Delete di-map3.svg

* Delete di-map4.svg

* Update README.rst

* Update README.rst

* Add Github Navigator - Flask application

* Do more refactoring for ghnav-flask

* More refactoring

* Update README

* Add tests

* Update readme

* Add Flask extension

* Add Factory.provides attribute

* Add Flask extension module

* User flask extension in githubnavigator example

* Add README for ghnav-flask

* Update ghnav-flask README

* Update ghnav-flask README

* Update README with ghnav container example

* Move ghnav-flask to miniapps/ folder

* Fix auth token reading from env for ghnav-flask

* Update readme

* Fix ghnav-flask linter errors

* Add downloads and wheel badge

* Add tests for flask extension

* Fix flask tests

* Add requirements-ext.txt installation to tox.ini

* Add API docs for ext.flask module

* Update setup.py

* Add Flask to the list of keywords

* Update badges on docs README

* Update docs README title

* Fix ext.flask tests

* Fix syntax of ext.flask for Python 2.7, 3.4, 3.5

* Fix syntax of ext.flask for Python 2.7, 3.4, 3.5

* Fix imports in ext.flask for Python 2.7, 3.4, 3.5

* Update ghfnav-flask README

* Update ghfnav-flask README

* Remove setting of empty github token

* Add flask extras

* Update requirements

* Update requirements

* Add flask extra to python 3.4 tox.ini

* Update changelog

* Update changelog
2020-07-11 12:15:00 -04:00
Roman Mogylatov
f4c713fc22 Merge branch 'release/3.19.2' into master 2020-07-02 22:08:32 -04:00
Roman Mogylatov
a8135c0628 Bump version to 3.19.2 2020-07-02 22:08:12 -04:00
Roman Mogylatov
f130d41dbc
Logo (#261)
* Try logo placement

* Remove readme header

* Experiment with badges

* Add space

* Update logo

* Remove spaces

* Update README.rst

* Remove header

* Update README.rst

* Move logo to wiki

* Add github badges

* Remove github badges

* Update docs index page
2020-07-02 22:07:07 -04:00
Roman Mogylatov
ec3be85cf7 Merge branch 'release/3.19.1' into master 2020-07-01 23:20:42 -04:00
Roman Mogylatov
5e84f3145e Update makefile 2020-07-01 23:20:28 -04:00
Roman Mogylatov
0da9f2c6b5 Update travis config to publish to real pypi 2020-07-01 23:18:41 -04:00
Roman Mogylatov
cc90f66dc8 Bump version to 3.19.1 2020-07-01 23:17:29 -04:00
Roman Mogylatov
4a82aa18c3
Wheels (#260)
* Update .travis.yml

* Update .travis.yml

* Add cibuildwheel jobs

* Point twine to testpypi

* Add test suffix to version

* Try to fix windows builds

* Change version to 3.19.0.a2

* Remove build dependencies from dev requirements

* Add condition to trigger build on tags

* Bump version to 3.19.0a3

* Target sdist job to publish to testpypi

* Upgrade travis config

* Bump version to 3.19.0a4

* Return version

* Update changelog

* Update makefile
2020-07-01 23:16:38 -04:00
Roman Mogylatov
75a9f6faf0 Update changelog 2020-06-30 17:32:16 -04:00
Roman Mogylatov
18bac2b1d6 Fix travis config warnings 2020-06-30 17:31:01 -04:00
Roman Mogylatov
f84daf6467 Add default os and dist to travis config 2020-06-30 17:04:47 -04:00
Roman Mogylatov
dfe61826b0 Rename matrix to jobs at travis config 2020-06-30 17:02:54 -04:00
Roman Mogylatov
0126fdb522 Remove sudo from travis config 2020-06-30 17:01:52 -04:00
Roman Mogylatov
f8b78443f9 Encrypt slack token at travis config 2020-06-30 17:00:23 -04:00
Roman Mogylatov
1ca6f303c9 Update changelog 2020-06-30 16:44:01 -04:00
Roman Mogylatov
8681500236
Start using twine for dist uploading to PyPI (#259) 2020-06-30 16:40:30 -04:00
Roman Mogylatov
17621d9fd7 Merge branch 'release/3.19.0' into master 2020-06-29 16:41:32 -04:00
Roman Mogylatov
1a5e7baf7b Bump version to 3.19.0 2020-06-29 16:34:05 -04:00
Roman Mogylatov
a0a3da8f72 Improve List and Configuration provider docs 2020-06-29 16:32:48 -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
783be3ad36 Merge branch 'release/3.18.1' into master 2020-06-25 23:49:37 -04:00
Roman Mogylatov
284b258879 Add docs for environment varibles interpolation in the Configuration provider 2020-06-25 23:48:55 -04:00
Roman Mogylatov
7491fc05a2 Fix ini files parsing 2020-06-25 23:37:01 -04:00
Roman Mogylatov
1cd25e701f Add interpolation of environment variables for Configuration provider 2020-06-25 23:16:19 -04:00
Roman Mogylatov
5718140a82 Merge branch 'release/3.18.0' into master 2020-06-25 18:06:58 -04:00
Roman Mogylatov
525ddbc24c Bump version to 3.18.0 2020-06-25 18:06:37 -04:00
Roman Mogylatov
f176b02045 Add flake8 config 2020-06-25 18:01:15 -04:00
Roman Mogylatov
62e1995a7d Add configuration provider docs 2020-06-25 17:12:16 -04:00
Roman Mogylatov
507a832bb8 Add Configuration.from_env() method + refactoring 2020-06-25 12:50:42 -04:00
Roman Mogylatov
3217feb73b Update providers.pyx code style 2020-06-24 21:27:40 -04:00
Roman Mogylatov
e5275cf3f2 Skip yaml testing for on Python 3.4 2020-06-24 21:23:29 -04:00
Roman Mogylatov
65db4f2b1d Fix code style issue 2020-06-24 21:23:05 -04:00
Roman Mogylatov
ad2d8155d4 Remove yaml stub in providers module 2020-06-24 21:13:37 -04:00
Roman Mogylatov
c8b0fa22af Add yaml extras install to tox.ini 2020-06-24 21:07:57 -04:00
Roman Mogylatov
e22edcdadd Restore configuration methods 2020-06-24 21:04:30 -04:00
Roman Mogylatov
0dad8727cf Fix setup.py 2020-06-24 21:01:33 -04:00
Roman Mogylatov
1a23b8b6f5 Try type(dict) fix 2020-06-24 17:38:52 -04:00
Roman Mogylatov
50d8363650 Pin virtualenv to 20.0.23 2020-06-24 17:26:58 -04:00
Roman Mogylatov
52c98bbe49 Comment yaml-related code 2020-06-24 17:16:46 -04:00
Roman Mogylatov
f7871dfc49 Update extras in tox.ini 2020-06-24 16:46:48 -04:00
Roman Mogylatov
597f5d772f Add default value for name argument of Configuration provider 2020-06-24 16:40:53 -04:00
Roman Mogylatov
a76744805a Add Configuration.from_yaml method 2020-06-24 16:29:44 -04:00
Roman Mogylatov
2c43a1c426 Remove undocumented positional parameter of DependenciesContainer provider 2020-06-24 14:39:07 -04:00
Roman Mogylatov
feab6b6814 Revert "Add overriding logic for Container provider"
This reverts commit b727be3f9a.
2020-06-24 13:24:57 -04:00
Roman Mogylatov
b727be3f9a Add overriding logic for Container provider 2020-06-24 12:41:18 -04:00
Roman Mogylatov
f95dadfc23 Add Configuration.from_dict() method 2020-06-23 18:09:20 -04:00
Roman Mogylatov
a985952d0c Fix Configuration.from_ini() to support Python 2 2020-06-23 16:53:22 -04:00
Roman Mogylatov
87bb5ff97d Add Configuration.from_ini() method 2020-06-23 16:46:24 -04:00
Roman Mogylatov
3a0c746430 Merge branch 'release/3.17.1' into master 2020-06-23 12:48:37 -04:00
Roman Mogylatov
1e13727a94 Bump version to 3.17.1 2020-06-23 12:48:01 -04:00
Roman Mogylatov
2fd216bb5a Hotfix dynamic container deep-copying 2020-06-23 12:47:48 -04:00
Roman Mogylatov
827f9b57bb Merge branch 'release/3.17.0' into master 2020-06-23 12:14:28 -04:00
Roman Mogylatov
69e2230b80 Bump version to 3.17.0 2020-06-23 12:14:06 -04:00
Roman Mogylatov
c8b781e744
Container provider (#256)
* Add unit tests

* Add Container provider

* Update changelog
2020-06-22 22:45:16 -04:00
Roman Mogylatov
e6f096270e
Config linking (#255)
* Add config linking test

* Add provider linking

* Update changelog
2020-06-22 21:52:00 -04:00
Roman Mogylatov
86021f2948 Merge branch 'release/3.16.1' into master 2020-06-16 22:34:36 -04:00
Roman Mogylatov
7c3d961ae7 Bump version to 3.16.1 2020-06-16 22:34:19 -04:00
Roman Mogylatov
761fc84658 Update disqus.js 2020-06-16 22:32:47 -04:00
Roman Mogylatov
d90a490987 Add RobinsonMa to the list of contributors 2020-06-16 22:25:41 -04:00
Roman Mogylatov
eadac4b1cc Fix warnings in API docs 2020-06-16 22:22:06 -04:00
RobinsonMa
c136663071
Update singleton_thread_locals.py (#252)
* Update singleton_thread_locals.py

fix

* Update singleton_thread_locals.py

* Update singleton_thread_locals.py
2020-06-16 21:53:00 -04:00
Roman Mogylatov
a0d4af15e9 Fix warnings at changelog 2020-06-16 21:40:01 -04:00
Roman Mogylatov
877275e7fc Fix warning at docs/conf.py 2020-06-16 21:39:34 -04:00
Roman Mogylatov
29243ccdda Fix make docs-live 2020-06-16 21:39:11 -04:00
Roman Mogylatov
cc1043eb82 Fix disqus.js 2020-06-16 21:38:54 -04:00
Roman Mogylatov
efd6e3e7e5 Merge branch 'release/3.16.0' into master 2020-06-14 17:50:28 -04:00
Roman Mogylatov
dd7c951ea6 Bump version to 3.16.0 2020-06-14 17:49:57 -04:00
Roman Mogylatov
8f2c397413 Add support of six 1.15.0 2020-06-14 17:43:06 -04:00
Roman Mogylatov
af7297ce71 Update Cython version 2020-06-14 17:38:24 -04:00
Roman Mogylatov
b6f6f63764 Add docs-live command to makefile 2020-06-14 17:35:25 -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
d8ecd28b22 Add Bruno P. Kinoshita to the list of contributors 2020-06-13 23:28:40 -04:00
Bruno P. Kinoshita
910dec38a4
Fix a few typos (#250)
* Fix a few typos

* Spell, grammar checkers on docs
2020-06-13 22:24:32 -04:00
Roman Mogylatov
ebd98bebe9 Merge branch 'release/3.15.6' into master 2020-02-18 17:53:10 -05:00
Roman Mogylatov
fac768496e Bump version to 3.15.6 2020-02-18 17:52:46 -05:00
Roman Mogylatov
b3eb05f705 Merge branch 'release/3.15.5' into master 2020-02-18 17:51:36 -05:00
Roman Mogylatov
6c81568888 Bump version to 3.15.5 2020-02-18 17:50:56 -05:00
Roman Mogylatov
a0349305db Update downloads link 2020-02-18 17:49:37 -05:00
Roman Mogylatov
68a0f4b5f0 Add downloads badge 2020-02-18 17:48:20 -05:00
Roman Mogylatov
5e6a4ce1ec Merge branch 'release/3.15.4' into master 2020-01-26 20:37:43 -05:00
Roman Mogylatov
b00edad1b9 Bump version to 3.15.4 2020-01-26 20:37:13 -05:00
Roman Mogylatov
92e91a3fdf Merge branch 'release/3.15.3' into master 2020-01-26 20:33:13 -05:00
Roman Mogylatov
78dd3ec744 Add more docs fixes for 3.15.3 2020-01-26 20:32:16 -05:00
Roman Mogylatov
f8ddf1b19b Bump version to 3.15.3 2020-01-26 19:53:06 -05:00
Roman Mogylatov
0dae54df18 Merge branch 'release/3.15.2' into master 2020-01-26 19:34:04 -05:00
Roman Mogylatov
7ce170a1d9 Bump version to 3.15.2 2020-01-26 19:33:28 -05:00
Roman Mogylatov
363b87fd74 Merge branch 'release/3.15.1' into master 2020-01-26 19:17:46 -05:00
Roman Mogylatov
b09868233c Bump version to 3.15.1 2020-01-26 19:17:03 -05:00
Roman Mogylatov
febae1b64c Update engines-cars example 2020-01-26 19:13:57 -05:00
Roman Mogylatov
b9f68d18a9 Fix README typos 2020-01-26 19:04:23 -05:00
Roman Mogylatov
a58e300707 Merge branch 'release/3.15.0' into master 2020-01-26 18:56:37 -05:00
Roman Mogylatov
4d9d12a2ed Bump version to 3.15.0 2020-01-26 18:55:33 -05:00
Roman Mogylatov
c20202a23d Refactor passlib password hasing example 2020-01-26 18:55:04 -05:00
Roman Mogylatov
cf44e5815d Refactor example modules in Python3-ish way 2020-01-26 18:41:36 -05:00
Roman Mogylatov
06ff4bbbe4 Clean up tox.ini file 2020-01-26 15:15:50 -05:00
Roman Mogylatov
5c1174fad6
PyPy 3 support (#242)
* Add PyPy 3 to travis file

* Add record to changelog
2020-01-26 15:10:51 -05:00
Roman Mogylatov
953f93631b
Python 3.8 support (#241)
* Add Python 3.8 test environment

* Add Python 3.8 classifier

* Update max compatible version of six to 1.13.0

* Update max compatible version of six to 1.14.0

* Add record to the changelog
2020-01-26 15:00:21 -05:00
Roman Mogylatov
ed8053fce1 Refactor changelog 2020-01-26 14:28:15 -05:00
Roman Mogylatov
b876d001df Regenerate C sources using Cython 0.29.14 2020-01-26 14:27:23 -05:00
Roman Mogylatov
23642e49f4 Fix PEP257 doc block errors in example modules. 2020-01-26 14:22:43 -05:00
Roman Mogylatov
2c7b082301 Merge branch 'release/3.14.12' into master 2019-10-09 10:46:26 -04:00
Roman Mogylatov
d58a10a2c5 Bump version to 3.14.12 2019-10-09 10:46:08 -04:00
Roman Mogylatov
08de710b2f
235 Fix Delegate cannot be used in overridden container (#236)
* Add test for bug #235

* Fix issue + refactoring

* Update changelog
2019-10-09 10:45:14 -04:00
Roman Mogylatov
8026e106a5 Merge branch 'release/3.14.11' into master 2019-10-08 14:46:50 -04:00
Roman Mogylatov
fb264a8379 Bump version to 3.14.11 2019-10-08 14:46:26 -04:00
Roman Mogylatov
7e61412b8a
231 Fix object provider copies provided object issue (#233)
* Add test that reproduces the issue

* Fix the issue

* Add a note about fix in changelog
2019-10-08 14:45:12 -04:00
Roman Mogylatov
2684b79103 Merge branch 'release/3.14.10' into master 2019-08-17 21:24:42 -04:00
Roman Mogylatov
e48af3212e Make 3.14.10 micro release 2019-08-17 21:24:26 -04:00
Roman Mogylatov
75ffa8dd93 Merge branch 'release/3.14.9' into master 2019-08-17 21:09:31 -04:00
Roman Mogylatov
31642f4eca Update changelog 2019-08-17 21:08:53 -04:00
Roman Mogylatov
642fd7397e Bump version to 3.14.9 2019-08-17 21:08:42 -04:00
Roman Mogylatov
2b51a6e5f2 Add supakeen to the list of contributors 2019-08-17 21:07:19 -04:00
supakeen
3069910606 Minor English nitpicking. (#227) 2019-08-17 20:57:10 -04:00
Roman Mogylatov
0568e402a1 Merge branch 'release/3.14.8' into master 2019-07-29 15:25:16 -04:00
Roman Mogylatov
e5f437ff8d Add changelog for 3.14.8 2019-07-29 15:24:55 -04:00
Roman Mogylatov
0ac1a10336
Regenerate C sources using Cython 0.29.13 (#226) 2019-07-29 15:24:00 -04:00
Roman Mogylatov
e1b9303797 Merge branch 'release/3.14.7' into master 2019-06-07 10:03:40 -04:00
Roman Mogylatov
ecae4c2296 Bump version to 3.14.7 2019-06-07 10:03:11 -04:00
Dmitry
bcbdc7d6ad Fix typo (#221)
* Fix typo. (#214)

* Fix typo

* Update the title tildas
2019-06-07 09:55:30 -04:00
Roman Mogylatov
35cb351e72 Merge branch 'release/3.14.6' into master 2019-05-09 15:02:28 -04:00
Roman Mogylatov
3ced0ed37a Bump version to 3.14.6 2019-05-09 14:58:54 -04:00
Roman Mogylatov
215b45b442
FactoryAggregate copying issue fix (#220)
* Add test

* Implement deepcopy handler for FactoryAggregate provider

* Add more granularity for the test

* Update changelog

* Refactor test
2019-05-09 14:58:04 -04:00
Roman Mogylatov
cae4d8cdf2
Update Cython to 0.29.7 (#219) 2019-05-09 14:35:27 -04:00
Roman Mogylatov
d04fe41eb1 Merge branch 'release/3.14.5' into master 2019-03-21 22:23:23 -04:00
Roman Mogylatov
b2a3404007 Bump version to 3.14.5 2019-03-21 22:22:57 -04:00
Roman Mogylatov
efdae17b57 Regenerate C sources using Cython 0.29.6 2019-03-21 22:22:09 -04:00
Roman Mogylatov
a39f873693 Add Jeroen Rietveld to the list of contributors 2019-03-21 22:11:13 -04:00
Roman Mogylatov
87011a7280 Update changelog 2019-03-21 22:10:53 -04:00
Jeroen Rietveld
72d5741ece Bugfix thread local singleton reset (#218)
* Fix issue causing ThreadLocalSingleton provider to return None after reset

* Add test for ThreadLocalSingleton provider reset functionality
2019-03-21 22:04:20 -04:00
Roman Mogylatov
6c9bff116a Merge branch 'release/3.14.4' into master 2019-01-05 21:39:00 -05:00
Roman Mogylatov
69602dc3de Bump version to 3.14.4 2019-01-05 21:38:07 -05:00
Roman Mogylatov
673796b4b7 Add Vlad Ghita to the list of contributors 2019-01-05 21:37:50 -05:00
Vlad Ghita
9ef616a148 Fix typo. (#214) 2019-01-05 17:07:23 -05:00
Vlad Ghita
5bb49b9af5 Fix typo. (#214) 2019-01-04 08:11:55 -05:00
Roman Mogylatov
5cf5bdda24 Merge branch 'release/3.14.3' into master 2018-12-22 21:07:52 +02:00
Roman Mogylatov
5d94fa96b3 Bump version to 3.14.3 2018-12-22 21:02:00 +02:00
Roman Mogylatov
7c47c67808
Update Cython to 0.29.2 (#213)
* Update Cython to 0.29.2

* Regenerate C sources

* Update changelog
2018-12-22 21:00:30 +02:00
Roman Mogylatov
2792d02455
Add support of six 1.12 (#212)
* Increase range of six versions to 1.12

* Update changelog
2018-12-22 20:50:25 +02:00
Roman Mogylatov
f4f773be5a
Copying providers with sys stream injections (#211)
* Add fix + tests

* Update changelog
2018-12-22 20:37:53 +02:00
Roman Mogylatov
2d0a91efbf Merge branch 'release/3.14.2' into master 2018-11-08 23:13:11 +02:00
Roman Mogylatov
dc85b2e981 Set Cython language_level=2 2018-11-08 23:12:50 +02:00
Roman Mogylatov
15a3031da6 Merge branch 'release/3.14.1' into master 2018-11-08 22:59:42 +02:00
Roman Mogylatov
1f2c626b03 Bump version to 3.14.1 2018-11-08 22:59:21 +02:00
Roman Mogylatov
ce3ea6c9c1 Upgrade to Cython 0.29 2018-11-08 22:58:17 +02:00
Roman Mogylatov
3e73555869 Remove assertEquals from tests 2018-11-08 22:55:01 +02:00
Roman Mogylatov
b1e166dcd5 Fix issue #208 2018-11-08 22:49:41 +02:00
Roman Mogylatov
62b0f914b9 Merge branch 'release/3.14.0' into master 2018-10-19 13:01:54 +03:00
Roman Mogylatov
84e2fd717f Bump version to 3.14.0 2018-10-19 13:00:55 +03:00
Roman Mogylatov
ea0f9d8306 Update doc blocks with *args and **kwargs 2018-10-19 12:56:41 +03: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
ac0e5eb26a Regenerate C sources using Cython 0.28.5 2018-10-15 07:46:27 +03:00
Roman Mogylatov
829eed2222 Merge branch 'release/3.13.2' into master 2018-09-02 21:02:16 +03:00
Roman Mogylatov
b3a6aeae41 Bump version to 3.13.2 2018-09-02 21:01:19 +03:00
Tobias Happ
bd855ace58 Adds tests in MANIFEST.in (#204) 2018-09-02 20:54:06 +03:00
Roman Mogylatov
b2b69b34bb Add benchmark of Factory provider 2018-08-20 22:14:52 +03:00
Roman Mogylatov
1cd3bd18e8 Merge branch 'release/3.13.1' into master 2018-08-17 00:28:18 +03:00
Roman Mogylatov
883fc951a3 Bump version to 3.13.1 2018-08-17 00:27:49 +03:00
Roman Mogylatov
1c0f2e7bf1 Merge branch 'release/3.13.0' into master 2018-08-17 00:19:01 +03:00
Roman Mogylatov
bd43d62f98 Bump version to 3.13.0 2018-08-17 00:18:35 +03:00
Roman Mogylatov
0757f492a5 Update changelog 2018-08-17 00:17:57 +03:00
Roman Mogylatov
7daf23eb2b Add python 3.7 to the list of classifiers 2018-08-17 00:17:47 +03:00
Roman Mogylatov
d90b794568 Add python 3.7 support 2018-08-17 00:13:41 +03:00
Roman Mogylatov
4cdc5bce56 Drop python 2.6 and 3.3 support 2018-08-17 00:06:20 +03:00
Roman Mogylatov
e13d3b4271 Try remove py3 - virtualenv16 incompatibility fix 2018-08-17 00:01:26 +03:00
Roman Mogylatov
7aa07449b2 Bump version to 3.12.5 2018-08-16 23:53:22 +03:00
Roman Mogylatov
2a051ffd70 Add factory patterns to docs 2018-08-16 23:52:56 +03:00
Roman Mogylatov
50af2508e8 Add factory patterns 2018-08-16 23:52:29 +03:00
Roman Mogylatov
8cc00dee83 Merge branch 'release/3.12.4' into master 2018-07-26 10:33:35 +03:00
Roman Mogylatov
875dcbf8f2 Update changelog for 3.12.4 2018-07-26 10:23:27 +03:00
Roman Mogylatov
49d74cb66a Bump version to 3.12.4 2018-07-26 10:23:16 +03:00
Roman Mogylatov
18393eb9ed Apply refactoring #199 2018-07-26 10:22:43 +03:00
Roman Mogylatov
461c546d31 Fix bug #200 2018-07-26 10:16:02 +03:00
Roman Mogylatov
4bfaf92099 Refactor tests 2018-07-26 10:08:46 +03:00
Roman Mogylatov
0f35208650 Merge branch 'release/3.12.3' into master 2018-07-24 23:27:45 +03:00
Roman Mogylatov
cc35e1fdb2 Regenerate C sources using Cython 0.28.4 2018-07-24 23:21:59 +03:00
Roman Mogylatov
f77e91cdac Bump version to 3.12.3 2018-07-24 23:14:08 +03:00
Roman Mogylatov
48ac3824cb Fix bug #198 2018-07-24 23:09:56 +03:00
Roman Mogylatov
699eb74a66 Merge branch 'release/3.12.2' into master 2018-07-03 19:34:03 +03:00
Roman Mogylatov
d47f47ea14 Bump version to 3.12.2 2018-07-03 19:31:51 +03:00
Roman Mogylatov
b243afa748 Apply code style fixes for services_v2 example miniapp 2018-07-03 12:39:43 +03:00
Roman Mogylatov
83053ad49e Merge branch 'release/3.12.1' into master 2018-07-02 16:52:46 +03:00
Roman Mogylatov
1eabebd0b8 Bump version to 3.12.1 2018-07-02 16:47:46 +03:00
Roman Mogylatov
f1c1a4ed0c Change code layout of services_v2 miniapp 2018-07-02 16:43:23 +03:00
Roman Mogylatov
a8dd335d71 Add example of callable delegation 2018-06-27 19:53:06 +03:00
Roman Mogylatov
96b44004b1 Refactor example miniapps - services_v1, services_v2 2018-06-27 19:12:57 +03:00
Roman Mogylatov
32a8052715 Update main page example and fix few typos 2018-06-27 17:37:03 +03:00
Roman Mogylatov
4d3573dd6f Regenerate C sources using Cython 0.28.3 2018-06-22 10:39:56 +03:00
Roman Mogylatov
926d152d3b Fix incompatibility issue between pip10 and virtualenv16 (travis) 2018-06-22 10:22:55 +03:00
Roman Mogylatov
431dee80d8 Add ioc_container example 2018-06-22 09:52:58 +03:00
Roman Mogylatov
56cd23f581 Merge branch 'release/3.12.0' into master 2018-04-23 19:47:02 +03:00
Roman Mogylatov
cdc3a7b51d Bump version to 3.12.0 2018-04-23 19:41:53 +03:00
Roman Mogylatov
78c5ad8531 Regenerate C sources using Cython 0.28.2 2018-04-22 14:02:44 +03:00
Roman Mogylatov
f62b977093 Merge branch 'master' into develop 2018-02-22 15:46:31 +02:00
Roman Mogylatov
481bb25f3e Merge branch 'release/3.11.3' into master 2018-02-22 15:32:30 +02:00
Roman Mogylatov
50fc01eeee Prepare release 3.11.3 2018-02-22 15:32:14 +02:00
Roman Mogylatov
4e299b09e4 Try to fix padding problem in code samples in docs 2018-02-22 15:29:52 +02:00
Roman Mogylatov
947a484f21 Merge remote-tracking branch 'origin/master' into develop 2018-02-22 11:50:54 +02:00
Roman Mogylatov
665b8d024d Merge branch 'release/3.11.2' into master 2018-02-22 11:50:01 +02:00
Roman Mogylatov
c6fd9f3cb8 Update changelog for 3.11.2 2018-02-22 11:43:08 +02:00
Roman Mogylatov
bdbb9b40de Specify dir for sphinx themes explicitly 2018-02-22 11:42:50 +02:00
Roman Mogylatov
e81b459656 Update list of documentation and development requirements 2018-02-22 11:42:06 +02:00
Roman Mogylatov
403e406d4a Bump version to 3.11.2 2018-02-22 11:41:42 +02:00
Roman Mogylatov
de7b38626b
Release/3.11.1 -> Develop (#181)
* Specify sphix version

* Fix small typo in documentation (#180)

* Bump version to 3.11.1

* Complement the list of contributors
2018-01-26 19:34:38 +02:00
Roman Mogylatov
13fd1be6c2 Merge branch 'release/3.11.1' into master 2018-01-26 09:25:05 -08:00
Roman Mogylatov
6bdb0448aa Complement the list of contributors 2018-01-26 09:20:57 -08:00
Roman Mogylatov
44fcc43b6d Bump version to 3.11.1 2018-01-26 09:18:10 -08:00
James Lafa
fe4f32303a Fix small typo in documentation (#180) 2018-01-26 19:15:07 +02:00
Roman Mogylatov
0e50b1d379 Merge branch 'release/3.11.0' into master 2018-01-25 01:16:10 +02:00
Roman Mogylatov
d5bd3bdfce Update services example 2018-01-25 01:06:28 +02:00
Roman Mogylatov
96476ba9ca Merge branch 'improve-dependencies-container-overriding' into develop 2018-01-24 20:12:19 +02:00
Roman Mogylatov
94fd0bfe33 Update changelog 2018-01-24 20:12:10 +02:00
Roman Mogylatov
39b62e37d5 Improve DependenciesContainer overriding logic 2018-01-24 20:11:36 +02:00
Roman Mogylatov
b94b424f3a Merge branch 'configuration-provider-improvements' into develop 2018-01-24 20:02:31 +02:00
Roman Mogylatov
a300945f1e Update changelog 2018-01-24 20:01:46 +02:00
Roman Mogylatov
4b863a659e Update bundles example after configuration provider refactoring 2018-01-24 19:59:48 +02:00
Roman Mogylatov
e877b33fd1 Refactor configuration provider 2018-01-24 19:59:48 +02:00
Roman Mogylatov
86a8efa294 Bump version to 3.11 2018-01-24 19:59:31 +02:00
Roman Mogylatov
68c734a2d1 Merge branch 'release/3.10.0' into master 2018-01-21 23:59:31 +02:00
Roman Mogylatov
4a37433c43 Add minor fixes to movie lister miniapp 2018-01-21 23:58:34 +02:00
Roman Mogylatov
c50322db02
178 dependencies container provider (#179)
* Add DependenciesContainer provider

* Remove bundles_v2 example

* Add use cases example

* Update changelog

* Update documentation requirements to use fixed version of sphinxcontrib-disqus

* Add use cases miniapp to docs

* Update changelog
2018-01-21 23:55:32 +02:00
Roman Mogylatov
af28cb60c2 Bump version to 3.10 2018-01-19 19:21:23 +02:00
Roman Mogylatov
7e4528e35d Merge branch 'release/3.9.1' into master 2017-12-25 20:57:19 +02:00
Roman Mogylatov
bb155bb74b Increase version to 3.9.1 2017-12-25 20:39:56 +02:00
Roman Mogylatov
3f15640e55 Add docs badge 2017-12-25 20:34:39 +02:00
Roman Mogylatov
942be1dab4 Specify sphix version 2017-12-25 20:33:34 +02:00
Roman Mogylatov
f24b160c13 Specify sphix version 2017-12-25 17:57:23 +02:00
Roman Mogylatov
9a634f86ab Merge branch 'release/3.9.0' into master 2017-12-25 17:44:49 +02:00
Roman Mogylatov
b76738798d Increase version to 3.9.0 2017-12-25 17:42:01 +02:00
Roman Mogylatov
f1997ee822 Regenerate C sources using Cython 0.27.3 2017-12-25 17:27:19 +02:00
Roman Mogylatov
d5ac1474d4 Add bundles example miniapp 2017-12-25 16:55:59 +02:00
Roman Mogylatov
4a24549923 Fix bug when copying Configuration provider 2017-12-25 16:43:45 +02:00
Roman Mogylatov
bb390f51f0 Add doc blocks for bundles example miniapp 2017-12-25 14:38:53 +02:00
Roman Mogylatov
1c6160e827
Feature/declarative container initialization (#176)
* Add overriding functionality on declarative container initialization

* Update changelog

* Update bundles example
2017-12-24 23:03:13 +02:00
Roman Mogylatov
1115e783e0 Update bundles example with Dependency provider 2017-12-21 22:58:13 +02:00
Roman Mogylatov
828a04de88 Merge branch 'feature/rename-external-dependency' into develop 2017-12-21 22:55:10 +02:00
Roman Mogylatov
c5d8032e95 Update docs & examples 2017-12-21 22:54:44 +02:00
Roman Mogylatov
832518582a Update changelog 2017-12-21 22:48:07 +02:00
Roman Mogylatov
a67e4ebd44 Rename provider ExternalDependency -> Dependency 2017-12-21 22:47:31 +02:00
Roman Mogylatov
dec490291b Merge branch 'concept/declarative-container-dependencies' into develop 2017-12-21 22:06:22 +02:00
Roman Mogylatov
81718c5b6a Rename bundles example 2017-12-21 22:06:00 +02:00
Roman Mogylatov
6a64b6e297 Add container dependencies concept 2017-12-20 12:25:46 +02:00
Roman Mogylatov
bd38c23c74 Merge branch 'release/3.8.2' into master 2017-11-30 11:49:43 +02:00
Roman Mogylatov
e4275c0f85 Increase version to 3.8.2 2017-11-30 11:49:13 +02:00
Roman Mogylatov
7b0b3e8381 Merge remote-tracking branch 'origin/master' into develop 2017-11-30 11:31:59 +02:00
Roman Mogylatov
8cc8c57589 Merge branch 'release/3.8.1' into master 2017-11-30 11:31:16 +02:00
Roman Mogylatov
d9082f185a Increase version to 3.8.1 2017-11-30 11:30:41 +02:00
Roman Mogylatov
7bfa38307d Fix padding problem in code samples in docs 2017-11-30 11:29:47 +02:00
Roman Mogylatov
5fb7f93f23 Add slack notifications for travis jobs 2017-11-27 19:31:23 +02:00
Roman Mogylatov
74a058eb93 Merge branch 'release/3.8.0' into master 2017-11-21 11:54:02 +02:00
Roman Mogylatov
83a792bfe0 Update version to 3.8.0 2017-11-21 11:48:15 +02:00
Roman Mogylatov
7bd0997f85 Add parsing of nested containers to declarative container 2017-11-21 11:47:55 +02:00
Roman Mogylatov
236fe316e3 Fix bug related to double-overridden providers 2017-11-21 11:44:33 +02:00
Roman Mogylatov
73ce30e2ba Merge branch 'release/3.7.1' into master 2017-10-30 17:05:36 +02:00
Roman Mogylatov
ea111c452b Increase version to 3.7.1 2017-10-30 16:52:05 +02:00
Roman Mogylatov
12cfa78850 Add version 1.11.0 of six to the list of supported versions of six 2017-10-30 16:51:44 +02:00
Roman Mogylatov
5cbaa702e2 Merge remote-tracking branch 'origin/master' into develop 2017-10-13 10:31:46 -07:00
Roman Mogylatov
8431ebacc0 Bump version to 3.7.0 2017-10-13 10:28:07 -07:00
Roman Mogylatov
e4580b7849 Update docs on factory delegation 2017-10-13 10:28:07 -07:00
Roman Mogylatov
a22373a68d Add .provider attribute 2017-10-13 10:28:07 -07:00
Roman Mogylatov
774c6ff38b Add documentation for FactoryAggregate provider 2017-10-13 10:28:07 -07:00
Roman Mogylatov
4e100b36ef Update Cython to 0.27.1 2017-10-13 10:28:06 -07:00
Roman Mogylatov
5a61d262b9 Update changelog 2017-10-13 10:27:43 -07:00
Roman Mogylatov
28a63be016 Add FactoryAggregate unit tests 2017-10-13 10:27:08 -07:00
Roman Mogylatov
bbc909f2fa Add FactoryAggregate provider implementation 2017-10-13 10:27:08 -07:00
Roman Mogylatov
81ac0f903b Update pydocstyle config for unit tests 2017-10-13 10:27:07 -07:00
Roman Mogylatov
b1ef79f6b3 Resolve merge conflict 2017-10-13 10:27:07 -07:00
Roman Mogylatov
4cbe918bcc Regenerate C sources using Cython 0.27 2017-10-13 10:27:07 -07:00
Roman Mogylatov
b65d3bac98 Add early implementation of FactoryAggregate provider 2017-10-13 10:27:06 -07:00
Roman Mogylatov
a548924969 Add example & prototype of factory aggregate 2017-10-13 10:25:17 -07:00
Roman Mogylatov
94a5bc21d2 Merge pull request #175 from ets-labs/feature/add-provider-attribute
Add ".provider" attribute for all providers
2017-10-13 10:20:08 -07:00
Roman Mogylatov
73e5112938 Update docs on factory delegation 2017-10-13 10:18:40 -07:00
Roman Mogylatov
be65996e57 Add .provider attribute 2017-10-13 10:15:21 -07:00
Roman Mogylatov
9305b9db7d Merge pull request #174 from ets-labs/feature/factory-aggregate
Create FactoryAggregate provider
2017-10-12 22:09:52 -07:00
Roman Mogylatov
3364d6f1b9 Add documentation for FactoryAggregate provider 2017-10-12 21:55:29 -07:00
Roman Mogylatov
a155f25ca6 Update Cython to 0.27.1 2017-10-12 20:25:46 -07:00
Roman Mogylatov
c4c00129bc Update changelog 2017-10-12 20:06:00 -07:00
Roman Mogylatov
bca7c78e22 Add FactoryAggregate unit tests 2017-10-12 19:54:06 -07:00
Roman Mogylatov
9bdf010bc5 Add FactoryAggregate provider implementation 2017-10-12 19:54:06 -07:00
Roman Mogylatov
d969125d7a Update pydocstyle config for unit tests 2017-10-12 19:54:05 -07:00
Roman Mogylatov
44016907bc Resolve merge conflict 2017-10-12 19:54:05 -07:00
Roman Mogylatov
b8e88517f7 Regenerate C sources using Cython 0.27 2017-10-11 10:24:07 -07:00
Roman Mogylatov
c1053cbd73 Add early implementation of FactoryAggregate provider 2017-10-11 10:13:31 -07:00
Roman Mogylatov
eb52ccb3c0 Add example & prototype of factory aggregate 2017-10-11 10:11:07 -07:00
Roman Mogylatov
be42d247d8 Merge pull request #172 from ets-labs/revert-171-feature/add-six-1-11-0
Revert "Add six 1.11.0 to the list of compatible dependencies"
2017-10-10 15:37:10 -07:00
Roman Mogylatov
e3727fca11 Revert "Add six 1.11.0 to the list of compatible dependencies" 2017-10-10 15:36:55 -07:00
Roman Mogylatov
2808ae157b Merge pull request #171 from ets-labs/feature/add-six-1-11-0
Add six 1.11.0 to the list of compatible dependencies
2017-10-10 15:31:33 -07:00
Roman Mogylatov
7ef6189c6e Update changelog 2017-10-10 15:25:21 -07:00
Roman Mogylatov
35040b3292 Add six 1.11.0 to the list of compatible dependencies 2017-10-10 15:24:08 -07:00
Roman Mogylatov
f2be2d9aae Merge pull request #170 from ets-labs/feature/update-cython-0-27
Update Cython to 0.27
2017-10-10 15:09:55 -07:00
Roman Mogylatov
8584c55ac0 Update changelog 2017-10-10 15:02:48 -07:00
Roman Mogylatov
c2e30f4940 Recompile sources using Cython 0.27 (Cython->C) 2017-10-10 14:57:08 -07:00
Roman Mogylatov
b6e4a08d48 Update cython version in development requirements file 2017-10-10 14:53:44 -07:00
Roman Mogylatov
54033225ac Merge branch 'release/3.6.1' into develop 2017-08-08 19:56:46 +03:00
Roman Mogylatov
a4bb5514b1 Merge branch 'release/3.6.1' into master 2017-08-08 19:36:51 +03:00
Roman Mogylatov
f0b37800f6 Merge branch 'feature/update-cython-0-26' into release/3.6.1 2017-08-08 19:34:31 +03:00
Roman Mogylatov
9806ab55f9 Merge branch 'feature/update-cython-0-26' into develop 2017-08-08 19:34:03 +03:00
Roman Mogylatov
181a21cb26 Add explicit declaration of CYTHON_CLINE_IN_TRACEBACK macro 2017-08-08 19:27:33 +03:00
Roman Mogylatov
6cbe1ed226 Update 3.6.1 changelog 2017-08-08 19:10:06 +03:00
Roman Mogylatov
d4b84fdb5d Increase version to 3.6.1 2017-08-08 19:08:53 +03:00
Roman Mogylatov
b804976947 Merge branch 'feature/update-cython-0-26' into develop 2017-08-08 19:07:06 +03:00
Roman Mogylatov
ca4a85adc6 Update development requirements 2017-08-08 19:06:20 +03:00
Roman Mogylatov
1bc5ae019a Update changelog 2017-08-08 19:06:03 +03:00
Roman Mogilatov
08e17ac1f8 Regenerate sources using Cython 0.26
Author:    Roman Mogilatov <rmogilatov@gmail.com>
2017-08-08 19:01:48 +03:00
Roman Mogilatov
464c4f724f Add mail_service example 2017-07-10 23:33:01 +03:00
Roman Mogilatov
aad164db57 Merge branch 'master' into develop 2017-07-09 23:47:36 +03:00
Roman Mogilatov
fa120b2a31 Merge branch 'release/3.6.0' into master 2017-07-09 23:47:07 +03:00
Roman Mogilatov
0b286bfd69 Bump version to 3.6.0 2017-07-09 23:41:32 +03:00
Roman Mogilatov
1adba8f4ce Merge branch 'feature/singleton-delegate' into develop 2017-07-09 23:39:09 +03:00
Roman Mogilatov
76fb03a2a6 Update FactoryDelegate doc block 2017-07-09 23:38:01 +03:00
Roman Mogilatov
0008363a96 Update CallableDelegate tests 2017-07-09 23:37:51 +03:00
Roman Mogilatov
de12aee362 Update CallableDelegate doc block 2017-07-09 23:36:04 +03:00
Roman Mogilatov
598bf43e71 Update changelog 2017-07-09 23:34:38 +03:00
Roman Mogilatov
8705e47d37 Add SingletonDelegate provider + tests 2017-07-09 23:34:14 +03:00
Roman Mogilatov
db30417e2e Merge branch 'feature/callable-delegate' into develop 2017-07-09 23:29:59 +03:00
Roman Mogilatov
a76ad51664 Update changelog 2017-07-09 23:29:40 +03:00
Roman Mogilatov
3f197e3744 Add CallableDelegate provider + tests 2017-07-09 23:29:33 +03:00
Roman Mogilatov
4f7df914cb Merge branch 'feature/factory-delegate' into develop
Conflicts:
	docs/main/changelog.rst
2017-07-09 23:21:41 +03:00
Roman Mogilatov
5c4dc0f98a Update changelog 2017-07-09 23:17:39 +03:00
Roman Mogilatov
89c1c975e6 Add FactoryDelegate provider + tests 2017-07-09 23:17:12 +03:00
Roman Mogilatov
35d795d097 Add FactoryDelegate provider + tests 2017-07-09 23:13:10 +03:00
Roman Mogilatov
73f34b66be Merge branch 'release/3.5.0' into master 2017-07-07 18:06:29 +03:00
Roman Mogilatov
16eb1a3869 Update version 2017-07-07 17:54:51 +03:00
Roman Mogilatov
9b6310a936 Remove section "Development version" from changelog 2017-07-07 17:54:51 +03:00
Roman Mogilatov
fcb7cf8e3b Update version 2017-07-07 17:54:00 +03:00
Roman Mogilatov
1e85bacba9 Remove section "Development version" from changelog 2017-07-07 17:53:37 +03:00
Roman Mogilatov
e109e582f1 Update changelog 2017-07-07 17:53:37 +03:00
Roman Mogilatov
d4f4c47242 Add default value setting for Configuration provider 2017-07-07 17:53:36 +03:00
Roman Mogilatov
9f0732ab14 Merge branch 'feature/configuration-provider-default-values' into develop 2017-07-07 17:50:01 +03:00
Roman Mogilatov
e9fd484067 Update changelog 2017-07-07 17:49:16 +03:00
Roman Mogilatov
1758531634 Add default value setting for Configuration provider 2017-07-07 17:43:12 +03:00
Roman Mogilatov
a057176ae6 Update makefile 2017-06-09 01:54:46 +03:00
Roman Mogilatov
70e82ca7d8 Update makefile 2017-06-09 01:53:14 +03:00
Roman Mogilatov
770f867ca2 Merge branch 'release/3.4.8' into develop 2017-06-09 01:51:19 +03:00
Roman Mogilatov
d0b86facb3 Merge branch release/3.4.8 2017-06-09 01:50:28 +03:00
Roman Mogilatov
67745f8b88 Update makefile 2017-06-09 01:50:09 +03:00
Roman Mogilatov
0635d7783f Add changelog for 3.4.8 2017-06-09 01:46:18 +03:00
Roman Mogilatov
2712d693a0 Bump version to 3.4.8 2017-06-09 01:46:06 +03:00
Roman Mogilatov
928aaa12b6 Update makefile 2017-06-09 01:45:12 +03:00
Roman Mogilatov
007c256c5f Make code style fixes in providers module 2017-06-09 01:41:22 +03:00
Roman Mogilatov
3046804bf5 Add / remove some performance tests 2017-06-09 01:39:07 +03:00
Roman Mogilatov
bc398cef53 Increase version to 3.4.7 2017-05-29 10:41:31 +03:00
Roman Mogilatov
4cd8ef3b3f Increase version to 3.4.6 2017-05-29 10:19:43 +03:00
Roman Mogilatov
93e695d93b Add section "Useful links" to di_in_python.rst 2017-05-29 10:19:23 +03:00
Roman Mogilatov
50b38fd905 Increase version to 3.4.5 2017-05-17 10:58:53 +03:00
Roman Mogilatov
da97c1d533 Remove non-ascii character from README 2017-05-17 10:58:27 +03:00
Roman Mogilatov
46a7eb0f3f Update source of coveralls.io badge 2017-05-08 19:05:02 +03:00
Roman Mogilatov
a8ef1ddac9 Increase version to 3.4.4 2017-05-08 18:55:45 +03:00
Roman Mogilatov
fee8530b1e Update movie lister example miniapp 2017-05-08 18:55:14 +03:00
Roman Mogilatov
d8d910d342 Update example of writing custom providers 2017-05-08 17:36:17 +03:00
Roman Mogilatov
e8bd524b6d Add Provider.last_overriding read-only property 2017-05-08 17:07:22 +03:00
Roman Mogilatov
0766df39d7 Update version to 3.4.3 2017-04-19 00:00:29 +03:00
Roman Mogilatov
9c589df6ab Update version to 3.4.2 2017-04-18 23:42:48 +03:00
Roman Mogilatov
d3d170620a Fix few pydocstyle errors in examples 2017-04-18 23:38:04 +03:00
Roman Mogilatov
2a9b14cb0e Make Provider overriding methods thread safe 2017-04-18 23:30:29 +03:00
Roman Mogilatov
9ed806b0ca Refactor storage locking of ThreadSafeSingleton 2017-04-18 23:11:03 +03:00
Roman Mogilatov
870809c836 Increase version to 3.4.1 2017-04-07 09:19:48 +03:00
Roman
48e0e5bedf Merge pull request #154 from ets-labs/dev-3.4
Dev 3.4
2017-04-07 01:08:50 +03:00
Roman Mogilatov
28c73d13ca Add docs for abstract callable and singleton providers 2017-04-07 01:00:52 +03:00
Roman Mogilatov
144665ef3f Add docs about AbstractFactory provider 2017-04-07 00:47:30 +03:00
Roman Mogilatov
f4992d842e Add example for abstract factory provider 2017-04-06 19:18:46 +03:00
Roman Mogilatov
2aa85228d7 Add abstract providers 2017-04-06 18:17:06 +03:00
Roman Mogilatov
1dacd096f6 Optimize calling of overridden providers 2017-04-06 12:34:04 +03:00
Roman Mogilatov
902cec5364 Increase version to 3.4.0 2017-04-06 12:33:19 +03:00
Roman Mogilatov
c2b61defb3 Add performance test for overridden providers 2017-04-06 10:58:07 +03:00
Roman Mogilatov
3a0e803e3c Increase version to 3.3.7 2017-03-29 01:34:08 +03:00
Roman Mogilatov
bd62c79702 Fix minor bug in Configuration provider 2017-03-29 01:33:37 +03:00
Roman Mogilatov
c85b56fd62 Update travis config to re-cythonize code only for coveralls job 2017-03-29 00:39:09 +03:00
Roman Mogilatov
a59530d228 Increase version to 3.3.6 2017-03-29 00:22:54 +03:00
Roman Mogilatov
0373756eba Remove cythonization from travis building process 2017-03-29 00:20:13 +03:00
Roman Mogilatov
ef40c2a543 Apply minor refactoring for providers module 2017-03-29 00:08:38 +03:00
Roman Mogilatov
7cb3310c5d Patch Configuration provider to raise AttributeError for special attributes 2017-03-29 00:07:21 +03:00
Roman Mogilatov
f8960ddacb Increase version to 3.3.5 2017-03-26 23:01:00 +03:00
Roman Mogilatov
9926ac33cc Update README and docs index page 2017-03-26 22:45:05 +03:00
Roman Mogilatov
448c23149f Merge remote-tracking branch 'origin/consolidate_containers' 2017-03-26 22:40:20 +03:00
Roman Mogilatov
7840e2a13e Add types declaration for containers 2017-03-26 22:38:26 +03:00
Roman Mogilatov
622a6d08e5 Consolidate all containers in container module 2017-03-26 16:40:41 +03:00
Roman Mogilatov
6f6853eb85 Merge remote-tracking branch 'origin/consolidate_providers' 2017-03-26 16:32:47 +03:00
Roman Mogilatov
716d40f943 Update changelog 2017-03-26 16:32:13 +03:00
Roman Mogilatov
5b3dbae572 Consolidate providers into single cython module 2017-03-25 22:38:48 +02:00
Roman Mogilatov
01e145bd60 Increase version to 3.3.4 2017-03-25 02:08:48 +02:00
Roman Mogilatov
f72357e7ff Change __module__ attribute for containers to point to package, not to submodules 2017-03-25 02:04:29 +02:00
Roman Mogilatov
42666390f4 Regenerate C sources using Cython 0.25.2 2017-03-24 22:19:53 +02:00
Roman Mogilatov
417eaceb4c Increase version to 3.3.3 2017-03-15 17:28:03 +02:00
Roman Mogilatov
ca9c13543d Update services miniapp example 2017-03-15 17:26:59 +02:00
Roman Mogilatov
a6777550a9 Increase version to 3.3.2 2017-02-28 22:31:52 +02:00
Roman Mogilatov
97cb50b876 Add changelog for version 3.3.2 2017-02-28 22:31:19 +02:00
Roman Mogilatov
83ed652839 Fix title underline in containers api docs 2017-02-28 22:30:59 +02:00
Roman Mogilatov
0bc972514a Update example version in installation document 2017-02-28 22:28:16 +02:00
Roman Mogilatov
f751bdf0b1 Update documentation copyright year 2017-02-28 22:25:13 +02:00
Roman Mogilatov
45d7e01e7c Fix reference to version in api docs 2017-02-28 22:24:09 +02:00
Roman Mogilatov
53c8e1548a Merge remote-tracking branch 'origin/docs-discus-comments' 2017-02-28 22:17:43 +02:00
Roman Mogilatov
c5cddd91af Move docs requirements to separate file 2017-02-28 22:16:49 +02:00
Roman Mogilatov
372bbf3a95 Add disqus comments for api documents 2017-02-28 22:12:07 +02:00
Roman Mogilatov
f0b0a7c6da Add disqus comments for example documents 2017-02-28 22:11:52 +02:00
Roman Mogilatov
256abed2ef Add disqus comments for container documents 2017-02-28 22:08:52 +02:00
Roman Mogilatov
1375e42749 Add disqus comments for provider documents 2017-02-28 22:07:12 +02:00
Roman Mogilatov
4fdf2fb08f Add disqus comments for main documents 2017-02-28 22:05:00 +02:00
Roman Mogilatov
0077114cd4 Add disqus comments for introduction documents 2017-02-28 22:00:08 +02:00
Roman Mogilatov
f90deae8f7 Add disqus extension to the config 2017-02-28 21:56:55 +02:00
Roman Mogilatov
4a575abbde Add shpinxcontrib-disqus to the list of development dependencies 2017-02-28 21:55:57 +02:00
Roman Mogilatov
c3f47a4f4b Add disqus.js 2017-02-28 21:55:16 +02:00
Roman Mogilatov
a947f9eea2 Increase version to 3.3.1 2017-02-01 13:08:45 +02:00
Roman Mogilatov
b05b673108 Add some improvements to the documentation 2017-02-01 13:07:44 +02:00
Roman Mogilatov
79d1d76817 Increase version to 3.3.0 2017-01-30 00:12:08 +02:00
Roman Mogilatov
dafd416b95 Set python 2.7 for coveralls 2017-01-30 00:08:06 +02:00
Roman Mogilatov
4988760ca3 Update travis config with matrix 2017-01-30 00:02:20 +02:00
Roman Mogilatov
1edce9a59d Add python 3.6 and pypy3 to the list of test envs 2017-01-29 23:43:10 +02:00
Roman Mogilatov
9bb9cf8833 Increase version to 3.2.5 2017-01-29 23:39:15 +02:00
Roman Mogilatov
2ada44f4da Update readme 2017-01-29 23:35:41 +02:00
Roman Mogilatov
74c49574cb Update docblock of configuration provider 2017-01-29 23:16:15 +02:00
Roman Mogilatov
2730082b91 Fix error in external dependency provider docs 2017-01-29 23:12:57 +02:00
Roman Mogilatov
9f35310cb3 Add point in object provider docs 2017-01-29 23:05:56 +02:00
Roman Mogilatov
4215cdf3d6 3.2.4 release 2017-01-11 00:15:07 +02:00
Roman Mogilatov
b0a568b936 Prepare 3.2.4 release 2017-01-11 00:14:32 +02:00
Roman Mogilatov
2012974f7e Update links to docs 2017-01-11 00:09:43 +02:00
Roman Mogilatov
2d28a9bc71 Update copyright date 2017-01-11 00:08:21 +02:00
Roman Mogilatov
554e307da4 Increase version to 3.2.3 2016-12-27 23:10:52 +02:00
Roman Mogilatov
4223a07183 Add massive update of README examples 2016-12-27 23:06:40 +02:00
Roman Mogilatov
e37a8cee3b Add small improvements into di_in_python page 2016-12-27 23:06:23 +02:00
Roman Mogilatov
b8ab88dcd5 Change name of version variable to make it follow PEP8 2016-12-04 13:16:48 +02:00
Roman Mogilatov
d1531a8307 Increase version to 3.2.1 2016-12-02 21:04:17 +02:00
Roman Mogilatov
a2843a974a Update readme and services miniapp example 2016-12-02 21:01:23 +02:00
Roman Mogilatov
6881d370ae Increment version to 3.2.0 2016-12-02 20:47:57 +02:00
Roman Mogilatov
7ab471fe49 Update services miniapp with configuration provider 2016-12-02 20:43:39 +02:00
Roman Mogilatov
e03729958d Add test for configuration provider 2016-12-02 19:29:17 +02:00
Roman Mogilatov
a868d0bb06 Update Configuration docblocks 2016-12-02 16:22:08 +02:00
Roman Mogilatov
5d37c6a664 Update changelog 2016-12-02 15:01:52 +02:00
Roman Mogilatov
3295e979fa Merge remote-tracking branch 'origin/configuration_provider' 2016-12-02 15:00:50 +02:00
Roman Mogilatov
b643acfbc5 Update configuration provider docblocks 2016-12-02 14:57:37 +02:00
Roman Mogilatov
3f8e53aa9c Add configuration provider 2016-12-02 13:53:37 +02:00
Roman Mogilatov
a79df278b5 Modify performance test 2016-11-23 23:07:17 +02:00
Roman Mogilatov
ea8c48f1aa Add changelog for version 3.1.5 2016-11-23 22:26:14 +02:00
Roman Mogilatov
6adf9e4528 Refactor provider internals: C functions naming scheme and code layout 2016-11-23 22:25:41 +02:00
Roman Mogilatov
668d503d44 Add Terrence Brannon (metaperl) to the list of contributors
+ Add github logins for each contributor
2016-11-23 22:15:21 +02:00
Roman Mogilatov
7f308cbf41 Temporary disable pypy3 cause of pip installation failures 2016-11-17 23:44:19 +02:00
Roman Mogilatov
17a880f161 Increase version to 3.1.4 2016-11-17 23:35:27 +02:00
Roman Mogilatov
bb4ad5eb62 Temporary disable factory sublcass performance test 2016-11-17 23:34:44 +02:00
Roman Mogilatov
0b836b8712 Move inline functions from class level to module level for removing them from virtual table and enable inlining 2016-11-17 23:33:30 +02:00
Roman Mogilatov
b0d507b8bf Release 3.1.3 2016-11-15 14:32:23 +02:00
Roman Mogilatov
18eb733904 Incrementing version to 3.1.2 2016-11-15 14:28:12 +02:00
Roman Mogilatov
26c8637206 Merge remote-tracking branch 'origin/remove_public_modifier' 2016-11-15 14:27:49 +02:00
Roman Mogilatov
2072567242 Fix flake8 E305 error 2016-11-15 14:26:40 +02:00
Roman Mogilatov
9727b4924e Remove providers/utils.h 2016-11-15 14:19:17 +02:00
Roman Mogilatov
a1f2a14a03 Fix minor typo in readme 2016-11-13 11:52:09 +02:00
Roman Mogilatov
079d3f5ea7 Add services mini app example to docs 2016-11-11 23:08:47 +02:00
Roman Mogilatov
31f2a5d24d Fix minor error in Factory docblock 2016-11-11 22:40:11 +02:00
Roman Mogilatov
98ee1882cd Increase version to 3.0.1 2016-11-11 18:36:35 +02:00
Roman Mogilatov
acdf7f8052 Add C files to the sources 2016-11-11 18:34:07 +02:00
Roman Mogilatov
b4541bf177 Add .h files to gitignore 2016-11-11 17:35:58 +02:00
Roman Mogilatov
2657f39d07 Increase version to 3.0.0 2016-11-11 17:30:13 +02:00
Roman
8259de6dd7 Merge pull request #143 from ets-labs/138_cython_providers_v3
Cython providers
2016-11-11 17:27:54 +02:00
Roman Mogilatov
bf00e5c0fa Update docs 2016-11-11 17:05:25 +02:00
Roman Mogilatov
82296d9fed Add tests for base providers 2016-11-11 12:11:56 +02:00
Roman Mogilatov
07b9a991b3 Add singleton tests 2016-11-10 21:19:17 +02:00
Roman Mogilatov
93c8bd6438 Add tests for injections 2016-11-10 21:00:23 +02:00
Roman Mogilatov
3bb9146496 Add tests for Callable provider 2016-11-09 23:45:25 +02:00
Roman Mogilatov
55f3d5d8ec Add tests for factory providers 2016-11-09 11:48:10 +02:00
Roman Mogilatov
7b61464c93 Make providers stable 2016-11-08 13:13:43 +02:00
Roman Mogilatov
322ba98f18 Implement singletons (need refactoring) 2016-11-06 17:14:12 +02:00
Roman Mogilatov
7502fa1e89 Improve factory performance by adding direct inline C calls 2016-11-05 01:15:30 +02:00
Roman Mogilatov
b2f6a2cd1a Commit onging work results 2016-11-04 20:45:26 +02:00
Roman Mogilatov
38bdc4f04f Update providers package structure 2016-11-04 18:35:53 +02:00
Roman Mogilatov
e68df7167f Make some style fixes in tests 2016-11-04 16:13:21 +02:00
Roman Mogilatov
f5680ff032 Update project structure 2016-11-04 15:48:26 +02:00
Roman Mogilatov
5695c781c9 Update project structure 2016-11-04 13:06:47 +02:00
Roman Mogilatov
7bcb882425 Transfer utils module to Cython 2016-11-04 11:12:37 +02:00
Roman Mogilatov
74aea6f1dc Transfer errors module to Cython 2016-11-04 10:50:05 +02:00
Roman Mogilatov
78cb4296cc Add is_delegated() method to utils 2016-11-04 10:41:40 +02:00
Roman
55cde4729d Merge pull request #142 from ets-labs/138_cython_injections
Add injections extension
2016-11-03 01:02:52 +02:00
Roman Mogilatov
82bd1ae843 Clean up 2016-11-03 00:56:30 +02:00
Roman Mogilatov
4823278f11 Tune debug mode 2016-11-03 00:06:14 +02:00
Roman Mogilatov
aac72ed3a3 Clean up and final fixes 2016-11-02 23:55:14 +02:00
Roman Mogilatov
db3bd77b6a Clean up 2016-11-02 23:20:06 +02:00
Roman Mogilatov
0421ae2d87 Clean up, changelog update 2016-11-02 23:17:50 +02:00
Roman Mogilatov
abbc7e89a1 Update changelog 2016-11-02 23:04:48 +02:00
Roman Mogilatov
e3408075de Update repository structure 2016-11-02 22:58:30 +02:00
Roman Mogilatov
cc85ae5a8f Test print 2016-11-02 20:23:49 +02:00
Roman Mogilatov
8f39ed4957 Update tox.ini 2016-11-02 20:19:04 +02:00
Roman Mogilatov
a7c0a76d14 Update tox ini 2016-11-02 20:12:41 +02:00
Roman Mogilatov
0f1497b282 Add debug to tox 2016-11-02 19:59:27 +02:00
Roman Mogilatov
49a2061cc5 Try cythonize vs build 2016-11-02 19:56:07 +02:00
Roman Mogilatov
cd1df0ad83 Try build vs cythonize 2016-11-02 19:38:41 +02:00
Roman Mogilatov
b72488154a Attempt x 2016-11-02 19:28:11 +02:00
Roman Mogilatov
1a9dd6cca7 One more attempt... 2016-11-02 19:16:55 +02:00
Roman Mogilatov
15d156cdaf Remove debug output from tox 2016-11-02 19:06:12 +02:00
Roman Mogilatov
6a1e058bdb Move tests on all version to single job 2016-11-02 19:05:44 +02:00
Roman Mogilatov
fe36a1220e Try basepython=python 2016-11-02 18:39:57 +02:00
Roman Mogilatov
4d82935d1d Make tox produce verbose output 2016-11-02 18:32:16 +02:00
Roman Mogilatov
7ae0086a69 Update examples for 3.0 2016-11-02 18:25:48 +02:00
Roman Mogilatov
3bd19a168a Tune building in debug mode 2016-11-02 18:11:50 +02:00
Roman Mogilatov
d8f44948a4 Update travis config to create debug builds only for coverage 2016-11-02 12:52:08 +02:00
Roman Mogilatov
6b1ff707a2 Remove unnecessary injection tests 2016-11-02 12:50:13 +02:00
Roman Mogilatov
776da6dd2b Add todo about delegation to injections 2016-11-02 12:49:48 +02:00
Roman Mogilatov
c93d1fb8a6 Set python 3.5 for coveralls job 2016-11-02 11:38:07 +02:00
Roman Mogilatov
76d47df7fd Add few tests for injections 2016-11-02 11:25:39 +02:00
Roman Mogilatov
c78c9ddd86 Add pep257 exceptions for tests 2016-11-02 11:25:29 +02:00
Roman Mogilatov
214a64732b Add public methods for injections 2016-11-02 11:24:46 +02:00
Roman Mogilatov
e5498f214b Add creation of debug builds 2016-11-01 10:49:44 +02:00
Roman Mogilatov
02b993ec54 Add cython->c compilation command to .travis.yml 2016-10-31 12:51:06 +02:00
Roman Mogilatov
b413826299 Add injections extension to setup script 2016-10-31 11:31:56 +02:00
Roman Mogilatov
7559959f35 Add injections extension 2016-10-31 11:31:33 +02:00
Roman Mogilatov
d594f8018a Add build command to makefile 2016-10-31 11:30:57 +02:00
Roman Mogilatov
83684f01d3 Add cython to development requirements 2016-10-31 11:30:18 +02:00
Roman Mogilatov
8d8a5b4e14 Update manifest file 2016-10-31 11:29:49 +02:00
Roman Mogilatov
d485a45a61 Add additional git ignoring of .c & .so files 2016-10-31 00:37:44 +02:00
Roman
c428c23c42 Merge pull request #141 from ets-labs/140_makefile
Add makefile
2016-10-31 00:12:22 +02:00
Roman Mogilatov
9b7d266e71 Update changelog with makefile changes 2016-10-31 00:01:17 +02:00
Roman Mogilatov
78f68468ce Remove dev environment from tox 2016-10-31 00:00:54 +02:00
Roman Mogilatov
a04740a27e Update list of development requirements 2016-10-31 00:00:41 +02:00
Roman Mogilatov
a7dea88063 Change path to unit tests coverage report 2016-10-31 00:00:19 +02:00
Roman Mogilatov
cad0a84946 Add clean & tests commands to makefile 2016-10-30 23:59:42 +02:00
Roman Mogilatov
741af3e67e Add makefile with publish command 2016-10-30 14:41:33 +02:00
Roman
9c9d52b6b1 Merge pull request #139 from ets-labs/134_remove_inject_decorator
Remove @inject decorator
2016-10-30 13:28:41 +02:00
Roman Mogilatov
c8a5db7691 Remove @inject decorator 2016-10-30 13:19:39 +02:00
Roman Mogilatov
d1b1196d6d Increase version to 2.2.10 2016-10-20 17:17:52 +03:00
Roman
68a4bd2092 Merge pull request #137 from metaperl/master
Fix small typos.
2016-10-20 17:14:54 +03:00
Terrence Brannon
1774906fd6 Merge pull request #2 from metaperl/metaperl-patch-2
Update README.rst
2016-10-20 09:56:40 -04:00
Terrence Brannon
d4bb64019f Update README.rst 2016-10-20 09:56:07 -04:00
Roman Mogilatov
788bce686f Increase version to 2.2.9 2016-10-19 20:25:16 +03:00
Roman Mogilatov
ed9391cc6e Create engines & cars example miniapp 2016-10-19 20:21:20 +03:00
Roman Mogilatov
a8c9219d09 Update dependency injection example in introduction/what_is_di.rst 2016-10-19 20:18:07 +03:00
Roman Mogilatov
63bc3f95e7 Fix status table on docs index page 2016-10-19 19:26:46 +03:00
Roman Mogilatov
9aee65057e Update service names in services example miniapp 2016-10-19 15:25:19 +03:00
Roman Mogilatov
a62ddf8265 Add github badges to readme and docs index page 2016-10-19 15:15:29 +03:00
Roman Mogilatov
0fe16a0b40 Increase version to 2.2.8 2016-10-13 10:42:52 +03:00
Roman Mogilatov
fb3679d267 Move fixtures to separate module in movie lister example 2016-10-13 10:41:50 +03:00
Roman Mogilatov
31dfa191f0 Increase version to 2.2.7 2016-10-12 10:45:26 +03:00
Roman Mogilatov
71732719b2 Fix typo in readme 2016-10-12 10:45:15 +03:00
Roman Mogilatov
2601646f71 Increase version to 2.2.6 2016-10-12 10:42:02 +03:00
Roman Mogilatov
e22dd14596 Update project title and description 2016-10-12 10:41:50 +03:00
Roman Mogilatov
489885fda9 Increase version to 2.2.5 2016-10-11 23:52:57 +03:00
Roman Mogilatov
0c88fb9a9a Fix typo in readme 2016-10-11 23:52:40 +03:00
Roman Mogilatov
08af0b18df Increase version to 2.2.4 2016-10-11 17:46:56 +03:00
Roman Mogilatov
c93b6fcfdf Update run script for services example 2016-10-11 17:45:56 +03:00
Roman Mogilatov
dde52a5d0f Update description of DI pattern in readme 2016-10-11 17:41:43 +03:00
Roman Mogilatov
9a14e8b659 Increase version to 2.2.3 2016-10-07 18:04:18 +03:00
Roman Mogilatov
7327ba9ed1 Update readme 2016-10-07 17:52:52 +03:00
Roman Mogilatov
55c7473b6f Update readme 2016-10-07 17:32:24 +03:00
Roman Mogilatov
5c3b58d653 Increase version to 2.2.2 2016-10-07 16:59:22 +03:00
Roman Mogilatov
432493801f Increment version to 2.2.1 2016-10-07 16:55:26 +03:00
Roman Mogilatov
e64366ab09 Merge remote-tracking branch 'origin/docs-n-examples-improvements' 2016-10-07 16:52:24 +03:00
Roman Mogilatov
34a5cf8515 Update readme - add info about dependency injection 2016-10-07 16:44:45 +03:00
Roman Mogilatov
6c25c91146 Update short description on docs index page 2016-10-06 23:25:14 +03:00
Roman Mogilatov
8e290fb674 Update short description 2016-10-06 23:15:41 +03:00
Roman Mogilatov
8798ea1a56 Update services example 2016-10-06 22:48:43 +03:00
Roman Mogilatov
7b71d419fd Increase version to 2.2.0 2016-09-23 00:35:51 +03:00
Roman
53f60d6fed Merge pull request #136 from ets-labs/deprecate_inject_decorator
Deprecate inject decorator
2016-09-23 00:31:58 +03:00
Roman Mogilatov
38c9d2f18a Update docs 2016-09-23 00:24:45 +03:00
Roman Mogilatov
4e66c47f59 Update movie lister example 2016-09-22 14:40:45 +03:00
Roman Mogilatov
bff0e58f7f Update miniapps/services example 2016-09-19 12:31:27 +03:00
Roman Mogilatov
81072832e4 Add deprecation warning when @inject is used 2016-09-16 16:02:59 +03:00
Roman Mogilatov
d9f4aed43c Update version to 2.1.1 2016-09-07 11:00:24 +03:00
Roman
df899727ce Merge pull request #133 from sirkonst/hotfix/normalized_package_name
Normalize package names by PEP-503
2016-09-07 10:55:10 +03:00
Konstantin Enchant
a6b7a75136 Normalize package names by PEP-503 (https://www.python.org/dev/peps/pep-0503/) 2016-09-06 13:18:43 +03:00
Roman Mogilatov
a309a2053d Increase version to 2.1.0 2016-08-19 01:16:43 +03:00
Roman Mogilatov
16e9c3399c Update API docs of creational providers 2016-08-19 01:13:38 +03:00
Roman
50e4de89b4 Merge pull request #132 from ets-labs/130_thread_local_singleton
130 thread local singleton
2016-08-19 01:05:53 +03:00
Roman Mogilatov
6cf8b1c9c6 Add documentation section about singleton providers and multi-threading 2016-08-19 01:00:16 +03:00
Roman Mogilatov
2646d23387 Add Konstantin Enchant to the list of contributors 2016-08-19 00:55:50 +03:00
Roman Mogilatov
ada2e70e28 Add unit tests for ThreadLocalSingleton and DelegatedThreadLocalSingleton providers 2016-08-18 23:28:39 +03:00
Roman Mogilatov
ac150bb2e4 Update thread-local singleton example 2016-08-18 00:59:44 +03:00
Roman Mogilatov
f27fa60413 Add ThreadLocalSingleton, its delegated version and example of usage 2016-08-17 00:03:26 +03:00
Roman Mogilatov
1c47f73610 Merge remote-tracking branch 'origin/2.0' 2016-06-09 19:45:09 +03:00
Roman Mogilatov
e92bf10531 Update changelog for 2.0.0 2016-06-09 19:44:05 +03:00
Roman Mogilatov
91a8dbfa18 Update provider overriding docs 2016-06-09 19:40:22 +03:00
Roman Mogilatov
486353bbea Update object provider docs 2016-06-09 17:49:09 +03:00
Roman Mogilatov
9969bc4761 Update external dependency provider docs 2016-06-09 17:47:55 +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
43cc6a2e06 Update overriding context docblock 2016-06-09 00:53:17 +03:00
Roman Mogilatov
7e1ee9b66a Update singleton provider docs 2016-06-08 17:46:40 +03:00
Roman Mogilatov
2fcfa79ffd Fix singleton bugs related to thread-safety and checks for sequence types 2016-06-08 17:02:39 +03:00
Roman Mogilatov
d963e9b562 Update identation in imports block for factory examples 2016-06-08 16:54:47 +03:00
Roman Mogilatov
8d1ae1a840 Update container examples with namedtuples 2016-06-08 16:52:58 +03:00
Roman Mogilatov
14ca5651df Update factory provider docs 2016-06-08 16:41:13 +03:00
Roman Mogilatov
addaadac72 Refactor provider examples 2016-06-06 11:54:05 +03:00
Roman Mogilatov
1eee0fe529 Update containers documentation
+ Refactor provider overriding system
2016-06-06 11:26:53 +03:00
Roman Mogilatov
71c871caf7 Return injections module API docs 2016-06-06 11:05:48 +03:00
Roman Mogilatov
5ef01b0b07 Update declarative container docs 2016-06-03 19:20:34 +03:00
Roman Mogilatov
92ebbefd2f Update imports in several examples 2016-06-03 18:06:05 +03:00
Roman Mogilatov
feedd4c2e3 Drop example about config provider 2016-06-03 17:47:58 +03:00
Roman Mogilatov
98ac4d902e Update services miniapp example 2016-06-03 17:35:55 +03:00
Roman Mogilatov
88b563269d Update introduction docs for 2.0 2016-06-03 17:33:30 +03:00
Roman Mogilatov
5db20f0027 Fix small type in declarative container docblock 2016-06-03 17:32:47 +03:00
Roman Mogilatov
84f1d27fa8 Update module docblocks 2016-06-03 12:03:27 +03:00
Roman Mogilatov
17d8283144 Remove UndefinedProviderError 2016-06-03 12:01:09 +03:00
Roman Mogilatov
b86760e467 Make huge updates for docs (not atomic commit) 2016-06-03 00:48:06 +03:00
Roman Mogilatov
5d7622428f Add autodoc to dev requirements 2016-06-03 00:47:26 +03:00
Roman Mogilatov
da895ea97f Update examples for speech 2016-06-03 00:47:10 +03:00
Roman Mogilatov
eb6cd303de Update docs 2016-06-02 20:27:01 +03:00
Roman Mogilatov
61f53d9974 Update examples 2016-06-02 20:26:37 +03:00
Roman Mogilatov
6701445e9f Add some examples from presentation 2016-06-02 20:25:45 +03:00
Roman Mogilatov
bf9b1205b6 Update imports for movie lister example 2016-06-02 10:42:14 +03:00
Roman Mogilatov
ab7c8ac4d1 Rename Provider.inject() -> Provider.provide_injection() 2016-06-01 19:59:41 +03:00
Roman Mogilatov
209bc518c3 Update miniapps 2016-06-01 19:52:10 +03:00
Roman Mogilatov
5ecb00daba Merge remote-tracking branch 'origin/2.0-ioc-containers' into 2.0 2016-06-01 19:11:08 +03:00
Roman Mogilatov
3416728309 Add dynamic containers
+ Drop catalogs
2016-06-01 18:53:35 +03:00
Roman Mogilatov
be94a1badc Extract providers type checker into function 2016-06-01 16:00:11 +03:00
Roman Mogilatov
1c1596543d Add some tests for containers 2016-06-01 12:03:17 +03:00
Roman Mogilatov
a35db5889d Add some functionality and tests for declarative containers
+ Add checks for valid provider type
+ Add some wider functionality for overriding
2016-05-30 23:34:14 +03:00
Roman Mogilatov
68ae1b80df Drop catalog examples 2016-05-30 22:34:59 +03:00
Roman Mogilatov
5361694272 Add container examples 2016-05-30 22:34:59 +03:00
Roman Mogilatov
d8f03c4487 Add provider type checks for declarative container 2016-05-30 22:34:59 +03:00
Roman Mogilatov
ed7f354afe Update and rename callbacks_based_container example 2016-05-30 22:34:58 +03:00
Roman Mogilatov
b2d5819da7 Update IoC and DI demos 2016-05-30 22:34:58 +03:00
Roman Mogilatov
83bbbd2be7 Update movie lister example 2016-05-30 22:34:58 +03:00
Roman Mogilatov
8fdb190118 Add latest containers module updates + movie_lister refactoring 2016-05-30 22:34:58 +03:00
Roman Mogilatov
d6f48b6e1d Update doc blocks for examples in README 2016-05-30 22:34:57 +03:00
Roman Mogilatov
e669270bfb Update doc blocks for IoC containers in services example 2016-05-30 22:34:57 +03:00
Roman Mogilatov
05c2c864a7 Update README with new containers 2016-05-30 22:34:57 +03:00
Roman Mogilatov
7206b4dbb8 Update services example with new containers 2016-05-30 22:34:56 +03:00
Roman Mogilatov
97d1dab00a Add containers module 2016-05-30 22:34:56 +03:00
Roman Mogilatov
0cb197802a Remove dowloads-counter badge from README and index page of docs 2016-05-30 22:34:29 +03:00
Roman Mogilatov
7e0a3c4ec3 Merge remote-tracking branch 'origin/2.0-injection-containers' into 2.0 2016-05-29 17:03:59 +03:00
Roman Mogilatov
99b6e27ab4 Refactor injections 2016-05-29 16:39:39 +03:00
Roman Mogilatov
a1da758e6b Add unittest2 to the dev requirements 2016-05-26 20:15:43 +03:00
Roman Mogilatov
7d33e0e3a2 Drop catalogs name attribute 2016-05-22 17:01:27 +03:00
Roman Mogilatov
ab7cd86146 Reformat message about dropping of method injections 2016-05-22 16:50:45 +03:00
Roman Mogilatov
918335e0e4 Remove catalog bundles 2016-05-22 16:50:06 +03:00
Roman Mogilatov
5bc6ad0165 Merge remote-tracking branch 'origin/2.0-change-injections-style' into 2.0 2016-05-22 16:27:46 +03:00
Roman Mogilatov
dffed4b561 Update changelog 2016-05-22 16:27:10 +03:00
Roman Mogilatov
635c953801 Update README with more extensive examples 2016-05-22 16:19:43 +03:00
Roman Mogilatov
d8d6ba44e4 Make some small fixes for services example 2016-05-22 16:16:21 +03:00
Roman Mogilatov
7729d97a41 Make injections 2 times faster 2016-05-22 15:37:39 +03:00
Roman Mogilatov
d9aac553c5 Update factory and callable provider doc blocks 2016-05-22 14:57:25 +03:00
Roman Mogilatov
075e1bcf4f Update services miniapp 2016-05-20 13:33:39 +03:00
Roman Mogilatov
3247e79af4 Add 2 examples of services miniapp catalog styles 2016-05-18 15:21:15 +03:00
Roman Mogilatov
44d0555778 Restore Callable positional & keyword argument injections via __init__(*args, **kwargs) 2016-05-18 15:07:48 +03:00
Roman Mogilatov
a0b8b11a91 Sanitize callable and creational provider tests 2016-05-18 01:17:39 +03:00
Roman Mogilatov
65512366d2 Refactor callable and creational providers 2016-05-18 01:17:15 +03:00
Roman Mogilatov
f2a9b35c6d Change style and get first stable run 2016-05-18 00:05:10 +03:00
Roman Mogilatov
2878ea5515 Drop method injections 2016-05-17 22:37:50 +03:00
Roman Mogilatov
4a160ed999 Drop Config provider 2016-05-17 21:31:40 +03:00
Roman Mogilatov
1320c12780 Drop Static, Value, Function & Class providers 2016-05-17 21:28:22 +03:00
Roman Mogilatov
7392f35991 Drop backward compatibilities of 1.x 2016-05-17 21:13:55 +03:00
Roman Mogilatov
93bab98859 Bump version to 2.0.0 2016-05-17 21:01:08 +03:00
Roman Mogilatov
bef0a952b5 Fix bug with accessing declarative catalog attributes from instance level 2016-05-16 11:18:00 +03:00
Roman Mogilatov
a29508cb7a Implement add_injection() for Callable, Factory & Singleton providers 2016-05-16 11:16:14 +03:00
Roman Mogilatov
e2044cb560 Bump version to 1.17.0 2016-05-16 11:15:14 +03:00
Roman Mogilatov
69043d9c4e Release 1.16.8 2016-04-27 02:04:18 +03:00
Roman Mogilatov
672eb6dfd7 Update development requirements 2016-04-26 13:15:00 +03:00
Roman Mogilatov
cbc8d70151 Release 1.16.7 2016-04-26 13:14:39 +03:00
Roman Mogilatov
4e70d138fe Change some links due repository name switching 2016-04-25 11:39:35 +03:00
Roman Mogilatov
6f0bd441fe Update repositary url 2016-04-25 11:07:47 +03:00
Roman Mogilatov
bb433b29ad Release 1.16.4 2016-04-23 15:24:38 +03:00
Roman Mogilatov
62d5aa514b Release 1.16.3 2016-04-23 15:19:01 +03:00
Roman Mogilatov
9e5c6a13c4 Release 1.16.2 2016-04-23 15:00:06 +03:00
Roman Mogilatov
edde8f8bff Bump version to 1.16.1 2016-04-20 18:15:23 +03:00
Roman Mogilatov
e94fcba227 Update movie lister docs meta description 2016-04-20 18:06:31 +03:00
Roman Mogilatov
8eeedf9346 Set version to 1.16.0 2016-04-20 17:38:19 +03:00
Roman Mogilatov
bec69ea968 Add some modifications for api client example 2016-04-20 17:37:51 +03:00
Roman Mogilatov
a182be2d34 Add README for services examples 2016-04-20 17:32:50 +03:00
Roman Mogilatov
8bc5b35903 Update services example 2016-04-20 14:45:42 +03:00
Roman Mogilatov
1292d4af68 Update main example 2016-04-20 14:27:22 +03:00
Roman Mogilatov
4cf3bdb1fb Update examples and docs 2016-04-20 14:19:54 +03:00
Roman Mogilatov
bd5ea87ef7 Update movie listers example 2016-04-17 16:19:29 +03:00
Roman Mogilatov
860b44f33b Change readme -> put docs section in the bottom 2016-04-17 15:55:38 +03:00
Roman Mogilatov
7878466f4c Update movie listers example 2016-04-17 15:45:44 +03:00
Roman Mogilatov
ece858aaf3 Rename examples/stories to examples/miniapps 2016-04-12 11:40:02 +03:00
Roman Mogilatov
4e4782c598 Add meta description for introduction documents 2016-04-11 23:19:34 +03:00
Roman Mogilatov
9fc1502ae6 Add line numbers for all code samples in the documentation 2016-04-11 10:43:02 +03:00
Roman Mogilatov
c23803dedb Make small docblock fix for @copy decorator 2016-04-10 17:33:05 +03:00
Roman Mogilatov
a4a1224708 Merge remote-tracking branch 'origin/catalogs_copying' 2016-04-10 17:27:15 +03:00
Roman Mogilatov
3ab1350a17 Update changelog 2016-04-10 17:26:30 +03:00
Roman Mogilatov
fde062b9fc Add spike for providers copying 2016-04-10 17:17:55 +03:00
Roman Mogilatov
b4b93b4016 Remove copying functionality from dynamic catalog 2016-04-10 17:02:01 +03:00
Roman Mogilatov
f89ba4c5a9 Add example of catalog copying into MovieLister example 2016-04-10 16:54:34 +03:00
Roman Mogilatov
7cdeede38a Add declarative catalog @copy decorator 2016-04-10 16:52:37 +03:00
Roman Mogilatov
43258e5fd9 Add force binding and copying functionaloty for DynamicCatalog 2016-04-10 16:41:54 +03:00
Roman Mogilatov
3a7b9c1e98 Refactor dependency_injector.providers package internals 2016-04-08 18:50:40 +03:00
Roman Mogilatov
f595b7f670 Refactor dependency_injector.catalogs package internals 2016-04-08 18:49:23 +03:00
Roman Mogilatov
a07bb582ec Update movie_lister example 2016-04-05 00:41:45 +03:00
Roman Mogilatov
8fc14498f5 Update catalog example 2016-04-05 00:34:53 +03:00
Roman Mogilatov
9116b57de3 Update movie_lister example 2016-04-05 00:26:32 +03:00
Roman Mogilatov
c6e9dbd84c Update ioc_container_example.py 2016-04-05 00:25:18 +03:00
Roman Mogilatov
e7f7b0693c Update move_lister example 2016-04-05 00:18:15 +03:00
Roman Mogilatov
5c23160632 Update ioc_container_example.py 2016-04-05 00:12:26 +03:00
Roman Mogilatov
96e55e46ff Update changelog 2016-04-05 00:04:37 +03:00
Roman Mogilatov
fe12768114 Update version to 1.15.2 2016-04-04 23:57:56 +03:00
Roman Mogilatov
3204582143 Move introduction docs to the top level 2016-04-04 23:40:28 +03:00
Roman Mogilatov
a6a67a2b3d Update example paths in introduction/di_in_python.rst 2016-04-04 19:22:41 +03:00
Roman Mogilatov
6da0aaf77f Update imports for MovieLister standrard module 2016-04-04 19:17:36 +03:00
Roman Mogilatov
6d9aed74c8 Update ioc_container_example.py 2016-04-04 19:16:20 +03:00
Roman Mogilatov
56a597e0a6 Update introduction docs and examples 2016-04-04 19:12:21 +03:00
Roman Mogilatov
136b562a81 Split `catalogs` module into smaller modules 2016-04-03 23:47:34 +03:00
Roman Mogilatov
040d44d55b Split `providers` module into smaller modules 2016-04-03 22:54:08 +03:00
Roman Mogilatov
99a3997e08 Remove provider comments in MovieLister example 2016-04-03 16:15:09 +03:00
Roman Mogilatov
3f6c4d1b2c Update oc_container_example 2016-04-01 18:00:58 +03:00
Roman Mogilatov
2cd80b1b4c Update What Is DI docs and example 2016-04-01 10:47:09 +03:00
Roman Mogilatov
c8115ed44e Make some changes in introduction docs 2016-04-01 00:29:43 +03:00
Roman Mogilatov
0df57272fd Add document about libraries structure 2016-03-31 21:00:48 +03:00
Roman Mogilatov
6b1dd3aef6 Update key features list and key features page in docs 2016-03-31 00:40:49 +03:00
Roman Mogilatov
8444d7d1d5 Add di_in_python page to the introduction 2016-03-30 18:13:54 +03:00
Roman Mogilatov
4e00a70834 Update di example 2016-03-30 11:51:04 +03:00
Roman Mogilatov
08b00d71d4 Update introduction docs 2016-03-29 20:17:12 +03:00
Roman Mogilatov
064a1653fd Add some comments and members-visibility changes for MovieLister example 2016-03-20 17:50:00 +02:00
Roman Mogilatov
22691553fb Add small readme for MovieLister example 2016-03-20 17:08:03 +02:00
Roman Mogilatov
0e5bdc4e59 Adding google search console verification code 2016-03-20 16:49:49 +02:00
Roman Mogilatov
d2603c3d17 Update MovieLister example 2016-03-20 16:42:54 +02:00
Roman Mogilatov
59615bc88b Add draft version of MovieLister example 2016-03-18 18:47:44 +02:00
Roman Mogilatov
40f7e6ed26 Update README title 2016-03-17 02:12:34 +02:00
Roman Mogilatov
4584c33068 Add changelog for 1.15.1 version 2016-03-17 02:05:54 +02:00
Roman Mogilatov
313d1857af Bumping version 2016-03-17 02:05:40 +02:00
Roman Mogilatov
41c5d16888 Update title on docs index page 2016-03-17 02:03:49 +02:00
Roman Mogilatov
92c099f499 Fix some small docblock errors in providers module 2016-03-17 02:03:09 +02:00
Roman Mogilatov
10cc6fed7d Update README title 2016-03-17 02:02:38 +02:00
Roman Mogilatov
53f156cb49 Update package information 2016-03-17 02:02:17 +02:00
Roman Mogilatov
043665f8e5 Fix provider overriding tests 2016-03-14 00:15:28 +02:00
Roman Mogilatov
d51f2fa79a Add returning of overriding provider in provider overriding context 2016-03-14 00:08:41 +02:00
Roman Mogilatov
2f50fcb9e7 Add 1.15.0 changelog 2016-03-14 00:08:12 +02:00
Roman Mogilatov
a531650c77 Update main examples and README 2016-03-14 00:04:55 +02:00
Roman Mogilatov
1f7a76ef5e Add provider OverridingContext 2016-03-13 22:46:32 +02:00
Roman Mogilatov
cfaaa723fe 1.14.11 release 2016-03-11 13:01:26 +02:00
Roman Mogilatov
dba896670c 1.14.10 release 2016-03-09 11:39:05 +02:00
Roman Mogilatov
85c5759af9 Update README with catalog-providing-callbacks example 2016-03-09 10:49:49 +02:00
Roman Mogilatov
92df7338ca Add catalog-providing-callbacks exaple and some tests for it 2016-03-09 10:25:17 +02:00
Roman Mogilatov
ad27f44b67 1.14.9 release 2016-03-01 17:04:01 +02:00
Roman Mogilatov
fbf654d824 Update doc block for Provider.override() method 2016-03-01 16:46:13 +02:00
Roman Mogilatov
972b335f36 Update auth system example and README 2016-03-01 16:44:13 +02:00
Roman Mogilatov
37fde8e97c Add tests for @providers.override decorator 2016-03-01 16:28:37 +02:00
Roman Mogilatov
86ef17c75a Add storing of originaly decorated instance in @inject decorator 2016-03-01 16:28:05 +02:00
Roman Mogilatov
92a58cd4f9 Move fetch_cls_init() to utils module 2016-03-01 15:42:06 +02:00
Roman Mogilatov
a86df49160 Add providers @override decorator 2016-03-01 15:25:34 +02:00
Roman Mogilatov
e46ffeb1bc Make Provider.override() return overriding provider 2016-03-01 12:27:22 +02:00
Roman Mogilatov
9f2a521888 Refactor inject decorator 2016-03-01 12:25:54 +02:00
Roman Mogilatov
c8fda3da8d Add FactoryAsDecoratorTests 2016-02-28 17:50:47 +02:00
Roman Mogilatov
71b820487e Replace pep257 with pydocstyle 2016-02-28 16:01:20 +02:00
Roman Mogilatov
b53c1bbffe 1.14.8 release 2016-02-27 00:19:09 +02:00
Roman Mogilatov
b38ade5b69 1.14.7 release 2016-02-27 00:17:41 +02:00
Roman Mogilatov
9da9ef7153 1.14.6 release 2016-02-27 00:07:32 +02:00
Roman Mogilatov
beb7bbd3d9 1.14.5 release 2016-02-26 19:34:30 +02:00
Roman Mogilatov
52f2eedd6a Add auth system example 2016-02-26 13:36:19 +02:00
Roman Mogilatov
b433a730bc Update documentation 2016-02-08 01:42:21 +02:00
Roman Mogilatov
6c26643e92 1.14.3 release 2016-02-08 00:37:39 +02:00
Roman Mogilatov
0e5ec6956e Optimize provider calls 2016-02-08 00:29:41 +02:00
Roman Mogilatov
f0f5822d14 1.14.2 release 2016-02-04 22:55:41 +02:00
Roman Mogilatov
b5e07c42e6 Update README, docs and setup.py with new description 2016-02-04 22:54:01 +02:00
Roman Mogilatov
b43a96d743 1.14.1 release 2016-02-01 23:18:07 +02:00
Roman Mogilatov
685108fdbe Add meta description & keyword on docs index page 2016-02-01 23:14:04 +02:00
Roman Mogilatov
449a67eede 1.14.0 Drop support of Python 3.2 2016-01-25 15:07:11 +02:00
Roman Mogilatov
d6c84df816 Change short description in docs 2016-01-19 13:08:20 +02:00
Roman Mogilatov
3d8de194ac Update PyPi info 2016-01-11 11:30:50 +02:00
Roman Mogilatov
ae6067b96a Transfer ownership to ETS Labs 2016-01-11 11:20:29 +02:00
Roman Mogilatov
f1429d557a Update concept examples with provider overriding example 2016-01-11 11:14:37 +02:00
Roman Mogilatov
0031003a14 Transfer to ETS Labs 2016-01-11 10:53:35 +02:00
Roman Mogilatov
7f46524162 1.13.0 release 2015-12-28 17:40:26 +02:00
Roman Mogilatov
319128260a Add DelegatedCallable, DelegatedFactory & DelegatedSingleton providers 2015-12-28 17:25:25 +02:00
Roman Mogilatov
0d00e2b0f5 1.12.0 release 2015-12-15 17:02:21 +02:00
Roman Mogilatov
ca3cf1a7ac Add docs about catalogs specialization 2015-12-15 16:49:23 +02:00
Roman Mogilatov
5cc5794f66 Update Factory and Singleton specialization docs 2015-12-15 16:48:13 +02:00
Roman Mogilatov
c6b79a8052 Update catalogs and providers error messages 2015-12-15 16:47:26 +02:00
Roman Mogilatov
76e4837201 Add validation for catalog providers type 2015-12-14 11:22:55 +02:00
Roman Mogilatov
99cd7bfda6 Update catalogs API docs 2015-12-14 10:59:17 +02:00
Roman Mogilatov
1ca17fdeff Update injections API docs 2015-12-14 10:22:15 +02:00
Roman Mogilatov
790860f426 Merge remote-tracking branch 'origin/factory_provided_type' 2015-12-13 23:29:48 +02:00
Roman Mogilatov
80a329d480 Add docs about Factory and Singleton provides specialization 2015-12-13 14:22:59 +02:00
Roman Mogilatov
f3668ed815 Make some refactorings for providers 2015-12-11 22:46:49 +02:00
Roman Mogilatov
10e76f65d7 Add validation of provided type for Factory provider 2015-12-11 16:01:07 +02:00
Roman Mogilatov
ee37558946 1.11.2 release 2015-12-11 11:40:00 +02:00
Roman Mogilatov
4285205dca Update concept example in README 2015-12-11 11:39:47 +02:00
Roman Mogilatov
7b35909083 Add new one concept example that uses full syntax 2015-12-11 11:37:25 +02:00
Roman Mogilatov
12c4463901 Merge remote-tracking branch 'origin/providers_representation' 2015-12-11 11:36:13 +02:00
Roman Mogilatov
6b098768f6 Update changelog and injections API docs 2015-12-11 11:35:48 +02:00
Roman Mogilatov
7b611820c5 Add smarter providers representation 2015-12-11 11:18:09 +02:00
Roman Mogilatov
9ef7a961f6 Update representation of injections 2015-12-09 19:28:52 +02:00
Roman Mogilatov
5bb20a9c2d Improve representation of injections 2015-12-07 14:31:51 +02:00
Roman Mogilatov
cadcf73362 1.11.1 release 2015-11-30 12:09:56 +02:00
Roman Mogilatov
baa1a86cfe Fix module API references in docs 2015-11-29 23:30:48 +02:00
Roman Mogilatov
e309425ee5 Update sys.path in docs/conf.py 2015-11-29 22:46:48 +02:00
Roman Mogilatov
bec9ef36d2 Add ordering by source for API docs 2015-11-29 22:24:29 +02:00
Roman Mogilatov
a68aeddc7e Remove warning about short heading in writing of custom providers docs 2015-11-29 11:53:45 +02:00
Roman Mogilatov
2103420fb9 1.11.0 release 2015-11-26 15:50:12 +02:00
Roman Mogilatov
1ecd24af7d Merge remote-tracking branch 'origin/docs_update_for_0.11' 2015-11-26 15:35:13 +02:00
Roman Mogilatov
bac3249b50 Update changelog 2015-11-26 15:34:14 +02:00
Roman Mogilatov
449dff6282 Restrict overriding of catalogs by themselves 2015-11-26 15:11:46 +02:00
Roman Mogilatov
ab3e901d7e Add DynamicCatalog docs 2015-11-26 13:39:42 +02:00
Roman Mogilatov
7c3daf4c64 Update providers module API docs 2015-11-25 15:14:24 +02:00
Roman Mogilatov
6e6cac380b Update catalogs module API docs 2015-11-25 15:10:49 +02:00
Roman Mogilatov
f3538955c8 Update injections module API docs 2015-11-25 15:02:20 +02:00
Roman Mogilatov
b5ea234701 Update providers module API docs 2015-11-25 14:58:51 +02:00
Roman Mogilatov
934261d870 Update utils module API docs 2015-11-25 14:41:03 +02:00
Roman Mogilatov
a8fb12dcd4 Change scope of IS_PYPY and OBJECT_INIT constants in injections module to protected 2015-11-25 14:40:49 +02:00
Roman Mogilatov
ff629989bb Make DynamicCatalog.last_overriding and DeclarativeCatalog.last_overriding attributes None by default 2015-11-25 13:39:50 +02:00
Roman Mogilatov
b05eefedea Add top-level package docs to API docs 2015-11-25 13:26:04 +02:00
Roman Mogilatov
b7f42a3ff4 Make Provider.last_overriding None by default 2015-11-25 13:25:40 +02:00
Roman Mogilatov
dd80bb3c17 Add tests for singleton attributes 2015-11-24 12:19:49 +02:00
Roman Mogilatov
0a6e05657e Update catalogs API docs 2015-11-24 10:33:29 +02:00
Roman Mogilatov
09de5a6021 Update providers API docs 2015-11-24 10:33:20 +02:00
Roman Mogilatov
46a89600cb Update injections API docs 2015-11-24 10:33:10 +02:00
Roman Mogilatov
a064ce97da Update catalogs API docs 2015-11-24 09:59:53 +02:00
Roman Mogilatov
9de675b385 Update internals diagram 2015-11-24 09:34:39 +02:00
Roman Mogilatov
64bc56cbb9 Add test for catalog module backward compatibility 2015-11-23 21:46:22 +02:00
Roman Mogilatov
524cd78c5f Add VERSION to API docs and add test for VERSION 2015-11-23 21:46:22 +02:00
Roman Mogilatov
119ba9dda0 Update installation and introduction docs 2015-11-23 21:46:22 +02:00
Roman Mogilatov
876081fac6 Update @inject decorator docs 2015-11-23 21:46:22 +02:00
Roman Mogilatov
ec1c488c44 Update advanced examples 2015-11-23 21:46:21 +02:00
Roman Mogilatov
81f278d3dc Update concept example 2015-11-23 21:46:21 +02:00
Roman Mogilatov
8d0b82cf36 Update providers index docs page 2015-11-23 21:46:21 +02:00
Roman Mogilatov
dcf247ad3e Update config providers API docs 2015-11-23 21:46:21 +02:00
Roman Mogilatov
1fd54927c5 Update writing of custom providers docs 2015-11-23 21:46:21 +02:00
Roman Mogilatov
9b4e325a2d Update provider overriding docs 2015-11-23 21:46:20 +02:00
Roman Mogilatov
91dcfea775 Update external dependency provider docs, including API, and examples 2015-11-23 21:46:20 +02:00
Roman Mogilatov
a65155ed1c Update callable provider docs, including API, and examples 2015-11-23 21:46:20 +02:00
Roman Mogilatov
cea843160c Update static providers docs, including API, and examples 2015-11-23 21:46:20 +02:00
Roman Mogilatov
61e6f2db60 Update singleton provider docs, including API, and examples 2015-11-23 21:46:19 +02:00
Roman Mogilatov
fb6deaec96 Update factory provider API docs 2015-11-23 21:46:19 +02:00
Roman Mogilatov
7eed1cf880 Update Factory provider docs and examples 2015-11-23 21:46:19 +02:00
Roman Mogilatov
556c842685 Update catalogs overriding docs 2015-11-23 21:46:19 +02:00
Roman Mogilatov
e55f6ed212 Update catalog bundles docs 2015-11-23 21:46:19 +02:00
Roman Mogilatov
b29387abdd Add nocover modified for DeclarativeCatalog __getattr__(), __setattr__(), __delattr__() 2015-11-23 21:46:18 +02:00
Roman Mogilatov
801716fd92 Update catalog bundle and dynamic catalog api docs 2015-11-23 21:46:18 +02:00
Roman Mogilatov
9e4138da96 Add API docs for declarative catalog meta class 2015-11-23 21:46:18 +02:00
Roman Mogilatov
9a5e8f4a5a Update docs for declarative catalogs 2015-11-23 21:46:18 +02:00
Roman Mogilatov
dc79339cae Add errors module API docs 2015-11-23 21:46:17 +02:00
Roman Mogilatov
ec6bd0c2c1 Add API docs 2015-11-23 21:46:17 +02:00
Roman Mogilatov
da4976e3c7 Add DeclarativeCatalog API docs 2015-11-23 21:46:17 +02:00
Roman Mogilatov
4683ada2ce Add declarative catalog docs 2015-11-23 21:46:16 +02:00
Roman Mogilatov
3c0c3b3abc Refactor tests imports 2015-11-23 21:45:58 +02:00
Roman Mogilatov
99b9a5648a Restrict overriding of providers with themselves 2015-11-20 13:51:36 +02:00
Roman Mogilatov
176ff06778 Merge remote-tracking branch 'origin/dynamic_catalogs' 2015-11-13 11:33:15 +02:00
Roman Mogilatov
f090a73486 Add DynamicCatalog tests 2015-11-12 18:35:23 +02:00
Roman Mogilatov
2236d77313 Refactor DeclarativeCatalog 2015-11-12 16:56:00 +02:00
Roman Mogilatov
be1ff0445d Refactor DeclarativeCatalog 2015-11-12 13:57:33 +02:00
Roman Mogilatov
4252fbfe4c Implement DeclarativeCatalog.__repr__ and add some tests for it 2015-11-12 01:00:27 +02:00
Roman Mogilatov
3fc5f044f9 Update DeclarativeCatalog and Override tests 2015-11-11 21:25:41 +02:00
Roman Mogilatov
ed898f7fe2 Add UndefinedProviderError(Error, AttributeError) for proper work of hasattr() 2015-11-11 19:48:24 +02:00
Roman Mogilatov
9a617479cc Refactor CatalogBundle 2015-11-11 15:51:42 +02:00
Roman Mogilatov
7684bc7dcb Refactor DynamicCatalog 2015-11-11 15:45:39 +02:00
Roman Mogilatov
677e7143a2 Change CatalogBundle initialization procedure 2015-11-11 15:19:24 +02:00
Roman Mogilatov
548847f83a Remove required DynamicCatalog.name attribute 2015-11-10 19:47:59 +02:00
Roman Mogilatov
05d6db5664 Make some refactoring after DynamicCatalog implementation 2015-11-10 19:38:18 +02:00
Roman Mogilatov
b456d770b6 Implement DynamicCatalog 2015-11-10 17:58:04 +02:00
Roman Mogilatov
8b175f0b71 Refactor DeclarativeCatalog metaclass 2015-11-10 15:15:48 +02:00
Roman Mogilatov
7483e98f2b Merge remote-tracking branch 'origin/providers_to_catalogs_binding_restrictions' 2015-11-10 15:06:54 +02:00
Roman Mogilatov
c5602cf88b Change provider-to-catalog binding restrictions 2015-11-10 15:06:12 +02:00
Roman Mogilatov
0376bfeb10 Merge remote-tracking branch 'origin/providers_to_catalogs_binding_restrictions' 2015-11-10 15:01:27 +02:00
Roman Mogilatov
b076b871a1 Change provider-to-catalog binding restrictions 2015-11-10 15:01:06 +02:00
Roman Mogilatov
9f526a3ceb Merge remote-tracking branch 'origin/abstract_catalog_to_declarative_catalog_renaming' 2015-11-10 10:42:45 +02:00
Roman Mogilatov
68ce5c79ef Rename AbstractCatalog to DeclarativeCatalog 2015-11-10 10:42:29 +02:00
Roman Mogilatov
482fa566c5 Fix typy-hinting in catalog bundles example 2015-11-09 10:41:34 +02:00
Roman Mogilatov
b22b893623 0.10.5 release 2015-11-04 16:32:04 +02:00
Roman Mogilatov
addbd16b3b 0.10.4 release 2015-11-02 10:58:09 +02:00
Roman Mogilatov
dd4e6d4aa0 Remove VERSION file from MANIFEST.in 2015-11-02 10:56:36 +02:00
Roman Mogilatov
607e51e218 Update example docblocks 2015-10-26 12:52:52 +02:00
Roman Mogilatov
53f692a78c Fix bug with injecting entities with __getattr__ implementations 2015-10-23 18:07:52 +03:00
Roman Mogilatov
a42fefacef Update some examples 2015-10-23 17:05:24 +03:00
Roman Mogilatov
79bde335fa Add changelog for version 0.10.0 2015-10-23 16:49:07 +03:00
Roman Mogilatov
beb523a921 Merge remote-tracking branch 'origin/catalog_overriding_improvements' 2015-10-23 16:42:11 +03:00
Roman Mogilatov
b269023f7a Improve functionality of catalog overriding 2015-10-23 16:41:21 +03:00
Roman Mogilatov
f00b3612f8 Merge remote-tracking branch 'origin/package_versioning' 2015-10-23 15:20:46 +03:00
Roman Mogilatov
3fac75cb79 Move version number inside dependency_injector package 2015-10-23 15:20:25 +03:00
Roman Mogilatov
9a9861e4b0 Merge remote-tracking branch 'origin/inject_decorator_positional_args' 2015-10-23 15:04:33 +03:00
Roman Mogilatov
d07a2eae25 Update inject() decorator docs with positional argument injections example and some description 2015-10-23 15:04:04 +03:00
Roman Mogilatov
6dc007c8df Add functionality for using positional argument injections with @inject decorator 2015-10-23 14:44:36 +03:00
Roman Mogilatov
a37f1fc256 Fix Callable.injections attribute test 2015-10-23 09:59:25 +03:00
Roman Mogilatov
0da60aafef Merge remote-tracking branch 'origin/callable_injections_attribute' 2015-10-22 17:48:34 +03:00
Roman Mogilatov
5bdca32779 Add Callable.injections read-only attribute for getting a full list of Callable injections 2015-10-22 17:43:29 +03:00
Roman Mogilatov
2052992a99 Merge remote-tracking branch 'origin/callable_provider_positional_args' 2015-10-22 16:55:56 +03:00
Roman Mogilatov
dd5cc79dd1 Update docs of Callable provider with description of positional agrument injections and new example 2015-10-22 16:52:48 +03:00
Roman Mogilatov
59b98959bc Add support of positional argument injections for Callable provider
Also current commit contains:
- Some refactoring of internals
- Additional unit tests for Factory and Singleton providers
2015-10-21 11:47:37 +03:00
Roman Mogilatov
402539ed7f Merge remote-tracking branch 'origin/factory_and_singleton_positional_args' 2015-10-19 17:31:42 +03:00
Roman Mogilatov
cc29d68337 Update Factory docs about positional and keyword arguments 2015-10-19 17:29:00 +03:00
Roman Mogilatov
9b4a7bd28c Add additional unittests for full validation of Singleton provider 2015-10-19 15:41:16 +03:00
Roman Mogilatov
b61e3ee007 Fix test of Injection.value with catalog bundle 2015-10-19 14:53:38 +03:00
Roman Mogilatov
824ed4f3e9 Add support of positional args for Factory & Singleton providers 2015-10-19 14:50:15 +03:00
Roman Mogilatov
2a5ed703bf Merge remote-tracking branch 'origin/catalog_bundles' 2015-10-19 12:14:55 +03:00
Roman Mogilatov
7a4ffa140f Add functionality of checking catalog bundles ownership 2015-10-19 12:12:38 +03:00
Roman Mogilatov
017af8ff45 Update catalog bundle docs 2015-10-19 11:39:34 +03:00
Roman Mogilatov
c13bee6fb5 Add optimization for Injection.value property 2015-10-19 10:50:17 +03:00
Roman Mogilatov
53025756d8 Fix bug with injections of catalog bundles 2015-10-19 10:47:24 +03:00
Roman Mogilatov
682c4498ca Remove old catalog bundles example 2015-10-19 10:31:53 +03:00
Roman Mogilatov
6206cdde8d Update catalog bundles example 2015-10-19 10:31:21 +03:00
Roman Mogilatov
47127e2839 Update note in changelog about adding catalog provider bundles feature 2015-10-17 01:16:12 +03:00
Roman Mogilatov
476e867dc9 Restrict repeatedly binding of catalog providers 2015-10-17 01:00:32 +03:00
Roman Mogilatov
5799b6ff33 Update catalog provider bundles docs 2015-10-17 00:42:22 +03:00
Roman Mogilatov
40dc54b64b Refactor catalog bundle 2015-10-16 23:54:51 +03:00
Roman Mogilatov
730d46f9a0 Add catalog packs 2015-10-15 20:16:40 +03:00
Roman Mogilatov
3b54763563 Change catalog subsets factory implementation 2015-10-14 18:34:50 +03:00
Roman Mogilatov
4b22680406 Update subset unit tests 2015-10-14 18:07:28 +03:00
Roman Mogilatov
2ed460f054 Refactor catalog subsets 2015-10-14 17:51:05 +03:00
Roman Mogilatov
e1d6583157 Merge remote-tracking branch 'origin/six-1.10.0-support' 2015-10-12 18:41:56 +03:00
Roman Mogilatov
5a5178a025 Add notice about starting of support six 1.10.0 to changelog 2015-10-12 18:41:35 +03:00
Roman Mogilatov
8f67fcfd81 Add support of six-1.10.0 2015-10-12 18:25:21 +03:00
Roman Mogilatov
42bf37db83 Merge remote-tracking branch 'origin/py35-compat' 2015-10-12 18:22:13 +03:00
Roman Mogilatov
b95147b09a Add notes about Python 3.5 support into changelog 2015-10-12 18:20:46 +03:00
Roman Mogilatov
4647bd2945 Add Python 3.5 classifier 2015-10-12 18:20:20 +03:00
Roman Mogilatov
4237184767 Add py35 to TOXENVs 2015-10-12 18:13:54 +03:00
Roman Mogilatov
624e1cef63 Add travis env variable for running tests on py35 2015-10-12 17:48:12 +03:00
Roman Mogilatov
60f48ab3d9 Add tox commands for running tests on py35 2015-10-12 16:51:14 +03:00
Roman Mogilatov
d7462abeff Merge remote-tracking branch 'origin/catalog_subsets' 2015-10-12 16:43:51 +03:00
Roman Mogilatov
3e8232e9db Add catalog subsets 2015-10-12 16:41:38 +03:00
Roman Mogilatov
b1cb5b2d56 Add info about refactorings and code style fixes to changelog 2015-10-12 00:11:30 +03:00
Roman Mogilatov
cb333a1425 Merge remote-tracking branch 'origin/pep257-d211' 2015-10-11 23:43:42 +03:00
Roman Mogilatov
8ab0cc5e0e Fix PEP257 D211 error 2015-10-11 23:41:55 +03:00
Roman Mogilatov
b7bab4938f Merge remote-tracking branch 'origin/enhancement_of_catalog_inheritance' 2015-10-07 19:57:40 +03:00
Roman Mogilatov
9c661744d5 Update docs about catalogs inheritance 2015-10-07 19:57:03 +03:00
Roman Mogilatov
ee73f03cb2 Implement catalog providers, cls_providers and inherited providers class attributes 2015-10-07 14:06:11 +03:00
Roman Mogilatov
53e8f62c89 Merge remote-tracking branch 'origin/inject_for_classes' 2015-09-28 22:19:28 +03:00
Roman Mogilatov
94b2dee48a Add docs for usage of @inject decorator with classes 2015-09-28 21:56:36 +03:00
Roman Mogilatov
512544ea9f Add fix for @inject decorator with classes on PyPy and Py3 2015-09-28 21:55:30 +03:00
Roman Mogilatov
2c85b38113 Fix bug with default object.__init__ in Py3 2015-09-28 14:32:07 +03:00
Roman Mogilatov
1c55f9d645 Add functionality for @inject decorator to work with classes 2015-09-28 14:19:22 +03:00
Roman Mogilatov
fd5aa5cb5a Revert "Add tests run on Python 3.5"
This reverts commit d8b4be55a6.
2015-09-21 17:57:14 +03:00
Roman Mogilatov
d8b4be55a6 Add tests run on Python 3.5 2015-09-21 17:50:09 +03:00
Roman Mogilatov
6cbd0ce7fc 0.9.5 release 2015-09-14 10:53:24 +03: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
b5ad081976 Add few minor refactorings 2015-09-03 16:00:23 +03:00
Roman Mogilatov
4291f0efc1 Release 0.9.1 2015-09-03 00:27:56 +03:00
Roman Mogilatov
50a3db6b94 Update Factory provider docs 2015-09-03 00:24:20 +03:00
Roman Mogilatov
2d5ce49254 Update factory attribute injections docs 2015-09-02 23:02:58 +03:00
Roman Mogilatov
479f50fb76 Update Factory method injections docs 2015-09-02 22:59:06 +03:00
Roman Mogilatov
b8a30601df Update Factory providers delegation docs 2015-09-02 22:53:39 +03:00
Roman Mogilatov
f9b4652e74 Update basic factory example and docs 2015-09-02 22:18:13 +03:00
Roman Mogilatov
98c4ec71c1 Update Singleton provider docs 2015-09-02 19:06:09 +03:00
Roman Mogilatov
1e1266a4d3 Update static providers example 2015-09-02 18:56:32 +03:00
Roman Mogilatov
b866229efb Update ExternalDependency provider example 2015-09-02 18:55:36 +03:00
Roman Mogilatov
444af2ab0e Update Callable provider docs 2015-09-02 18:48:11 +03:00
Roman Mogilatov
9326fdace4 Update ExternalDependency provider docs 2015-09-02 18:36:43 +03:00
Roman Mogilatov
a9eedc6760 Update static providers docs 2015-09-02 18:16:25 +03:00
Roman Mogilatov
a7ca196ee0 Update providers overriding docs 2015-09-02 18:14:13 +03:00
Roman Mogilatov
b0c51b0292 Add minor fixes for @di.inject() docs 2015-09-02 18:13:06 +03:00
Roman Mogilatov
54da9913eb Update docs about writing custom providers 2015-09-02 17:20:19 +03:00
Roman Mogilatov
ef5c360a30 Update catalog docs 2015-09-02 12:23:18 +03:00
Roman Mogilatov
c5c0fdbd05 Update @di.inject() documentation 2015-09-02 12:23:01 +03:00
Roman Mogilatov
0a4e8c6934 Update catalog docs examples 2015-09-02 00:24:19 +03:00
Roman Mogilatov
e1fc8dde39 Update @di.inject examples comments 2015-09-01 22:30:49 +03:00
Roman Mogilatov
62df0bb853 Update @di.inject decorator docs for 0.9.x release 2015-09-01 19:08:35 +03:00
Roman Mogilatov
57d5a30726 Update installation docs for 0.9.x release 2015-09-01 16:29:28 +03:00
Roman Mogilatov
88a7168821 Update introduction docs for 0.9.x 2015-09-01 16:28:11 +03:00
Roman Mogilatov
babb49448a Add simplified syntax of kwarg injections for `Callable` provider 2015-09-01 15:24:47 +03:00
Roman Mogilatov
bb33c925de Add simplified syntax of kwarg injections for `Callable` provider 2015-09-01 15:21:55 +03:00
Roman Mogilatov
a1cf735391 Add Injection into __all__ list of top level package 2015-09-01 15:08:42 +03:00
Roman Mogilatov
ad2072688b Update test imports 2015-09-01 15:02:00 +03:00
Roman Mogilatov
4fb3a12770 Add additional shortcuts for top level package 2015-09-01 15:01:15 +03:00
Roman Mogilatov
15ed4020bc Update latest changelog 2015-09-01 00:41:10 +03:00
Roman Mogilatov
7d5f419a83 Update latest changelog 2015-09-01 00:37:21 +03:00
Roman Mogilatov
0a4cfc0d7e Fix minor issues in introduction 2015-09-01 00:36:56 +03:00
Roman Mogilatov
bab7265a90 Make minor import refactorings 2015-09-01 00:36:26 +03:00
Roman Mogilatov
234e5cb3fc Update readme with new concept example 2015-09-01 00:36:02 +03:00
Roman Mogilatov
01970dba27 Add simplified kwarg injections syntax for Factory and Singleton providers 2015-09-01 00:31:29 +03:00
Roman Mogilatov
6ac0e4a04e Add simplified syntax for @inject decorator 2015-09-01 00:30:38 +03:00
Roman Mogilatov
ec2cc5dfaf Update to 0.8.1 version 2015-08-31 16:36:31 +03:00
Roman Mogilatov
6d0f892f8a Rename Objects to Dependency Injector 2015-08-31 16:31:38 +03:00
Roman Mogilatov
c9374038be Fixing @inject import bug in example 2015-08-17 22:44:28 +03:00
Roman Mogilatov
c36e7b941c Changelog and version update, 0.7.7 2015-08-05 17:44:22 +03:00
Roman Mogilatov
ce9a223eb9 Fixing bug in concept example 2015-08-05 17:42:56 +03:00
Roman Mogilatov
3c7e7a8434 Updating concept example 2015-08-05 17:33:38 +03:00
Roman Mogilatov
d286b2565c Updating docs main page 2015-08-05 17:33:26 +03:00
Roman Mogilatov
fae322fc7f Updating README 2015-08-05 17:33:12 +03:00
Roman Mogilatov
f98b3aae01 Moving config provider example into advanced usage examples 2015-08-05 17:32:56 +03:00
Roman Mogilatov
7f82c89d95 Changing docs structure, move .rst docs out from root 2015-08-05 17:24:03 +03:00
Roman Mogilatov
d2ec7fbe45 Adding @inject decorator docs 2015-08-05 17:22:25 +03:00
Roman Mogilatov
e10f915100 Removing notes about @override decorator from advanced usage docs 2015-08-05 17:03:43 +03:00
Roman Mogilatov
a94864d654 Removing old @inject decorator examples 2015-08-05 17:03:06 +03:00
Roman Mogilatov
3d354a1cb5 Repair of config provider example 2015-08-05 17:02:28 +03:00
Roman Mogilatov
e6705f1089 Removing old catalog example 2015-08-05 17:01:46 +03:00
Roman Mogilatov
c19a7ed400 Adding @inject() decorator examples 2015-08-05 17:01:23 +03:00
Roman Mogilatov
4ccf38942b Removing old doc about entities 2015-08-05 17:00:46 +03:00
Roman Mogilatov
9735448e61 Adding catalogs documentation 2015-08-05 16:44:00 +03:00
Roman Mogilatov
41535dea0c Adding draft of catalog docs 2015-08-04 17:05:34 +03:00
Roman Mogilatov
ae7b910e85 Adding Main Entities section into Introduction docs 2015-08-04 16:13:33 +03:00
Roman Mogilatov
9773f361dd Removing of unnecessary NL 2015-08-04 16:12:58 +03:00
Roman Mogilatov
3b0c9f9e9d Adding changelog and description of 0.7.6 release 2015-08-03 23:41:46 +03:00
Roman Mogilatov
66c0e13aaf Updating docs introduction 2015-08-03 22:36:35 +03:00
Roman Mogilatov
f8fc6d49d6 Updating installation docs 2015-08-03 22:36:08 +03:00
Roman Mogilatov
d7b146810e Removing examples section from docs 2015-08-03 22:33:20 +03:00
Roman Mogilatov
223e494d56 Replacing static provider documentation examples with literalincludes 2015-08-03 15:57:06 +03:00
Roman Mogilatov
139cdd2d2e Replacing singleton provider documentation examples with literalincludes 2015-08-03 15:56:40 +03:00
Roman Mogilatov
abcd8f5369 Replacing providers overriding documentation examples with literalincludes 2015-08-03 15:52:23 +03:00
Roman Mogilatov
cbe7069227 Replacing callable provider documentation examples with literalincludes 2015-08-03 15:49:55 +03:00
Roman Mogilatov
a822f9e6d2 Replacing custom providers documentation example with literalinclude 2015-08-03 15:47:42 +03:00
Roman Mogilatov
051ed8cb7b Replacing ExternalDependeny provider examples in documentation with literalinclude 2015-08-03 15:45:58 +03:00
Roman Mogilatov
6d77bd18aa Replacing factory examples in docs with literalincludes 2015-08-03 15:42:44 +03:00
Roman Mogilatov
498465b705 Moving @override decorator into catalogs module and @inject decorator into injections module 2015-08-03 12:57:42 +03:00
Roman Mogilatov
90455beb4c #85 Objects could not be installed if six != 1.8.0 2015-07-31 16:01:07 +03:00
Roman Mogilatov
d12f3ff2ff Reformating of examples structure 2015-07-28 09:51:24 +03:00
Roman Mogilatov
ae95ecf711 Updating docs structure 2015-07-28 09:46:35 +03:00
Roman Mogilatov
f278f21101 Removing old docs 2015-07-28 09:46:06 +03:00
Roman Mogilatov
6d3f212531 Increasing image size in factory init injections documentation 2015-07-28 01:38:14 +03:00
Roman Mogilatov
64a1820ee6 Updating main image for singleton provider documentation 2015-07-28 01:37:42 +03:00
Roman Mogilatov
20fc743a22 Updating index page of providers documentation 2015-07-28 01:31:19 +03:00
Roman Mogilatov
5d4969ac78 Removing docs about providers extending 2015-07-28 01:30:34 +03:00
Roman Mogilatov
6d2f10fb7c Updating factory first example image 2015-07-28 01:30:05 +03:00
Roman Mogilatov
bc39251426 Adding docs about writing custom providers 2015-07-28 01:29:31 +03:00
Roman Mogilatov
06d66b87e9 Refactoring of Callable provider using get_injectable_kwargs() 2015-07-27 18:50:27 +03:00
Roman Mogilatov
5561069d50 Refactoring of kwargs injecting 2015-07-27 01:44:40 +03:00
Roman Mogilatov
0364128ba5 Minor changes for factory delegation docs 2015-07-25 05:33:35 +03:00
Roman Mogilatov
024b148c54 Adding docs for overriding of providers 2015-07-25 04:57:38 +03:00
Roman Mogilatov
bfa40aec10 Adding minor changes to docblocks of overriding example 2015-07-25 00:52:09 +03:00
Roman Mogilatov
244e2bcfb9 Moving images from provider docs to providers/ subdir 2015-07-25 00:51:14 +03:00
Roman Mogilatov
947a0667a6 Changing comments in factory examples 2015-07-25 00:14:45 +03:00
Roman Mogilatov
0972e79130 Adding new providers overriding examples 2015-07-25 00:12:52 +03:00
Roman Mogilatov
6f11715d24 Removing of old providers overriding examples 2015-07-25 00:12:24 +03:00
Roman Mogilatov
cb78f34c1e Adding minor changes to classifiers and some code style fixes 2015-07-24 20:23:42 +03:00
Roman
55a3e94d57 Merge pull request #84 from rmk135/0.7.6
0.7.6 current progress
2015-07-24 19:50:47 +03:00
Roman Mogilatov
033a97d4da Removing old Factory&Singleton examples 2015-07-24 12:23:10 +03:00
Roman Mogilatov
878f1d49aa Removing old examples 2015-07-24 12:21:27 +03:00
Roman Mogilatov
2c2d4f7434 Removing of Factory restriction to operate with class types only, factory methods are valid now 2015-07-24 00:28:52 +03:00
Roman Mogilatov
040aad93f8 Make all protected attributes _protected 2015-07-22 16:42:36 +03:00
Roman Mogilatov
541d3c0e4b Refactoring of utils checks 2015-07-22 10:53:16 +03:00
Roman Mogilatov
1b4c6dbf8b Renaming of Provider.__provide__() -> Provider._provide() for improving providers extending 2015-07-22 10:26:34 +03:00
Roman Mogilatov
fd8be77635 Provider overriding first pages 2015-07-21 09:57:13 +03:00
Roman Mogilatov
6b482d87e0 Removing coveralls key from tox job 2015-07-21 09:48:50 +03:00
Roman Mogilatov
27441353d9 Updating coveralls job 2015-07-21 09:42:21 +03:00
Roman Mogilatov
7d3460deba Add functionality for resetting of last overriding provider 2015-07-21 09:29:50 +03:00
Roman Mogilatov
0efebb337f Adding explanation for Singleton and Callable providers delegation 2015-07-20 19:31:31 +03:00
Roman Mogilatov
996fc4ecbf Updating singleton examples 2015-07-20 18:58:39 +03:00
Roman Mogilatov
2690d9b9d4 Adding docs for factories delegation 2015-07-20 18:46:45 +03:00
Roman Mogilatov
311c15d389 Fixing minor typos in heading table 2015-07-20 13:00:03 +03:00
Roman Mogilatov
92a5982792 Replaceing pypip.in badges with shields.io ones 2015-07-20 12:58:51 +03:00
Roman Mogilatov
ab5bc6a503 Fixing bad for py3 dict.iteritems() usage after refactoring of Catalog using metaclasses 2015-07-17 19:43:23 +03:00
Roman Mogilatov
71101d98f8 Fixing py3 errors after recatoring of Catalog using metaclasses 2015-07-17 19:39:54 +03:00
Roman Mogilatov
0e272f9d58 Refactoring of Catalog using metaclass 2015-07-17 19:31:44 +03:00
Roman Mogilatov
3b9d36f2d2 Adding fixes for ExternalDependecy provider docs 2015-07-17 10:01:27 +03:00
Roman Mogilatov
839888f445 Adding some minor updates for providers delegation example 2015-07-16 02:50:55 +03:00
Roman Mogilatov
ec808b1361 Updating callable docs 2015-07-16 02:39:21 +03:00
Roman Mogilatov
67fb4181f4 Reverting of removing callable provider example 2015-07-16 00:49:20 +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
7f92b886bd removing example of callalbe provider 2015-07-15 16:14:40 +03:00
Roman Mogilatov
7224fd4b37 Updating callable provider docs 2015-07-14 02:37:25 +03:00
Roman Mogilatov
acc9259ddd Removing delegate option from injections 2015-07-11 23:34:23 +03:00
Roman Mogilatov
e38cecfae0 Updating example 2015-07-11 17:27:28 +03:00
Roman Mogilatov
4620ad7f29 Adding delegate option for injections 2015-07-11 17:21:36 +03:00
Roman Mogilatov
77f5d05071 Updating gitignore 2015-07-06 16:53:09 +03:00
Roman Mogilatov
4db4629c75 Fixing comment in catalogs 2015-07-06 16:52:51 +03:00
Roman Mogilatov
d3ee3edc4e Updating license file 2015-06-29 21:32:03 +03:00
Roman Mogilatov
db09503426 Adding better scalling for some factory and singleton documentation images 2015-06-26 10:21:23 +03:00
Roman Mogilatov
c56cb70a24 Adding images for singleton docs 2015-06-24 12:29:58 +03:00
Roman Mogilatov
c05879bada Updating factory provider doc images 2015-06-23 16:21:37 +03:00
Roman Mogilatov
a612e42a99 First steps with providers delegation docs 2015-06-19 12:44:46 +03:00
Roman Mogilatov
6a92056608 Removing old docs for config provider 2015-06-19 12:16:15 +03:00
Roman Mogilatov
8b479a1898 Removing old external dependency provider example 2015-06-18 16:37:19 +03:00
Roman Mogilatov
ab548df0b2 Minor Factory and Singleton provider docs update 2015-06-18 16:35:00 +03:00
Roman Mogilatov
e3ea517d72 Minor ExternalDependency provider updates, Adding ExternalDependency provider docs 2015-06-18 16:34:26 +03:00
Roman Mogilatov
dbc368d5f6 Minor updates for static provider docs 2015-06-18 14:55:13 +03:00
Roman Mogilatov
ef41688e61 Minor fixes in singleton docs 2015-06-18 14:45: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
d386969004 Adding Singleton docs & making some changes for Factory docs 2015-06-10 12:00:43 +03:00
Roman Mogilatov
3123574cf6 Changing provider docs structure 2015-06-10 09:53:15 +03:00
Roman Mogilatov
bb7cfcc124 Finishing of Factory provider docs 2015-06-08 11:33:27 +03:00
Roman Mogilatov
7c1c32db80 Updating Factory docs and examples 2015-06-05 12:28:12 +03:00
Roman Mogilatov
776bbc7dde small fixes for Factory docs and examples 2015-06-05 11:39:01 +03:00
Roman Mogilatov
2e8f59115f Complete of Factory docs, new Factory examples 2015-06-05 11:29:36 +03:00
Roman Mogilatov
d9952d5d85 Factory docs update 2015-06-03 15:50:13 +03:00
Roman Mogilatov
5b76551790 Working copy of docs 2015-05-27 19:00:41 +03:00
Roman Mogilatov
b055a86c92 Improving of Providers extending 2015-05-25 10:45:52 +03:00
Roman Mogilatov
f67343c45c Refactoring of @inject decorator 2015-05-16 22:01:03 +03:00
Roman Mogilatov
05b65f432c Updating instance providers example 2015-05-15 17:44:20 +03:00
Roman Mogilatov
a5337b2fc8 Last modifications on NewInstance to Factory provider renaming 2015-05-14 11:59:47 +03:00
Roman Mogilatov
0dd2884262 Refactoring of examples according to NewInstance provider to Factory provider renaming 2015-05-14 11:38:56 +03:00
Roman Mogilatov
c824eae566 Renaming NewInstance provider to Factory provider 2015-05-14 11:35:41 +03:00
Roman Mogilatov
405c579f7e Adding some drafts of @inject decorator docs 2015-05-14 11:21:04 +03:00
Roman Mogilatov
9d48044ea3 Correcing typo in providers docs 2015-05-13 18:46:46 +03:00
Roman Mogilatov
446a659bc8 Updating installation docs 2015-05-12 16:41:57 +03:00
Roman Mogilatov
c6eabb726c Updating introduction section 2015-05-12 16:18:37 +03:00
Roman Mogilatov
c646e3933a adding blank sections 2015-05-08 18:44:44 +03:00
Roman Mogilatov
227ddbd378 Finilizing of external dependecy provider documentation 2015-04-24 11:59:10 +03:00
Roman Mogilatov
fab6a5c610 Adding external dependency provider description and examples renaming 2015-04-23 13:15:10 +03:00
Roman Mogilatov
ca4db90ce3 Updating version to 0.7.6 2015-04-22 19:04:19 +03:00
Roman Mogilatov
1d6951ed70 Few words about external dependencies provider 2015-04-22 16:51:44 +03:00
Roman Mogilatov
8ee9378dda docs update 2015-04-18 22:45:51 +03:00
Roman Mogilatov
219932d9cc Adding docs on callale provider 2015-04-14 23:56:46 +03:00
Roman Mogilatov
be302793e1 Updating version to 0.8.0 2015-04-14 23:20:24 +03:00
Roman Mogilatov
b0720cfc2c moving @override and @inject decorators to decorators module 2015-04-14 23:17:53 +03:00
Roman Mogilatov
463f219307 Changing description 2015-04-14 20:18:25 +03:00
Roman Mogilatov
8e78f937c8 Incrementing version to 0.7.6 2015-04-14 20:14:23 +03:00
Roman Mogilatov
62fd6f37f2 Minor updates of setup.py 2015-04-03 16:21:42 +03:00
Roman Mogilatov
96930c9d36 Moving publish command to setup.py and removing manage.py and its requirements 2015-04-03 16:18:37 +03:00
Roman Mogilatov
fb40c949e4 0.7.3 release 2015-04-03 16:13:03 +03:00
Roman Mogilatov
5116a57aea Moving publish command to setup.py 2015-04-03 16:11:05 +03:00
Roman Mogilatov
e38d2664ea Updating version 2015-04-03 01:22:43 +03:00
Roman Mogilatov
e3b8948741 Adding crunch with README description 2015-04-03 01:01:05 +03:00
Roman Mogilatov
d53b6d9a87 Updating version to 0.7.0 2015-04-03 00:53:03 +03:00
Roman Mogilatov
d1f825c590 Removing old maintain requirements 2015-04-03 00:44:58 +03:00
Roman Mogilatov
d7fa0ca2ef Merge branch 'master' of https://github.com/rmk135/objects 2015-04-03 00:43:48 +03:00
Roman Mogilatov
c0bd263684 Removing pypandoc from maintain requirements 2015-04-03 00:43:35 +03:00
Roman
bedc4206fb Merge pull request #47 from rmk135/docs
Docs
2015-04-03 00:42:51 +03:00
Roman Mogilatov
a090303be6 Removing readme.md 2015-04-03 00:41:45 +03:00
Roman Mogilatov
78dd20ef39 Updating examples section 2015-04-03 00:40:03 +03:00
Roman Mogilatov
22de89c206 Updating readme 2015-04-03 00:37:49 +03:00
Roman Mogilatov
fb581ce47d Removing GitHub from README 2015-04-03 00:37:08 +03:00
Roman Mogilatov
25f1c222fd Adding examples seactions to readme 2015-04-03 00:35:22 +03:00
Roman Mogilatov
a0e0d4dc3f Adding feedback section to README 2015-04-03 00:33:28 +03:00
Roman Mogilatov
460038f3af Removing README.md 2015-04-03 00:31:26 +03:00
Roman Mogilatov
2880eaa727 Adding readme in rst format 2015-04-03 00:29:00 +03:00
Roman
48fce40e5a Update README.md 2015-04-03 00:11:19 +03:00
Roman Mogilatov
74bb47626d Adding feedback page 2015-04-03 00:04:36 +03:00
Roman Mogilatov
1673a11022 Updating doc styles 2015-04-02 23:46:53 +03:00
Roman Mogilatov
bbc5e83e07 Adding installation doc 2015-04-02 22:29:49 +03:00
Roman Mogilatov
bab92a58ae Removing Indicies and Tables from inde 2015-04-02 16:44:40 +03:00
Roman Mogilatov
f2aa8cddc0 updating default docs theme 2015-04-02 16:32:10 +03:00
Roman Mogilatov
1704c8e05f Adding doc files 2015-04-02 16:17:00 +03:00
Roman Mogilatov
4ef113f28b Adding rtd theme, name update 2015-04-02 11:57:33 +03:00
Roman Mogilatov
13496f78d3 Sphinx initial docs 2015-04-01 17:56:11 +03:00
Roman
f0a1a9f96f Merge pull request #46 from rmk135/description
Creating Description
2015-03-31 18:48:39 +03:00
Roman Mogilatov
73b8af1cbb Updating readme, adding examples of overriding catalog and providers, adding catalog example 2015-03-31 18:44:27 +03:00
Roman Mogilatov
b5870e9a57 Updating examples 2015-03-31 18:00:11 +03:00
Roman Mogilatov
0db7a67ef2 @inject description 2015-03-31 14:44:15 +03:00
Roman Mogilatov
e1009373bc Adding injections example 2015-03-31 12:37:16 +03:00
Roman Mogilatov
3ee60fa01b Updating providers description 2015-03-30 17:49:11 +03:00
Roman Mogilatov
d8c7a32220 Adding providers description 2015-03-30 17:34:32 +03:00
Roman Mogilatov
48ff686ae8 Removing unnecessary nl 2015-03-30 16:25:53 +03:00
Roman Mogilatov
f64d155154 Adding Injections desciption 2015-03-30 16:11:33 +03:00
Roman
90ff917267 Update README.md 2015-03-30 15:56:46 +03:00
Roman
b1800bfc08 Update README.md 2015-03-30 15:45:51 +03:00
Roman Mogilatov
27cf7acc35 Updating Introduction 2015-03-30 01:07:45 +03:00
Roman Mogilatov
245c8a0aaf Updating Introduction 2015-03-30 01:03:39 +03:00
Roman Mogilatov
d7268853d4 Updating Introduction 2015-03-30 01:00:52 +03:00
Roman Mogilatov
5967044458 Updating Introduction 2015-03-30 00:59:14 +03:00
Roman Mogilatov
7216b8a5b9 Adding Objects introduction 2015-03-30 00:46:48 +03:00
Roman Mogilatov
4aba82d588 Updating .gitignore 2015-03-27 01:28:40 +02:00
Roman Mogilatov
bc9fdd8426 Removing usage example 2015-03-27 00:42:37 +02:00
Roman Mogilatov
67a217181f 0.6.2 release 2015-03-26 17:28:12 +02:00
Roman Mogilatov
32cf5b29b8 Adding pypy classifier 2015-03-26 17:27:36 +02:00
Roman Mogilatov
8d896e7272 Run tests on pypy and pypy3 2015-03-26 16:56:49 +02:00
Roman Mogilatov
76d567e376 0.6.1 release 2015-03-26 10:30:07 +02:00
Roman Mogilatov
b4d01bbede Adding Python 3.2, 3.3, 3.4 classifiers 2015-03-26 10:02:52 +02:00
Roman Mogilatov
264a12daaf Removing class service variables from __slots__ list 2015-03-26 01:38:48 +02:00
Roman Mogilatov
233dedbcff Adding py 33, 34 to tox and travis 2015-03-26 01:15:41 +02:00
Roman
946b1a240c Merge pull request #39 from rmk135/py32
Py32
2015-03-26 01:14:51 +02:00
Roman Mogilatov
4e4bcd4b23 Removing reduce function references from tests 2015-03-26 00:54:34 +02:00
Roman Mogilatov
bac0bd499c adding .travis py32 env 2015-03-26 00:30:08 +02:00
Roman Mogilatov
1231a9b30f Add tox py32 env 2015-03-26 00:24:08 +02:00
Roman Mogilatov
db6c3b79f7 0.6.0 release 2015-03-23 17:04:14 +02:00
Roman Mogilatov
e8c3b6a620 Removing of old check function from manage.py 2015-03-23 16:40:59 +02:00
Roman Mogilatov
569ec912d2 Adding Alpha classifier 2015-03-23 16:30:00 +02:00
Roman Mogilatov
65f7704463 Minor refactoring 2015-03-23 16:27:48 +02:00
Roman
bb31186e51 Update README.md 2015-03-23 16:21:06 +02:00
Roman Mogilatov
b5c1bea18f Adding inject() decorator tests 2015-03-23 12:23:34 +02:00
Roman Mogilatov
b0c2005288 Adding tests for inject() decorator 2015-03-23 12:19:58 +02:00
Roman Mogilatov
1032143f5b Renaming InitArg to KwArg, adding @inject decorator 2015-03-23 01:04:18 +02:00
Roman Mogilatov
6bbf7e3526 Remove providers.Scoped because it being has not yet justified 2015-03-22 00:36:59 +02:00
Roman Mogilatov
eaf5179c76 Provider.overridden lazy initialization 2015-03-20 15:16:11 +02:00
Roman Mogilatov
27bf9e0a8e Remove ExternalDependency.satisfy() in favor of inherited Provider.override() 2015-03-20 14:53:47 +02:00
Roman Mogilatov
3b880d12a5 Add ability to reset provider override 2015-03-20 13:32:11 +02:00
Roman Mogilatov
22b28d0023 Update of author and maintainer names and url 2015-03-19 11:59:27 +02:00
Roman Mogilatov
0726a7c253 Setting of exact python versions for tox environments, remove travis python environments 2015-03-18 19:05:31 +02:00
Roman Mogilatov
b93bb61e28 Adding python versions in travis config 2015-03-18 18:58:29 +02:00
Roman Mogilatov
126883f5c1 Add ignoring of exit code for pylint job in tox 2015-03-18 17:06:07 +02:00
Roman Mogilatov
e07119c914 Updating tox config for pylint,flake8 and pep257 2015-03-18 16:09:22 +02:00
Roman Mogilatov
83f9845f59 Add PyLint, flake8 and pep257 configs to tox and travis 2015-03-18 15:53:08 +02:00
Roman Mogilatov
13ce4e0ea5 Remove test command from manage.py 2015-03-18 15:39:30 +02:00
Roman Mogilatov
c2bd37ce45 Fix of name error with coveralls job in travis 2015-03-18 15:20:59 +02:00
Roman Mogilatov
8fd471dd39 updating travis and tox configs 2015-03-18 14:50:45 +02:00
Roman Mogilatov
e817f726c2 Fix of bug in Python 2.6 with failed isclass check in inspect module 2015-03-18 12:57:12 +02:00
Roman Mogilatov
87fc17284c adding positional arg numbers for Python 2.6 compatibility 2015-03-18 12:48:19 +02:00
Roman Mogilatov
c13c2ad6eb Merge branch 'master' of github.com:rmk135/objects 2015-03-18 01:17:49 +02:00
Roman Mogilatov
3cb3d1ae4d removing test requirements file, all test requirements are moved to tox 2015-03-18 01:17:40 +02:00
Roman
ef14ae1b1c Update README.md 2015-03-18 01:16:59 +02:00
Roman Mogilatov
c1d6127e64 updating tox and travis configs 2015-03-18 00:38:54 +02:00
Roman
b7467482f9 Update README.md 2015-03-17 17:43:25 +02:00
Roman
11493d1a24 Update .travis.yml 2015-03-17 17:23:21 +02:00
Roman
58184e31b4 Update tox.ini 2015-03-17 17:22:55 +02:00
Roman
2bfe6c8a91 Update requirements-tests.txt 2015-03-17 16:52:46 +02:00
Roman
a635ce96d5 Update tox.ini 2015-03-17 16:36:54 +02:00
Roman
15bb1fd6c3 Update .travis.yml 2015-03-17 16:21:45 +02:00
Roman
70736f8e86 Create tox.ini 2015-03-17 16:21:34 +02:00
Roman
914f6767ea Update README.md 2015-03-17 16:04:06 +02:00
Roman
8f90764c01 Update README.md 2015-03-17 15:58:50 +02:00
Roman
09d0edd623 Create .travis.yml 2015-03-17 15:56:10 +02:00
Roman
983be8d3da Update README.md 2015-03-17 15:49:23 +02:00
Roman Mogilatov
786f3392ef 0.5.0 release 2015-03-17 02:11:31 +02:00
Roman
a4746b7f7f Update README.md 2015-03-17 02:09:06 +02:00
Roman
ccf3e01a46 Update README.md 2015-03-17 01:33:53 +02:00
Roman
bec0a2b80d Create README.md 2015-03-17 01:32:38 +02:00
Roman
ff495e201a Update README.md 2015-03-17 01:06:04 +02:00
Roman Mogilatov
22055c3f63 Add tests for catalog.overrides decorator 2015-03-16 17:31:16 +02:00
Roman Mogilatov
d93abe8554 Add some tests for catalog 2015-03-16 15:58:07 +02:00
Roman Mogilatov
654e7f05c8 Removing unused import from provider tests 2015-03-16 15:57:45 +02:00
Roman Mogilatov
01ae47c0d0 Stop measuring of pylint rating for examples 2015-03-16 15:34:46 +02:00
Roman Mogilatov
e0cefd0fa1 Remove unused import from providers 2015-03-16 15:11:41 +02:00
Roman Mogilatov
0dbc7a5b58 Add docblock updates for providers.Config 2015-03-16 15:10:39 +02:00
Roman Mogilatov
47d33e524c Add tests for providers.Config & refactoring of it 2015-03-16 15:09:01 +02:00
Roman Mogilatov
1736a6e008 Add check for callable in providers.Callable.__init__ 2015-03-16 11:52:53 +02:00
Roman Mogilatov
b1f6963fbe Little tests refactoring 2015-03-16 11:49:34 +02:00
Roman Mogilatov
3e3f782ab8 Test for is_provider check for providers.ExternalDependency 2015-03-16 11:44:47 +02:00
Roman Mogilatov
3754c7a6c5 Test for is_provider check for providers.Callable 2015-03-16 11:43:51 +02:00
Roman Mogilatov
65f47b1222 Minor providers.Config refactoring 2015-03-16 11:41:42 +02:00
Roman Mogilatov
08c7e7048f Add tests for providers.Callable & minor refactoring 2015-03-16 01:56:23 +02:00
Roman Mogilatov
d36e01bf3e Add tests for providers.ExternalDependency & refactoring 2015-03-16 01:10:43 +02:00
Roman Mogilatov
5ef157d252 Add tests for static providers 2015-03-16 00:52:29 +02:00
Roman Mogilatov
bb5715be90 Little refactoring of providers.Scoped tests 2015-03-15 15:35:33 +02:00
Roman Mogilatov
37f8382f4b Add tests for providers.Scoped & little test refactoring 2015-03-15 15:31:05 +02:00
Roman Mogilatov
7ab731eacc Add support of multiple scopes for providers.Scoped 2015-03-15 01:18:59 +02:00
Roman Mogilatov
fa113af977 Test for providers.Singleton 2015-03-15 00:50:24 +02:00
Roman Mogilatov
62e0a55b1b tests for NewInstance provider 2015-03-15 00:41:19 +02:00
Roman Mogilatov
91ea284723 Some tests for NewInstance provider, NewInstance provider refactoring 2015-03-14 15:57:30 +02:00
Roman Mogilatov
f6fb605080 adding some tests on NewInstance provider 2015-03-14 00:40:35 +02:00
Roman Mogilatov
7c21f706e5 fixing issue with AttributeError that has been replaced with objects.errors.Error 2015-03-14 00:02:59 +02:00
Roman Mogilatov
6567ee2b4d renaming ProviderDelegate to Delegate 2015-03-14 00:02:01 +02:00
Roman Mogilatov
1c4abb7533 adding tests for utils.ensure_is_provider() 2015-03-13 23:38:41 +02:00
Roman Mogilatov
a53114d10f Merge branch 'master' of github.com:rmk135/objects 2015-03-13 23:14:29 +02:00
Roman Mogilatov
abdb1eeac0 adding tests for ProviderDelegate, making of some refactoring 2015-03-13 17:46:03 +02:00
Roman Mogilatov
9d72eaf675 adding objects-specific errors 2015-03-13 17:31:07 +02:00
Roman
ae3b6a57b0 Update README.md 2015-03-13 14:41:21 +02:00
Roman
c481170b97 Update README.md 2015-03-12 23:47:10 +02:00
Roman
612bb0019f Update README.md 2015-03-12 23:46:31 +02:00
Roman Mogilatov
3221832a8d adding some more tests for Provider 2015-03-12 19:24:29 +02:00
Roman Mogilatov
5852d38b00 removing typo 2015-03-12 12:49:54 +02:00
Roman Mogilatov
a964f55802 minor codestyle fixes 2015-03-12 12:49:30 +02:00
Roman Mogilatov
3c489c54bf adding a little tests for provider 2015-03-12 12:46:14 +02:00
Roman Mogilatov
c7af4d2f8b adding some checks for Provider and minor codestyle fixes 2015-03-12 12:45:51 +02:00
Roman Mogilatov
0c1c13be33 updating Catalog override method name 2015-03-12 12:45:15 +02:00
Roman Mogilatov
ff4a092dab adding utils tests, fixing of bug in utils with returning True for checked classes, not only instances 2015-03-12 12:01:56 +02:00
Roman Mogilatov
0aab7f5628 updating README and spliting concept example 2015-03-12 00:25:12 +02:00
Roman Mogilatov
0414ab5460 adding injections module unittests 2015-03-12 00:10:51 +02:00
Roman Mogilatov
dbde0ff579 adding pylint settings file 2015-03-11 15:39:28 +02:00
Roman Mogilatov
dbde2b157e refusing of filter builtin function 2015-03-11 15:27:38 +02:00
Roman Mogilatov
e61e495931 switch to using utils module for type checks & and adding slots 2015-03-11 15:18:42 +02:00
Roman Mogilatov
911117f5a7 minor codestyle fixes for tests 2015-03-11 00:25:37 +02:00
Roman Mogilatov
aad431aa62 adding tox to tests requirements 2015-03-11 00:25:22 +02:00
Roman Mogilatov
54f35a5d35 adding some tests 2015-03-11 00:23:26 +02:00
Roman Mogilatov
f706d998e7 Merge branch 'master' of github.com:rmk135/objects 2015-03-11 00:22:21 +02:00
Roman Mogilatov
13d6a0f667 adding .coveragerc and some tests 2015-03-10 16:12:42 +02:00
Roman Mogilatov
a4a160b061 adding command for running of tests 2015-03-10 16:03:54 +02:00
Roman
9691bce3a4 Update README.md 2015-03-10 15:31:29 +02:00
Roman
88ec70511c Update README.md 2015-03-10 14:40:36 +02:00
Roman Mogilatov
3b37476d23 minor codestyle fixes 2015-03-10 11:51:13 +02:00
Roman
07c105234a Update README.md 2015-03-10 11:14:32 +02:00
Roman Mogilatov
259832bc75 adding test requirements 2015-03-10 01:14:44 +02:00
Roman Mogilatov
6cd2319a15 examples codestyle fixes 2015-03-10 00:55:38 +02:00
Roman Mogilatov
4055b42e59 examples codestyle fixes 2015-03-10 00:54:05 +02:00
Roman Mogilatov
d48616736b updating examples codestyle 2015-03-10 00:43:23 +02:00
Roman Mogilatov
6eadac8a75 some improvements for ProviderDelegate 2015-03-09 00:24:46 +02:00
Roman Mogilatov
120ef5d5cb updating delegate code style 2015-03-09 00:04:36 +02:00
Roman Mogilatov
da1f1eb08a adding pep257, flake8 and pylint libs to requirements 2015-03-09 00:02:20 +02:00
Roman Mogilatov
e1f2d5e3b8 making pep257 and flake8 happy 2015-03-09 00:01:39 +02:00
Roman Mogilatov
36b1413868 updating version and maintain requirements 2015-03-08 13:58:29 +02:00
Roman Mogilatov
4f0f93459b 0.4.3 release 2015-03-08 00:26:44 +02:00
Roman Mogilatov
a6571c5f58 removing pytest from requirements-tests 2015-03-07 23:55:08 +02:00
Roman Mogilatov
16799e414b Refactoring of ProviderDelegate 2015-02-25 01:48:51 +02:00
Roman Mogilatov
76e14c1c79 codestyle fixes 2015-02-23 10:47:38 +02:00
Roman Mogilatov
b6961f9311 updating delegate implementation 2015-02-23 00:19:23 +02:00
Roman Mogilatov
039e211a09 0.4.1 adding provider delegate 2015-02-23 00:16:27 +02:00
Roman Mogilatov
333f2db979 0.3.1 release 2015-01-28 15:03:02 +02:00
Roman
1192557e1b Merge pull request #8 from rmk135/0.3-dev
0.3 Release
2015-01-28 14:58:28 +02:00
Roman Mogilatov
3c19399a2a 0.3 release 2015-01-28 14:57:03 +02:00
Roman Mogilatov
7f88e4ffdd Adding possibility to get all providers by type from catalog 2015-01-28 14:50:48 +02:00
Roman
ae2d1036d7 Merge pull request #7 from rmk135/config_provider
Config provider
2015-01-28 14:30:21 +02:00
Roman Mogilatov
8233312c15 codestyle fixes 2015-01-28 14:25:27 +02:00
Roman Mogilatov
158b6fcd9e Adding config provider 2015-01-28 13:08:54 +02:00
Roman
781965ddb1 Merge pull request #6 from rmk135/callable_provider
Adding callable provider with examples
2015-01-28 00:49:55 +02:00
Roman Mogilatov
3786b052a9 adding callable provider with examples 2015-01-28 00:48:33 +02:00
Roman
2c449e9820 Merge pull request #5 from rmk135/scoped_provider
Adding scoped provider with examples
2015-01-28 00:27:13 +02:00
Roman Mogilatov
113f770634 updating readme and examples 2015-01-28 00:26:38 +02:00
Roman Mogilatov
1cdf393f56 adding scoped provider with examples 2015-01-28 00:21:31 +02:00
Roman Mogilatov
1631978790 0.2.1, ExternalDependency can take several types 2015-01-24 00:31:30 +02:00
Roman Mogilatov
92254b0276 version 0.2.0, external dependency provider has been added 2015-01-23 01:42:59 +02:00
Roman Mogilatov
5462bb91c4 Renaming Catalog class to AbstractCatalog 2015-01-18 02:28:41 +02:00
Roman Mogilatov
65893178dc renaming manifest file, 0.0.6 2015-01-16 23:11:24 +02:00
Roman Mogilatov
2bfdae8949 updating readme 2015-01-11 18:14:15 +02:00
Roman Mogilatov
98435c953f making cleanup 2015-01-11 18:11:16 +02:00
Roman Mogilatov
143ba92b0a 0.0.4 version 2015-01-11 18:10:11 +02:00
Roman Mogilatov
028e5e9ef7 0.0.3 version 2015-01-11 15:03:45 +02:00
616 changed files with 44990 additions and 450 deletions

12
.deepsource.toml Normal file
View File

@ -0,0 +1,12 @@
version = 1
test_patterns = ["tests/**/test_*.py"]
exclude_patterns = ["docs/**"]
[[analyzers]]
name = "python"
enabled = true
[analyzers.meta]
runtime_version = "3.x.x"

1
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1 @@
github: rmk135

113
.github/workflows/publishing.yml vendored Normal file
View File

@ -0,0 +1,113 @@
name: Publishing
on:
workflow_dispatch:
push:
tags:
- '*'
jobs:
tests:
name: Run tests
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.13
- run: pip install tox
- run: tox
env:
TOXENV: 3.13
linters:
name: Run linters
runs-on: ubuntu-24.04
strategy:
matrix:
toxenv: [flake8, pydocstyle, mypy, pylint]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.13
- run: pip install tox
- run: tox
env:
TOXENV: ${{ matrix.toxenv }}
build-sdist:
name: Build source tarball
needs: [tests, linters]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.13
- run: |
python -m pip install --upgrade build
python -m build --sdist
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: ./dist/*
build-wheels:
name: Build wheels
needs: [tests, linters]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm, windows-2019, macos-14]
env:
CIBW_SKIP: cp27-*
steps:
- uses: actions/checkout@v3
- name: Build wheels
uses: pypa/cibuildwheel@v2.20.0
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-x86-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
publish:
name: Publish on PyPI
needs: [build-sdist, build-wheels]
runs-on: ubuntu-24.04
steps:
- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
# For publishing to Test PyPI, uncomment next two lines:
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# repository_url: https://test.pypi.org/legacy/
publish-docs:
name: Publish docs
needs: [publish]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.13
- run: pip install awscli
- run: pip install -r requirements-doc.txt
- run: pip install -e .
- run: (cd docs && make clean html)
- run: |
aws s3 sync docs/_build/html s3://python-dependency-injector-docs --delete
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} --path "/*" > /dev/null
echo "Cache invalidation triggered"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}

82
.github/workflows/tests-and-linters.yml vendored Normal file
View File

@ -0,0 +1,82 @@
name: Tests and linters
on: [push, pull_request, workflow_dispatch]
jobs:
tests-on-legacy-versions:
name: Run tests on legacy versions
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.7]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- run: pip install tox
- run: tox
env:
TOXENV: ${{ matrix.python-version }}
test-on-different-versions:
name: Run tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", 3.11, 3.12, 3.13]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- run: pip install tox
- run: tox
env:
TOXENV: ${{ matrix.python-version }}
test-different-pydantic-versions:
name: Run tests with different pydantic versions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.12"
- run: pip install tox
- run: tox -e pydantic-v1,pydantic-v2
test-coverage:
name: Run tests with coverage
runs-on: ubuntu-latest
env:
DEPENDENCY_INJECTOR_DEBUG_MODE: 1
PIP_VERBOSE: 1
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.12
- run: pip install tox 'cython>=3,<4'
- run: tox -vv
env:
TOXENV: coveralls
linters:
name: Run linters
runs-on: ubuntu-latest
strategy:
matrix:
toxenv: [flake8, pydocstyle, mypy, pylint]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.13
- run: pip install tox
- run: tox
env:
TOXENV: ${{ matrix.toxenv }}

22
.gitignore vendored
View File

@ -2,9 +2,6 @@
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Python
env/
@ -33,12 +30,13 @@ pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
reports/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml
.hypothesis/
# Translations
*.mo
@ -57,7 +55,21 @@ target/
.idea/
# Virtualenv
venv/
venv*/
# SQLite
*.db
# Vim Rope
.ropeproject/
# Cython artifacts
src/**/*.c
src/**/*.h
src/**/*.so
src/**/*.html
# Workspace for samples
.workspace/
.vscode/

24
CONTRIBUTORS.rst Normal file
View File

@ -0,0 +1,24 @@
Dependency Injector Contributors
================================
+ Roman Mogylatov (rmk135)
+ Konstantin vz'One Enchant (sirkonst)
+ Terrence Brannon (metaperl)
+ Stanislav Lobanov (asyncee)
+ James Lafa (jameslafa)
+ Vlad Ghita (vlad-ghita)
+ Jeroen Rietveld (jeroenrietveld)
+ Dmitry Kuzmin (xotonic)
+ supakeen (supakeen)
+ Bruno P. Kinoshita (kinow)
+ RobinsonMa (RobinsonMa)
+ Rüdiger Busche (JarnoRFB)
+ Dmitry Rassoshenko (rda-dev)
+ Fotis Koutoupas (kootoopas)
+ Shubhendra Singh Chauhan (withshubh)
+ sonthonaxrk (sonthonaxrk)
+ Ngo Thanh Loi (Leonn) (loingo95)
+ Thiago Hiromi (thiromi)
+ Felipe Rubio (krouw)
+ Anton Petrov (anton-petrov)
+ ZipFile (ZipFile)

View File

@ -1,4 +1,4 @@
Copyright (c) 2015, Roman
Copyright (c) 2024, Roman Mogylatov
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -11,7 +11,7 @@ modification, are permitted provided that the following conditions are met:
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of objects nor the names of its
* Neither the name of "Dependency Injector" nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
@ -25,4 +25,3 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,6 +0,0 @@
include objects/*
include README.md
include LICENSE
include VERSION
include requirements.txt
include setup.py

9
MANIFEST.in Normal file
View File

@ -0,0 +1,9 @@
recursive-include src/dependency_injector *.py* *.c
recursive-include tests *.py
include README.rst
include CONTRIBUTORS.rst
include LICENSE.rst
include requirements.txt
include setup.py
include tox.ini
include py.typed

65
Makefile Normal file
View File

@ -0,0 +1,65 @@
VERSION := $(shell python setup.py --version)
export COVERAGE_RCFILE := pyproject.toml
clean:
# Clean sources
find src -name '*.py[cod]' -delete
find src -name '__pycache__' -delete
find src -name '*.c' -delete
find src -name '*.h' -delete
find src -name '*.so' -delete
find src -name '*.html' -delete
# Clean tests
find tests -name '*.py[co]' -delete
find tests -name '__pycache__' -delete
# Clean examples
find examples -name '*.py[co]' -delete
find examples -name '__pycache__' -delete
build: clean
# Compile C extensions
python setup.py build_ext --inplace
# Move all Cython html reports
mkdir -p reports/cython/
find src -name '*.html' -exec mv {} reports/cython/ \;
docs-live:
sphinx-autobuild docs docs/_build/html
install: uninstall clean build
pip install -ve .
uninstall:
- pip uninstall -y -q dependency-injector 2> /dev/null
test:
# Unit tests with coverage report
coverage erase
coverage run -m pytest -c tests/.configs/pytest.ini
coverage report
coverage html
check:
flake8 src/dependency_injector/
flake8 examples/
pydocstyle src/dependency_injector/
pydocstyle examples/
mypy tests/typing
test-publish: build
# Create distributions
python -m build --sdist
# Upload distributions to PyPI
twine upload --repository testpypi dist/dependency-injector-$(VERSION)*
publish:
# Merge release to master branch
git checkout master
git merge --no-ff release/$(VERSION) -m "Merge branch 'release/$(VERSION)' into master"
git push origin master
# Create and upload tag
git tag -a $(VERSION) -m 'version $(VERSION)'
git push --tags

View File

@ -1,71 +0,0 @@
Objects
=======
Python catalogs of objects providers.
Example:
```python
"""
Concept example of objects catalogs.
"""
from objects import Catalog, Singleton, NewInstance, InitArg, Attribute
import sqlite3
# Some example classes.
class A(object):
def __init__(self, db):
self.db = db
class B(object):
def __init__(self, a, db):
self.a = a
self.db = db
# Catalog of objects providers.
class AppCatalog(Catalog):
"""
Objects catalog.
"""
database = Singleton(sqlite3.Connection,
InitArg('database', ':memory:'),
Attribute('row_factory', sqlite3.Row))
""" :type: (objects.Provider) -> sqlite3.Connection """
object_a = NewInstance(A,
InitArg('db', database))
""" :type: (objects.Provider) -> A """
object_b = NewInstance(B,
InitArg('a', object_a),
InitArg('db', database))
""" :type: (objects.Provider) -> B """
# Catalog injection into consumer class.
class Consumer(object):
catalog = AppCatalog(AppCatalog.object_a,
AppCatalog.object_b)
def return_a_b(self):
return (self.catalog.object_a(),
self.catalog.object_b())
a1, b1 = Consumer().return_a_b()
# Catalog static provides.
a2 = AppCatalog.object_a()
b2 = AppCatalog.object_b()
# Some asserts.
assert a1 is not a2
assert b1 is not b2
assert a1.db is a2.db is b1.db is b2.db
```

230
README.rst Normal file
View File

@ -0,0 +1,230 @@
.. figure:: https://raw.githubusercontent.com/wiki/ets-labs/python-dependency-injector/img/logo.svg
:target: https://github.com/ets-labs/python-dependency-injector
|
.. image:: https://img.shields.io/pypi/v/dependency_injector.svg
:target: https://pypi.org/project/dependency-injector/
:alt: Latest Version
.. image:: https://img.shields.io/pypi/l/dependency_injector.svg
:target: https://pypi.org/project/dependency-injector/
:alt: License
.. image:: https://img.shields.io/pypi/pyversions/dependency_injector.svg
:target: https://pypi.org/project/dependency-injector/
:alt: Supported Python versions
.. image:: https://img.shields.io/pypi/implementation/dependency_injector.svg
:target: https://pypi.org/project/dependency-injector/
:alt: Supported Python implementations
.. image:: https://pepy.tech/badge/dependency-injector
:target: https://pepy.tech/project/dependency-injector
:alt: Downloads
.. image:: https://pepy.tech/badge/dependency-injector/month
:target: https://pepy.tech/project/dependency-injector
:alt: Downloads
.. image:: https://pepy.tech/badge/dependency-injector/week
:target: https://pepy.tech/project/dependency-injector
:alt: Downloads
.. image:: https://img.shields.io/pypi/wheel/dependency-injector.svg
:target: https://pypi.org/project/dependency-injector/
:alt: Wheel
.. image:: https://img.shields.io/github/actions/workflow/status/ets-labs/python-dependency-injector/tests-and-linters.yml?branch=master
:target: https://github.com/ets-labs/python-dependency-injector/actions
:alt: Build Status
.. image:: https://coveralls.io/repos/github/ets-labs/python-dependency-injector/badge.svg?branch=master
:target: https://coveralls.io/github/ets-labs/python-dependency-injector?branch=master
:alt: Coverage Status
What is ``Dependency Injector``?
================================
``Dependency Injector`` is a dependency injection framework for Python.
It helps implement the dependency injection principle.
Key features of the ``Dependency Injector``:
- **Providers**. Provides ``Factory``, ``Singleton``, ``Callable``, ``Coroutine``, ``Object``,
``List``, ``Dict``, ``Configuration``, ``Resource``, ``Dependency``, and ``Selector`` providers
that help assemble your objects.
See `Providers <https://python-dependency-injector.ets-labs.org/providers/index.html>`_.
- **Overriding**. Can override any provider by another provider on the fly. This helps in testing
and configuring dev/stage environment to replace API clients with stubs etc. See
`Provider overriding <https://python-dependency-injector.ets-labs.org/providers/overriding.html>`_.
- **Configuration**. Reads configuration from ``yaml``, ``ini``, and ``json`` files, ``pydantic`` settings,
environment variables, and dictionaries.
See `Configuration provider <https://python-dependency-injector.ets-labs.org/providers/configuration.html>`_.
- **Resources**. Helps with initialization and configuring of logging, event loop, thread
or process pool, etc. Can be used for per-function execution scope in tandem with wiring.
See `Resource provider <https://python-dependency-injector.ets-labs.org/providers/resource.html>`_.
- **Containers**. Provides declarative and dynamic containers.
See `Containers <https://python-dependency-injector.ets-labs.org/containers/index.html>`_.
- **Wiring**. Injects dependencies into functions and methods. Helps integrate with
other frameworks: Django, Flask, Aiohttp, Sanic, FastAPI, etc.
See `Wiring <https://python-dependency-injector.ets-labs.org/wiring.html>`_.
- **Asynchronous**. Supports asynchronous injections.
See `Asynchronous injections <https://python-dependency-injector.ets-labs.org/providers/async.html>`_.
- **Typing**. Provides typing stubs, ``mypy``-friendly.
See `Typing and mypy <https://python-dependency-injector.ets-labs.org/providers/typing_mypy.html>`_.
- **Performance**. Fast. Written in ``Cython``.
- **Maturity**. Mature and production-ready. Well-tested, documented, and supported.
.. code-block:: python
from dependency_injector import containers, providers
from dependency_injector.wiring import Provide, inject
class Container(containers.DeclarativeContainer):
config = providers.Configuration()
api_client = providers.Singleton(
ApiClient,
api_key=config.api_key,
timeout=config.timeout,
)
service = providers.Factory(
Service,
api_client=api_client,
)
@inject
def main(service: Service = Provide[Container.service]) -> None:
...
if __name__ == "__main__":
container = Container()
container.config.api_key.from_env("API_KEY", required=True)
container.config.timeout.from_env("TIMEOUT", as_=int, default=5)
container.wire(modules=[__name__])
main() # <-- dependency is injected automatically
with container.api_client.override(mock.Mock()):
main() # <-- overridden dependency is injected automatically
When you call the ``main()`` function the ``Service`` dependency is assembled and injected automatically.
When you do testing, you call the ``container.api_client.override()`` method to replace the real API
client with a mock. When you call ``main()``, the mock is injected.
You can override any provider with another provider.
It also helps you in a re-configuring project for different environments: replace an API client
with a stub on the dev or stage.
With the ``Dependency Injector``, object assembling is consolidated in a container. Dependency injections are defined explicitly.
This makes it easier to understand and change how an application works.
.. figure:: https://raw.githubusercontent.com/wiki/ets-labs/python-dependency-injector/img/di-readme.svg
:target: https://github.com/ets-labs/python-dependency-injector
Visit the docs to know more about the
`Dependency injection and inversion of control in Python <https://python-dependency-injector.ets-labs.org/introduction/di_in_python.html>`_.
Installation
------------
The package is available on the `PyPi`_::
pip install dependency-injector
Documentation
-------------
The documentation is available `here <https://python-dependency-injector.ets-labs.org/>`_.
Examples
--------
Choose one of the following:
- `Application example (single container) <https://python-dependency-injector.ets-labs.org/examples/application-single-container.html>`_
- `Application example (multiple containers) <https://python-dependency-injector.ets-labs.org/examples/application-multiple-containers.html>`_
- `Decoupled packages example (multiple containers) <https://python-dependency-injector.ets-labs.org/examples/decoupled-packages.html>`_
- `Boto3 example <https://python-dependency-injector.ets-labs.org/examples/boto3.html>`_
- `Django example <https://python-dependency-injector.ets-labs.org/examples/django.html>`_
- `Flask example <https://python-dependency-injector.ets-labs.org/examples/flask.html>`_
- `Aiohttp example <https://python-dependency-injector.ets-labs.org/examples/aiohttp.html>`_
- `Sanic example <https://python-dependency-injector.ets-labs.org/examples/sanic.html>`_
- `FastAPI example <https://python-dependency-injector.ets-labs.org/examples/fastapi.html>`_
- `FastAPI + Redis example <https://python-dependency-injector.ets-labs.org/examples/fastapi-redis.html>`_
- `FastAPI + SQLAlchemy example <https://python-dependency-injector.ets-labs.org/examples/fastapi-sqlalchemy.html>`_
Tutorials
---------
Choose one of the following:
- `Flask web application tutorial <https://python-dependency-injector.ets-labs.org/tutorials/flask.html>`_
- `Aiohttp REST API tutorial <https://python-dependency-injector.ets-labs.org/tutorials/aiohttp.html>`_
- `Asyncio monitoring daemon tutorial <https://python-dependency-injector.ets-labs.org/tutorials/asyncio-daemon.html>`_
- `CLI application tutorial <https://python-dependency-injector.ets-labs.org/tutorials/cli.html>`_
Concept
-------
The framework stands on the `PEP20 (The Zen of Python) <https://www.python.org/dev/peps/pep-0020/>`_ principle:
.. code-block:: bash
Explicit is better than implicit
You need to specify how to assemble and where to inject the dependencies explicitly.
The power of the framework is in its simplicity.
``Dependency Injector`` is a simple tool for the powerful concept.
Frequently asked questions
--------------------------
What is dependency injection?
- dependency injection is a principle that decreases coupling and increases cohesion
Why should I do the dependency injection?
- your code becomes more flexible, testable, and clear 😎
How do I start applying the dependency injection?
- you start writing the code following the dependency injection principle
- you register all of your application components and their dependencies in the container
- when you need a component, you specify where to inject it or get it from the container
What price do I pay and what do I get?
- you need to explicitly specify the dependencies
- it will be extra work in the beginning
- it will payoff as project grows
Have a question?
- Open a `Github Issue <https://github.com/ets-labs/python-dependency-injector/issues>`_
Found a bug?
- Open a `Github Issue <https://github.com/ets-labs/python-dependency-injector/issues>`_
Want to help?
- |star| Star the ``Dependency Injector`` on the `Github <https://github.com/ets-labs/python-dependency-injector/>`_
- |new| Start a new project with the ``Dependency Injector``
- |tell| Tell your friend about the ``Dependency Injector``
Want to contribute?
- |fork| Fork the project
- |pull| Open a pull request to the ``develop`` branch
.. _PyPi: https://pypi.org/project/dependency-injector/
.. |star| unicode:: U+2B50 U+FE0F .. star sign1
.. |new| unicode:: U+1F195 .. new sign
.. |tell| unicode:: U+1F4AC .. tell sign
.. |fork| unicode:: U+1F500 .. fork sign
.. |pull| unicode:: U+2B05 U+FE0F .. pull sign

View File

@ -1 +0,0 @@
0.0.2

192
docs/Makefile Normal file
View File

@ -0,0 +1,192 @@
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " applehelp to make an Apple Help Book"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
@echo " coverage to run coverage check of the documentation (if enabled)"
clean:
rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/dependency_injector.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/dependency_injector.qhc"
applehelp:
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
@echo
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
@echo "N.B. You won't be able to view it unless you put it in" \
"~/Library/Documentation/Help or install it in your application" \
"bundle."
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/dependency_injector"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/dependency_injector"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
coverage:
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
@echo "Testing of coverage in the sources finished, look at the " \
"results in $(BUILDDIR)/coverage/python.txt."
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."

9
docs/_static/custom.css vendored Normal file
View File

@ -0,0 +1,9 @@
.no-border {
border: 0 !important;
box-shadow: none !important;
-webkit-box-shadow: none !important;
}
.no-border td {
border: 0px !important;
padding: 0px 10px 0px 0px !important;
}

1
docs/_static/logo.svg vendored Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.8 KiB

1
docs/_static/sponsor.html vendored Normal file
View File

@ -0,0 +1 @@
<iframe src="https://github.com/sponsors/rmk135/button" title="Sponsor Dependency Injector" height="32" width="114" style="border: 0; border-radius: 6px;"></iframe>

9
docs/api/containers.rst Normal file
View File

@ -0,0 +1,9 @@
dependency_injector.containers
==============================
.. automodule:: dependency_injector.containers
:members:
:inherited-members:
:show-inheritance:
.. disqus::

8
docs/api/errors.rst Normal file
View File

@ -0,0 +1,8 @@
dependency_injector.errors
==========================
.. automodule:: dependency_injector.errors
:members:
.. disqus::

11
docs/api/index.rst Normal file
View File

@ -0,0 +1,11 @@
API Documentation
=================
.. toctree::
:maxdepth: 2
top-level
providers
containers
wiring
errors

10
docs/api/providers.rst Normal file
View File

@ -0,0 +1,10 @@
dependency_injector.providers
=============================
.. automodule:: dependency_injector.providers
:members:
:inherited-members:
:show-inheritance:
.. disqus::

8
docs/api/top-level.rst Normal file
View File

@ -0,0 +1,8 @@
dependency_injector
===================
.. automodule:: dependency_injector
:members: __version__
.. disqus::

7
docs/api/wiring.rst Normal file
View File

@ -0,0 +1,7 @@
dependency_injector.wiring
=============================
.. automodule:: dependency_injector.wiring
:members:
.. disqus::

313
docs/conf.py Normal file
View File

@ -0,0 +1,313 @@
# -*- coding: utf-8 -*-
#
# Dependency Injector documentation build configuration file, created by
# sphinx-quickstart on Wed Apr 1 17:36:06 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
import os
import re
import sys
import alabaster
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath(".."))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = "1.0"
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named "sphinx.ext.*") or your custom
# ones.
extensions = [
"alabaster",
"sphinx.ext.autodoc",
"sphinx_disqus.disqus",
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = [".rst", ".md"]
source_suffix = ".rst"
# The encoding of source files.
#source_encoding = "utf-8-sig"
# The master toctree document.
master_doc = "index"
# General information about the project.
project = "Dependency Injector"
copyright = "2024, Roman Mogylatov"
author = "Roman Mogylatov"
# The version info for the project you"re documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
# Getting version:
with open("../src/dependency_injector/__init__.py") as init_file:
version = re.search("__version__ = \"(.*?)\"", init_file.read()).group(1)
# The full version, including alpha/beta/rc tags.
release = version
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ""
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = "%B %d, %Y"
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ["_build"]
# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
# If true, "()" will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
#add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
#show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"
# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
# html_theme = "sphinx_rtd_theme"
html_theme = "alabaster"
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
# html_context = {}
# Add any paths that contain custom themes here, relative to this directory.
html_theme_path = [alabaster.get_path()]
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
#html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
#html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
html_favicon = "favicon.ico"
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
html_css_files = [
"custom.css",
]
# Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied
# directly to the root of the documentation.
#html_extra_path = []
# If not "", a "Last updated on:" timestamp is inserted at every page bottom,
# using the given strftime format.
#html_last_updated_fmt = "%b %d, %Y"
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_domain_indices = True
# If false, no index is generated.
#html_use_index = True
# If true, the index is split into individual pages for each letter.
#html_split_index = False
# If true, links to the reST sources are added to the pages.
#html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
#html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
#html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
#html_use_opensearch = ""
# This is the file name suffix for HTML files (e.g. ".xhtml").
#html_file_suffix = None
# Language to be used for generating the HTML full-text search index.
# Sphinx supports the following languages:
# "da", "de", "en", "es", "fi", "fr", "hu", "it", "ja"
# "nl", "no", "pt", "ro", "ru", "sv", "tr"
#html_search_language = "en"
# A dictionary with options for the search language support, empty by default.
# Now only "ja" uses this config value
#html_search_options = {"type": "default"}
# The name of a javascript file (relative to the configuration directory) that
# implements a search results scorer. If empty, the default will be used.
#html_search_scorer = "scorer.js"
# Output file base name for HTML help builder.
htmlhelp_basename = "dependency_injectordoc"
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ("letterpaper" or "a4paper").
#"papersize": "letterpaper",
# The font size ("10pt", "11pt" or "12pt").
#"pointsize": "10pt",
# Additional stuff for the LaTeX preamble.
#"preamble": "",
# Latex figure (float) alignment
#"figure_align": "htbp",
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, "dependency_injector.tex", u"Dependency Injector Documentation",
u"Roman Mogylatov", "manual"),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
#latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
#latex_show_urls = False
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, "Dependency Injector", u"Dependency Injector Documentation",
[author], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, "Dependency Injector", u"Dependency Injector Documentation",
author, "Dependency Injector", "Dependency injection microframework for Python",
"Miscellaneous"),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: "footnote", "no", or "inline".
#texinfo_show_urls = "footnote"
# If true, do not generate a @detailmenu in the "Top" node"s menu.
#texinfo_no_detailmenu = False
autodoc_member_order = "bysource"
disqus_shortname = "python-dependency-injector"
html_theme_options = {
"github_user": "ets-labs",
"github_repo": "python-dependency-injector",
"github_type": "star",
"github_button": True,
"github_banner": True,
"logo": "logo.svg",
"description": "Dependency injection framework for Python by Roman Mogylatov",
"code_font_size": "10pt",
"analytics_id": "UA-67012059-1",
"donate_url": "https://github.com/sponsors/rmk135",
}

View File

@ -0,0 +1,18 @@
.. _check-container-dependencies:
Check container dependencies
----------------------------
To check container dependencies use method ``.check_dependencies()``.
.. literalinclude:: ../../examples/containers/check_dependencies.py
:language: python
:lines: 3-
:emphasize-lines: 12
Method ``.check_dependencies()`` raises an error if container has any undefined dependencies.
If all dependencies are provided or have defaults, no error is raised.
See also: :ref:`dependency-provider`.
.. disqus::

View File

@ -0,0 +1,23 @@
Container copying
-----------------
You can create declarative container copies using ``@containers.copy()`` decorator.
.. literalinclude:: ../../examples/containers/declarative_copy_decorator1.py
:language: python
:lines: 3-
:emphasize-lines: 18-22
Decorator ``@containers.copy()`` copies providers from source container to destination container.
Destination container provider will replace source provider, if names match.
Decorator ``@containers.copy()`` helps you when you create derived declarative containers
from the base one. Base container often keeps default dependencies while derived containers define
overriding providers. Without ``@containers.copy()`` decorator, overridden providers are available
in the derived container, but base class dependencies continue to be bound to the base class providers.
.. literalinclude:: ../../examples/containers/declarative_copy_decorator2.py
:language: python
:lines: 11-
.. disqus::

View File

@ -0,0 +1,72 @@
Declarative container
---------------------
.. currentmodule:: dependency_injector.containers
:py:class:`DeclarativeContainer` is a class-based style of the providers definition.
You create the declarative container subclass, put the providers as attributes and create the
container instance.
.. literalinclude:: ../../examples/containers/declarative.py
:language: python
:lines: 3-
The declarative container providers should only be used when you have the container instance.
Working with the providers of the container on the class level will influence all further
instances.
The declarative container can not have any methods or any other attributes then providers.
The container class provides next attributes:
- ``providers`` - the dictionary of all the container providers
- ``cls_providers`` - the dictionary of the container providers of the current container
- ``inherited_providers`` - the dictionary of all the inherited container providers
.. literalinclude:: ../../examples/containers/declarative_inheritance.py
:language: python
:lines: 3-
Injections in the declarative container are done the usual way:
.. literalinclude:: ../../examples/containers/declarative_injections.py
:language: python
:lines: 3-
You can override container providers while creating a container instance:
.. literalinclude:: ../../examples/containers/declarative_override_providers.py
:language: python
:lines: 3-
:emphasize-lines: 13
Alternatively, you can call ``container.override_providers()`` method when the container instance
already exists:
.. code-block:: python
:emphasize-lines: 3
container = Container()
container.override_providers(foo=mock.Mock(Foo), bar=mock.Mock(Bar))
assert isinstance(container.foo(), mock.Mock)
assert isinstance(container.bar(), mock.Mock)
You can also use ``container.override_providers()`` with a context manager to reset
provided overriding after the context is closed:
.. code-block:: python
:emphasize-lines: 3
container = Container()
with container.override_providers(foo=mock.Mock(Foo), bar=mock.Mock(Bar)):
assert isinstance(container.foo(), mock.Mock)
assert isinstance(container.bar(), mock.Mock)
assert isinstance(container.foo(), Foo)
assert isinstance(container.bar(), Bar)
.. disqus::

View File

@ -0,0 +1,25 @@
Dynamic container
-----------------
.. currentmodule:: dependency_injector.containers
:py:class:`DynamicContainer` is a collection of the providers defined in the runtime.
You create the dynamic container instance and put the providers as attributes.
.. literalinclude:: ../../examples/containers/dynamic.py
:language: python
:lines: 3-
The dynamic container is good for the case when your application structure depends on the
configuration file or some other source that you can reach only after application is already
running (database, api, etc).
In this example we use the configuration to fill in the dynamic container with the providers:
.. literalinclude:: ../../examples/containers/dynamic_runtime_creation.py
:language: python
:lines: 3-
.. disqus::

29
docs/containers/index.rst Normal file
View File

@ -0,0 +1,29 @@
.. _containers:
Containers
==========
Containers are collections of the providers.
There are several use cases how you can use containers:
+ Keeping all the providers in a single container (most common).
+ Grouping of the providers from the same architectural layer (for example,
``Services``, ``Models`` and ``Forms`` containers).
+ Grouping of providers from the same functional groups (for example,
container ``Users``, that contains all functional parts of the ``users``
package).
Containers module API docs - :py:mod:`dependency_injector.containers`.
.. toctree::
:maxdepth: 2
declarative
dynamic
specialization
overriding
copying
reset_singletons
check_dependencies
traversal

View File

@ -0,0 +1,40 @@
Container overriding
--------------------
.. currentmodule:: dependency_injector.containers
The container can be overridden by the other container. All of the providers from the overriding
container will override the providers with the same names in the overridden container.
.. literalinclude:: ../../examples/containers/override.py
:language: python
:lines: 3-
It helps in a testing. Also you can use it for configuring project for the different
environments: replace an API client with a stub on the dev or stage.
The container also has:
- ``container.overridden`` - tuple of all overriding containers.
- ``container.reset_last_overriding()`` - reset last overriding for each provider in the container.
- ``container.reset_override()`` - reset all overriding in the container.
:py:class:`DynamicContainer` has the same functionality.
Another possible way to override container providers on declarative level is
``@containers.override()`` decorator:
.. literalinclude:: ../../examples/containers/declarative_override_decorator.py
:language: python
:lines: 3-
:emphasize-lines: 12-16
Decorator ``@containers.override()`` takes a container for overriding as an argument.
This container providers will be overridden by the providers with the same names from
the decorated container.
It helps to change the behaviour of application by importing extension modules but not a code change.
Imported module can override providers in main container. While the code uses main container as
before, the overridden providers provide components defined in the extension module.
.. disqus::

View File

@ -0,0 +1,31 @@
.. _reset-container-singletons:
Reset container singletons
--------------------------
To reset all container singletons use method ``.reset_singletons()``.
.. literalinclude:: ../../examples/containers/reset_singletons.py
:language: python
:lines: 3-
:emphasize-lines: 16
Method ``.reset_singletons()`` also resets singletons in sub-containers: ``providers.Container`` and
``providers.DependenciesContainer.``
.. literalinclude:: ../../examples/containers/reset_singletons_subcontainers.py
:language: python
:lines: 3-
:emphasize-lines: 21
You can use ``.reset_singletons()`` method with a context manager. Singletons will be reset on
both entering and exiting a context.
.. literalinclude:: ../../examples/containers/reset_singletons_with.py
:language: python
:lines: 3-
:emphasize-lines: 14-15
See also: :ref:`singleton-provider`.
.. disqus::

View File

@ -0,0 +1,25 @@
Specialization of the container provider type
---------------------------------------------
.. currentmodule:: dependency_injector.containers
You can make a restriction of the :py:class:`DeclarativeContainer` provider type:
.. literalinclude:: ../../examples/containers/declarative_provider_type.py
:language: python
:lines: 3-
:emphasize-lines: 29-31
The emphasized lines will cause an error because ``other_provider`` is not a subtype of the
``ServiceProvider``. This helps to control the content of the container.
The same works for the :py:class:`DynamicContainer`:
.. literalinclude:: ../../examples/containers/dynamic_provider_type.py
:language: python
:lines: 3-
:emphasize-lines: 23
The emphasized line will also cause an error.
.. disqus::

View File

@ -0,0 +1,33 @@
Container providers traversal
-----------------------------
To traverse container providers use method ``.traverse()``.
.. literalinclude:: ../../examples/containers/traverse.py
:language: python
:lines: 3-
:emphasize-lines: 38
Method ``.traverse()`` returns a generator. Traversal generator visits all container providers.
This includes nested providers even if they are not present on the root level of the container.
Traversal generator guarantees that each container provider will be visited only once.
It can traverse cyclic provider graphs.
Traversal generator does not guarantee traversal order.
You can use ``types=[...]`` argument to filter providers. Traversal generator will only return
providers matching specified types.
.. code-block:: python
:emphasize-lines: 3
container = Container()
for provider in container.traverse(types=[providers.Resource]):
print(provider)
# <dependency_injector.providers.Resource(<function init_database at 0x10bd2cb80>) at 0x10d346b40>
# <dependency_injector.providers.Resource(<function init_cache at 0x10be373a0>) at 0x10d346bc0>
.. disqus::

View File

@ -0,0 +1,68 @@
Chained Factories pattern
=========================
This example demonstrates "Chained Factories" pattern.
The idea of the pattern is in wrapping ``Factory`` into another ``Factory`` that adds
additional arguments.
.. code-block:: python
base_factory = providers.Factory(
SomeClass,
base_argument=1,
)
concrete_factory = providers.Factory(
base_factory,
extra_argument=2,
)
if __name__ == "__main__":
instance = concrete_factory()
# Same as: # instance = SomeClass(base_argument=1, extra_argument=2)
Sample code
-----------
Listing of the pattern example:
.. literalinclude:: ../../examples/miniapps/factory-patterns/chained_factories.py
:language: python
Arguments priority
------------------
Passing of the arguments works the same way like for any other :ref:`factory-provider`.
.. code-block:: python
# 1. Keyword arguments of upper level factory are added to lower level factory
chained_dict_factory = providers.Factory(
providers.Factory(dict, arg1=1),
arg2=2,
)
print(chained_dict_factory()) # prints: {"arg1": 1, "arg2": 2}
# 2. Keyword arguments of upper level factory have priority
chained_dict_factory = providers.Factory(
providers.Factory(dict, arg1=1),
arg1=2,
)
print(chained_dict_factory()) # prints: {"arg1": 2}
# 3. Keyword arguments provided from context have the most priority
chained_dict_factory = providers.Factory(
providers.Factory(dict, arg1=1),
arg1=2,
)
print(chained_dict_factory(arg1=3)) # prints: {"arg1": 3}
Credits
-------
The "Chained Factories" pattern was suggested by the ``Dependency Injector`` users.
.. disqus::

View File

@ -0,0 +1,74 @@
Factory of Factories pattern
============================
This example demonstrates "Factory of Factories" pattern.
The idea of the pattern is in creating a ``Factory`` that creates another ``Factory`` and adds
additional arguments.
.. code-block:: python
base_factory = providers.Factory(
providers.Factory
SomeClass,
base_argument=1,
)
concrete_factory = providers.Factory(
OtherClass,
instance=base_factory(extra_argument=1),
)
if __name__ == "__main__":
instance = concrete_factory()
# Same as: # instance = SomeClass(base_argument=1, extra_argument=2)
Sample code
-----------
Listing of the pattern example:
.. literalinclude:: ../../examples/miniapps/factory-patterns/factory_of_factories.py
:language: python
Arguments priority
------------------
Passing of the arguments works the same way like for any other :ref:`factory-provider`.
.. code-block:: python
# 1. Keyword arguments of upper level factory are added to lower level factory
factory_of_dict_factories = providers.Factory(
providers.Factory,
dict,
arg1=1,
)
dict_factory = factory_of_dict_factories(arg2=2)
print(dict_factory()) # prints: {"arg1": 1, "arg2": 2}
# 2. Keyword arguments of upper level factory have priority
factory_of_dict_factories = providers.Factory(
providers.Factory,
dict,
arg1=1,
)
dict_factory = factory_of_dict_factories(arg1=2)
print(dict_factory()) # prints: {"arg1": 2}
# 3. Keyword arguments provided from context have the most priority
factory_of_dict_factories = providers.Factory(
providers.Factory,
dict,
arg1=1,
)
dict_factory = factory_of_dict_factories(arg1=2)
print(dict_factory(arg1=3)) # prints: {"arg1": 3}
Credits
-------
The "Factory of Factories" pattern was suggested by the ``Dependency Injector`` users.
.. disqus::

View File

@ -0,0 +1,17 @@
Other examples
==============
.. meta::
:keywords: Python,Dependency Injection,Inversion of Control,Container,Example,Application,
Framework
:description: This sections contains assorted Dependency Injector examples.
This sections contains assorted ``Dependency Injector`` examples.
.. toctree::
:maxdepth: 2
use-cases
password-hashing
chained-factories
factory-of-factories

View File

@ -0,0 +1,30 @@
Password hashing example
========================
.. meta::
:keywords: Python,Dependency Injection,Inversion of Control,Container,Example,Application,
Framework,Callable
:description: This example demonstrates a usage of the Callable provider.
This example demonstrates an injection of the ``Callable`` provider.
The source code is available on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/password-hashing>`_.
Sample code
-----------
Listing of the pattern example:
.. literalinclude:: ../../examples/miniapps/password-hashing/example.py
:language: python
Run the example
---------------
Instructions for running:
.. code-block:: bash
python example.py
.. disqus::

View File

@ -0,0 +1,74 @@
Use cases example
=================
.. meta::
:keywords: Python,Dependency Injection,Inversion of Control,Container,Example,Application,
Framework,DependenciesContainer
:description: This example demonstrates a usage of the DependenciesContainer provider.
This example demonstrates a usage of the ``DependenciesContainer`` provider.
The source code is available on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/decoupled-packages>`_.
Application structure
---------------------
Example application has next structure:
.. code-block:: bash
./
└── example/
├── __init__.py
├── __main__.py
├── adapters.py
├── containers.py
└── usecases.py
Containers
----------
Listing of the ``example/containers.py``:
.. literalinclude:: ../../examples/miniapps/use-cases/example/containers.py
:language: python
Main module
-----------
Listing of the ``example/__main__.py``:
.. literalinclude:: ../../examples/miniapps/use-cases/example/__main__.py
:language: python
Run the application
-------------------
Instructions for running in the "test" mode:
.. code-block:: bash
python run.py test example@example.com
Instructions for running in the "prod" mode:
.. code-block:: bash
python run.py prod example@example.com
Adapters and use cases
----------------------
Listing of the ``example/adapters.py``:
.. literalinclude:: ../../examples/miniapps/use-cases/example/adapters.py
:language: python
Listing of the ``example/usecases.py``:
.. literalinclude:: ../../examples/miniapps/use-cases/example/usecases.py
:language: python
.. disqus::

83
docs/examples/aiohttp.rst Normal file
View File

@ -0,0 +1,83 @@
.. _aiohttp-example:
Aiohttp example
===============
.. meta::
:keywords: Python,Dependency Injection,Aiohttp,Example
:description: This example demonstrates a usage of the Aiohttp and Dependency Injector.
This example shows how to use ``Dependency Injector`` with `Aiohttp <https://docs.aiohttp.org/>`_.
The example application is a REST API that searches for funny GIFs on the `Giphy <https://giphy.com/>`_.
The source code is available on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/aiohttp>`_.
:ref:`aiohttp-tutorial` demonstrates how to build this application step-by-step.
Application structure
---------------------
Application has next structure:
.. code-block:: bash
./
├── giphynavigator/
│ ├── __init__.py
│ ├── application.py
│ ├── containers.py
│ ├── giphy.py
│ ├── handlers.py
│ ├── services.py
│ └── tests.py
├── config.yml
└── requirements.txt
Container
---------
Declarative container is defined in ``giphynavigator/containers.py``:
.. literalinclude:: ../../examples/miniapps/aiohttp/giphynavigator/containers.py
:language: python
Handlers
--------
Handler has dependencies on search service and some config options. The dependencies are injected
using :ref:`wiring` feature.
Listing of ``giphynavigator/handlers.py``:
.. literalinclude:: ../../examples/miniapps/aiohttp/giphynavigator/handlers.py
:language: python
Application factory
-------------------
Application factory creates container, wires it with the ``handlers`` module, creates
``Aiohttp`` app and setup routes.
Listing of ``giphynavigator/application.py``:
.. literalinclude:: ../../examples/miniapps/aiohttp/giphynavigator/application.py
:language: python
Tests
-----
Tests use :ref:`provider-overriding` feature to replace giphy client with a mock ``giphynavigator/tests.py``:
.. literalinclude:: ../../examples/miniapps/aiohttp/giphynavigator/tests.py
:language: python
:emphasize-lines: 32,59,73
Sources
-------
Explore the sources on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/aiohttp>`_.
.. include:: ../sponsor.rst
.. disqus::

View File

@ -0,0 +1,89 @@
.. _application-multiple-containers:
Application example (multiple containers)
=========================================
.. meta::
:keywords: Python,Dependency Injection,Inversion of Control,Container,Example,Application,
Framework,AWS,boto3,client
:description: This example shows how you can create an application using multiple declarative
containers. We build an example Python micro application following the dependency
injection principle. It consists from several services with a domain logic that
have dependencies on database & AWS S3.
This example shows how you can create an application using multiple declarative containers. Using
multiple declarative containers is a good choice for a large application. For
building a moderate or a small size application refer to :ref:`application-single-container`.
We build an example micro application following the dependency injection principle. It consists
of several services with a domain logic. The services have dependencies on database & AWS S3.
.. image:: images/application.png
:width: 100%
:align: center
Start from the scratch or jump to the section:
.. contents::
:local:
:backlinks: none
You can find the source code and instructions for running on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/application-multiple-containers>`_.
Application structure
---------------------
Application consists of an ``example`` package, a configuration file and a ``requirements.txt``
file.
.. code-block:: bash
./
├── example/
│ ├── __init__.py
│ ├── __main__.py
│ ├── containers.py
│ └── services.py
├── config.yml
└── requirements.txt
Containers
----------
Listing of the ``example/containers.py``:
.. literalinclude:: ../../examples/miniapps/application-multiple-containers/example/containers.py
:language: python
Main module
-----------
Listing of the ``example/__main__.py``:
.. literalinclude:: ../../examples/miniapps/application-multiple-containers/example/__main__.py
:language: python
Services
--------
Listing of the ``example/services.py``:
.. literalinclude:: ../../examples/miniapps/application-multiple-containers/example/services.py
:language: python
Configuration
-------------
Listing of the ``config.yml``:
.. literalinclude:: ../../examples/miniapps/application-multiple-containers/config.yml
:language: yaml
Run the application
-------------------
You can find the source code and instructions for running on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/application-multiple-containers>`_.
.. include:: ../sponsor.rst
.. disqus::

View File

@ -0,0 +1,95 @@
.. _application-single-container:
Application example (single container)
======================================
.. meta::
:keywords: Python,Dependency Injection,Inversion of Control,Container,Example,Application,
Framework,AWS,boto3,client
:description: This example shows how you can create an application using a single declarative
container. We build an example Python micro application following the dependency
injection principle. It consists from several services with a domain logic that
have dependencies on database & AWS S3.
This example shows how you can create an application using a single declarative container. Using
a single declarative container is a good choice for small or moderate size application. For
building a large application refer to :ref:`application-multiple-containers`.
We build an example micro application following the dependency injection principle. It consists
of several services with a domain logic. The services have dependencies on database & AWS S3.
.. image:: images/application.png
:width: 100%
:align: center
Start from the scratch or jump to the section:
.. contents::
:local:
:backlinks: none
You can find the source code and instructions for running on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/application-single-container>`_.
Application structure
---------------------
Application consists of an ``example`` package, several configuration files and a
``requirements.txt`` file.
.. code-block:: bash
./
├── example/
│ ├── __init__.py
│ ├── __main__.py
│ ├── containers.py
│ └── services.py
├── config.ini
├── logging.ini
└── requirements.txt
Container
---------
Listing of the ``example/containers.py``:
.. literalinclude:: ../../examples/miniapps/application-single-container/example/containers.py
:language: python
Main module
-----------
Listing of the ``example/__main__.py``:
.. literalinclude:: ../../examples/miniapps/application-single-container/example/__main__.py
:language: python
Services
--------
Listing of the ``example/services.py``:
.. literalinclude:: ../../examples/miniapps/application-single-container/example/services.py
:language: python
Configuration
-------------
Listing of the ``config.ini``:
.. literalinclude:: ../../examples/miniapps/application-single-container/config.ini
:language: ini
Listing of the ``logging.ini``:
.. literalinclude:: ../../examples/miniapps/application-single-container/logging.ini
:language: ini
Run the application
-------------------
You can find the source code and instructions for running on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/application-single-container>`_.
.. include:: ../sponsor.rst
.. disqus::

22
docs/examples/boto3.rst Normal file
View File

@ -0,0 +1,22 @@
.. _boto3-example:
Boto3 example
=============
.. meta::
:keywords: Python,Dependency Injection,Boto3,AWS,Amazon Web Services,S3,SQS,Rout53,EC2,Lambda,Example
:description: This example demonstrates a usage of Boto3 AWS client and Dependency Injector.
This example shows how to use ``Dependency Injector`` with `Boto3 <https://github.com/boto/boto3>`_.
The source code is available on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/boto3-session>`_.
Listing of ``boto3_session_example.py``:
.. literalinclude:: ../../examples/miniapps/boto3-session/boto3_session_example.py
:language: python
.. include:: ../sponsor.rst
.. disqus::

View File

@ -0,0 +1,134 @@
.. _decoupled-packages:
Decoupled packages example (multiple containers)
================================================
.. meta::
:keywords: Python,Dependency Injection,Inversion of Control,Container,Example,Application,
Framework,AWS,boto3,client
:description: This example shows how to use Dependency Injector to create Python decoupled packages.
To achieve a decoupling each package has a container with the components. When
a component needs a dependency from the outside of the package scope we use the
Dependency provider. The package container has no knowledge on where the
dependencies come from. It states a need that the dependencies must be provided.
This helps to decouple a package from the 3rd party dependencies and other
packages.
This example shows how to use ``Dependency Injector`` to create decoupled packages.
To achieve a decoupling each package has a container with the components. When a component needs a
dependency from the outside of the package scope we use the ``Dependency`` provider. The package
container has no knowledge on where the dependencies come from. It states a need that the
dependencies must be provided. This helps to decouple a package from the 3rd party dependencies
and other packages.
To wire the packages we use an application container. Application container has all 3rd party
dependencies and package containers. It wires the packages and dependencies to create a
complete application.
We build an example micro application that consists of 3 packages:
- ``user`` - a package with user domain logic, depends on a database
- ``photo`` - a package with photo domain logic, depends on a database and AWS S3
- ``analytics`` - a package with analytics domain logic, depends on the ``user`` and ``photo``
package components
.. image:: images/decoupled-packages.png
:width: 100%
:align: center
Start from the scratch or jump to the section:
.. contents::
:local:
:backlinks: none
You can find the source code and instructions for running on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/decoupled-packages>`_.
Application structure
---------------------
Application consists of an ``example`` package, a configuration file and a ``requirements.txt``
file.
.. code-block:: bash
./
├── example/
│ ├── analytics/
│ │ ├── __init__.py
│ │ ├── containers.py
│ │ └── services.py
│ ├── photo/
│ │ ├── __init__.py
│ │ ├── containers.py
│ │ ├── entities.py
│ │ └── repositories.py
│ ├── user/
│ │ ├── __init__.py
│ │ ├── containers.py
│ │ ├── entities.py
│ │ └── repositories.py
│ ├── __init__.py
│ ├── __main__.py
│ └── containers.py
├── config.ini
└── requirements.txt
Package containers
------------------
Listing of the ``example/user/containers.py``:
.. literalinclude:: ../../examples/miniapps/decoupled-packages/example/user/containers.py
:language: python
Listing of the ``example/photo/containers.py``:
.. literalinclude:: ../../examples/miniapps/decoupled-packages/example/photo/containers.py
:language: python
Listing of the ``example/analytics/containers.py``:
.. literalinclude:: ../../examples/miniapps/decoupled-packages/example/analytics/containers.py
:language: python
Application container
---------------------
Application container consists of all packages and 3rd party dependencies. Its role is to wire
everything together in a complete application.
Listing of the ``example/containers.py``:
.. literalinclude:: ../../examples/miniapps/decoupled-packages/example/containers.py
:language: python
.. note::
Package ``analytics`` has dependencies on the repositories from the ``user`` and
``photo`` packages. This is an example of how you can pass the dependencies from one package
to another.
Main module
-----------
Listing of the ``example/__main__.py``:
.. literalinclude:: ../../examples/miniapps/decoupled-packages/example/__main__.py
:language: python
Configuration
-------------
Listing of the ``config.ini``:
.. literalinclude:: ../../examples/miniapps/decoupled-packages/config.ini
:language: ini
Run the application
-------------------
You can find the source code and instructions for running on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/decoupled-packages>`_.
.. include:: ../sponsor.rst
.. disqus::

99
docs/examples/django.rst Normal file
View File

@ -0,0 +1,99 @@
.. _django-example:
Django example
==============
.. meta::
:keywords: Python,Dependency Injection,Django,Example
:description: This example demonstrates a usage of the Django and Dependency Injector.
This example shows how to use ``Dependency Injector`` with `Django <https://www.djangoproject.com/>`_.
The example application helps to search for repositories on the Github.
.. image:: images/django.png
:width: 100%
:align: center
The source code is available on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/django>`_.
Application structure
---------------------
Application has standard Django project structure. It consists of ``githubnavigator`` project package and
``web`` application package:
.. code-block:: bash
./
├── githubnavigator/
│ ├── __init__.py
│ ├── asgi.py
│ ├── containers.py
│ ├── services.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
├── web/
│ ├── templates/
│ │ ├── base.html
│ │ └── index.html
│ ├── __init__.py
│ ├── apps.py
│ ├── tests.py
│ ├── urls.py
│ └── views.py
├── manage.py
└── requirements.txt
Container
---------
Declarative container is defined in ``githubnavigator/containers.py``:
.. literalinclude:: ../../examples/miniapps/django/githubnavigator/containers.py
:language: python
Container instance is created in ``githubnavigator/__init__.py``:
.. literalinclude:: ../../examples/miniapps/django/githubnavigator/__init__.py
:language: python
Views
-----
View has dependencies on search service and some config options. The dependencies are injected
using :ref:`wiring` feature.
Listing of ``web/views.py``:
.. literalinclude:: ../../examples/miniapps/django/web/views.py
:language: python
App config
----------
Container is wired to the ``views`` module in the app config ``web/apps.py``:
.. literalinclude:: ../../examples/miniapps/django/web/apps.py
:language: python
:emphasize-lines: 13
Tests
-----
Tests use :ref:`provider-overriding` feature to replace github client with a mock ``web/tests.py``:
.. literalinclude:: ../../examples/miniapps/django/web/tests.py
:language: python
:emphasize-lines: 39,60
Sources
-------
Explore the sources on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/django>`_.
.. include:: ../sponsor.rst
.. disqus::

View File

@ -0,0 +1,100 @@
.. _fastapi-redis-example:
FastAPI + Redis example
=======================
.. meta::
:keywords: Python,Dependency Injection,FastAPI,Redis,Example
:description: This example demonstrates a usage of the FastAPI, Redis, and Dependency Injector.
This example shows how to use ``Dependency Injector`` with `FastAPI <https://fastapi.tiangolo.com/>`_ and
`Redis <https://redis.io/>`_.
The source code is available on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/fastapi-redis>`_.
See also:
- Provider :ref:`async-injections`
- Resource provider :ref:`resource-async-initializers`
- Wiring :ref:`async-injections-wiring`
Application structure
---------------------
Application has next structure:
.. code-block:: bash
./
├── fastapiredis/
│ ├── __init__.py
│ ├── application.py
│ ├── containers.py
│ ├── redis.py
│ ├── services.py
│ └── tests.py
├── docker-compose.yml
├── Dockerfile
└── requirements.txt
Redis
-----
Module ``redis`` defines Redis connection pool initialization and shutdown. See ``fastapiredis/redis.py``:
.. literalinclude:: ../../examples/miniapps/fastapi-redis/fastapiredis/redis.py
:language: python
Service
-------
Module ``services`` contains example service. Service has a dependency on Redis connection pool.
It uses it for getting and setting a key asynchronously. Real life service will do something more meaningful.
See ``fastapiredis/services.py``:
.. literalinclude:: ../../examples/miniapps/fastapi-redis/fastapiredis/services.py
:language: python
Container
---------
Declarative container wires example service with Redis connection pool. See ``fastapiredis/containers.py``:
.. literalinclude:: ../../examples/miniapps/fastapi-redis/fastapiredis/containers.py
:language: python
Application
-----------
Module ``application`` creates ``FastAPI`` app, setup endpoint, and init container.
Endpoint ``index`` has a dependency on example service. The dependency is injected using :ref:`wiring` feature.
Listing of ``fastapiredis/application.py``:
.. literalinclude:: ../../examples/miniapps/fastapi-redis/fastapiredis/application.py
:language: python
Tests
-----
Tests use :ref:`provider-overriding` feature to replace example service with a mock. See ``fastapiredis/tests.py``:
.. literalinclude:: ../../examples/miniapps/fastapi-redis/fastapiredis/tests.py
:language: python
:emphasize-lines: 24
Sources
-------
The source code is available on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/fastapi-redis>`_.
See also:
- Provider :ref:`async-injections`
- Resource provider :ref:`resource-async-initializers`
- Wiring :ref:`async-injections-wiring`
.. include:: ../sponsor.rst
.. disqus::

View File

@ -0,0 +1,121 @@
.. _fastapi-sqlalchemy-example:
FastAPI + SQLAlchemy example
============================
.. meta::
:keywords: Python,Dependency Injection,FastAPI,SQLAlchemy,Example
:description: This example demonstrates a usage of the FastAPI, SQLAlchemy, and Dependency Injector.
This example shows how to use ``Dependency Injector`` with `FastAPI <https://fastapi.tiangolo.com/>`_ and
`SQLAlchemy <https://www.sqlalchemy.org/>`_.
The source code is available on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/fastapi-sqlalchemy>`_.
Thanks to `@ShvetsovYura <https://github.com/ShvetsovYura>`_ for providing initial example:
`FastAPI_DI_SqlAlchemy <https://github.com/ShvetsovYura/FastAPI_DI_SqlAlchemy>`_.
Application structure
---------------------
Application has next structure:
.. code-block:: bash
./
├── webapp/
│ ├── __init__.py
│ ├── application.py
│ ├── containers.py
│ ├── database.py
│ ├── endpoints.py
│ ├── models.py
│ ├── repositories.py
│ ├── services.py
│ └── tests.py
├── config.yml
├── docker-compose.yml
├── Dockerfile
└── requirements.txt
Application factory
-------------------
Application factory creates container, wires it with the ``endpoints`` module, creates
``FastAPI`` app, and setup routes.
Application factory also creates database if it does not exist.
Listing of ``webapp/application.py``:
.. literalinclude:: ../../examples/miniapps/fastapi-sqlalchemy/webapp/application.py
:language: python
Endpoints
---------
Module ``endpoints`` contains example endpoints. Endpoints have a dependency on user service.
User service is injected using :ref:`wiring` feature. See ``webapp/endpoints.py``:
.. literalinclude:: ../../examples/miniapps/fastapi-sqlalchemy/webapp/endpoints.py
:language: python
Container
---------
Declarative container wires example user service, user repository, and utility database class.
See ``webapp/containers.py``:
.. literalinclude:: ../../examples/miniapps/fastapi-sqlalchemy/webapp/containers.py
:language: python
Services
--------
Module ``services`` contains example user service. See ``webapp/services.py``:
.. literalinclude:: ../../examples/miniapps/fastapi-sqlalchemy/webapp/services.py
:language: python
Repositories
------------
Module ``repositories`` contains example user repository. See ``webapp/repositories.py``:
.. literalinclude:: ../../examples/miniapps/fastapi-sqlalchemy/webapp/repositories.py
:language: python
Models
------
Module ``models`` contains example SQLAlchemy user model. See ``webapp/models.py``:
.. literalinclude:: ../../examples/miniapps/fastapi-sqlalchemy/webapp/models.py
:language: python
Database
--------
Module ``database`` defines declarative base and utility class with engine and session factory.
See ``webapp/database.py``:
.. literalinclude:: ../../examples/miniapps/fastapi-sqlalchemy/webapp/database.py
:language: python
Tests
-----
Tests use :ref:`provider-overriding` feature to replace repository with a mock. See ``webapp/tests.py``:
.. literalinclude:: ../../examples/miniapps/fastapi-sqlalchemy/webapp/tests.py
:language: python
:emphasize-lines: 25, 45, 58, 74, 86, 97
Sources
-------
The source code is available on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/fastapi-sqlalchemy>`_.
.. include:: ../sponsor.rst
.. disqus::

81
docs/examples/fastapi.rst Normal file
View File

@ -0,0 +1,81 @@
.. _fastapi-example:
FastAPI example
===============
.. meta::
:keywords: Python,Dependency Injection,FastAPI,Example
:description: This example demonstrates a usage of the FastAPI and Dependency Injector.
This example shows how to use ``Dependency Injector`` with `FastAPI <https://fastapi.tiangolo.com/>`_.
The example application is a REST API that searches for funny GIFs on the `Giphy <https://giphy.com/>`_.
The source code is available on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/fastapi>`_.
Application structure
---------------------
Application has next structure:
.. code-block:: bash
./
├── giphynavigator/
│ ├── __init__.py
│ ├── application.py
│ ├── containers.py
│ ├── endpoints.py
│ ├── giphy.py
│ ├── services.py
│ └── tests.py
├── config.yml
└── requirements.txt
Container
---------
Declarative container is defined in ``giphynavigator/containers.py``:
.. literalinclude:: ../../examples/miniapps/fastapi/giphynavigator/containers.py
:language: python
Endpoints
---------
Endpoint has a dependency on search service. There are also some config options that are used as default values.
The dependencies are injected using :ref:`wiring` feature.
Listing of ``giphynavigator/endpoints.py``:
.. literalinclude:: ../../examples/miniapps/fastapi/giphynavigator/endpoints.py
:language: python
Application factory
-------------------
Application factory creates container, wires it with the ``endpoints`` module, creates
``FastAPI`` app, and setup routes.
Listing of ``giphynavigator/application.py``:
.. literalinclude:: ../../examples/miniapps/fastapi/giphynavigator/application.py
:language: python
Tests
-----
Tests use :ref:`provider-overriding` feature to replace giphy client with a mock ``giphynavigator/tests.py``:
.. literalinclude:: ../../examples/miniapps/fastapi/giphynavigator/tests.py
:language: python
:emphasize-lines: 29,57,72
Sources
-------
Explore the sources on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/fastapi>`_.
.. include:: ../sponsor.rst
.. disqus::

View File

@ -0,0 +1,91 @@
.. _flask-blueprints-example:
Flask blueprints example
========================
.. meta::
:keywords: Python,Dependency Injection,Flask,Blueprints,Example
:description: This example demonstrates a usage of the Flask Blueprints and Dependency Injector.
This example shows how to use ``Dependency Injector`` with `Flask <https://flask.palletsprojects.com/en/1.1.x/>`_
blueprints.
The example application helps to search for repositories on the Github.
.. image:: images/flask.png
:width: 100%
:align: center
The source code is available on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/flask-blueprints>`_.
Application structure
---------------------
Application has next structure:
.. code-block:: bash
./
├── githubnavigator/
│ ├── blueprints
│ │ ├── __init__.py
│ │ └── example.py
│ ├── templates
│ │ ├── base.html
│ │ └── index.py
│ ├── __init__.py
│ ├── application.py
│ ├── containers.py
│ ├── services.py
│ └── tests.py
├── config.yml
└── requirements.txt
Container
---------
Declarative container is defined in ``githubnavigator/containers.py``:
.. literalinclude:: ../../examples/miniapps/flask-blueprints/githubnavigator/containers.py
:language: python
Blueprints
----------
Blueprint's view has dependencies on search service and some config options. The dependencies are injected
using :ref:`wiring` feature.
Listing of ``githubnavigator/blueprints/example.py``:
.. literalinclude:: ../../examples/miniapps/flask-blueprints/githubnavigator/blueprints/example.py
:language: python
Application factory
-------------------
Application factory creates container, wires it with the blueprints, creates
``Flask`` app, and setup routes.
Listing of ``githubnavigator/application.py``:
.. literalinclude:: ../../examples/miniapps/flask-blueprints/githubnavigator/application.py
:language: python
Tests
-----
Tests use :ref:`provider-overriding` feature to replace github client with a mock ``githubnavigator/tests.py``:
.. literalinclude:: ../../examples/miniapps/flask-blueprints/githubnavigator/tests.py
:language: python
:emphasize-lines: 44,67
Sources
-------
Explore the sources on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/flask-blueprints>`_.
.. include:: ../sponsor.rst
.. disqus::

89
docs/examples/flask.rst Normal file
View File

@ -0,0 +1,89 @@
.. _flask-example:
Flask example
=============
.. meta::
:keywords: Python,Dependency Injection,Flask,Example
:description: This example demonstrates a usage of the Flask and Dependency Injector.
This example shows how to use ``Dependency Injector`` with `Flask <https://flask.palletsprojects.com/en/1.1.x/>`_.
The example application helps to search for repositories on the Github.
.. image:: images/flask.png
:width: 100%
:align: center
The source code is available on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/flask>`_.
:ref:`flask-tutorial` demonstrates how to build this application step-by-step.
Application structure
---------------------
Application has next structure:
.. code-block:: bash
./
├── githubnavigator/
│ ├── templates
│ │ ├── base.html
│ │ └── index.py
│ ├── __init__.py
│ ├── application.py
│ ├── containers.py
│ ├── services.py
│ ├── tests.py
│ └── views.py
├── config.yml
└── requirements.txt
Container
---------
Declarative container is defined in ``githubnavigator/containers.py``:
.. literalinclude:: ../../examples/miniapps/flask/githubnavigator/containers.py
:language: python
Views
-----
View has dependencies on search service and some config options. The dependencies are injected
using :ref:`wiring` feature.
Listing of ``githubnavigator/views.py``:
.. literalinclude:: ../../examples/miniapps/flask/githubnavigator/views.py
:language: python
Application factory
-------------------
Application factory creates container, wires it with the ``views`` module, creates
``Flask`` app and setup routes.
Listing of ``githubnavigator/application.py``:
.. literalinclude:: ../../examples/miniapps/flask/githubnavigator/application.py
:language: python
Tests
-----
Tests use :ref:`provider-overriding` feature to replace github client with a mock ``githubnavigator/tests.py``:
.. literalinclude:: ../../examples/miniapps/flask/githubnavigator/tests.py
:language: python
:emphasize-lines: 44,67
Sources
-------
Explore the sources on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/flask>`_.
.. include:: ../sponsor.rst
.. disqus::

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 647 KiB

26
docs/examples/index.rst Normal file
View File

@ -0,0 +1,26 @@
Examples
========
.. meta::
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Example
:description: Python dependency injection examples.
Explore the examples to see the ``Dependency Injector`` in action.
.. toctree::
:maxdepth: 2
application-single-container
application-multiple-containers
decoupled-packages
boto3
django
flask
flask-blueprints
aiohttp
sanic
fastapi
fastapi-redis
fastapi-sqlalchemy
.. disqus::

82
docs/examples/sanic.rst Normal file
View File

@ -0,0 +1,82 @@
.. _sanic-example:
Sanic example
==============
.. meta::
:keywords: Python,Dependency Injection,Sanic,Example
:description: This example demonstrates a usage of the Sanic and Dependency Injector.
This example shows how to use ``Dependency Injector`` with `Sanic <https://sanic.readthedocs.io/en/latest/>`_.
The example application is a REST API that searches for funny GIFs on the `Giphy <https://giphy.com/>`_.
The source code is available on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/sanic>`_.
Application structure
---------------------
Application has next structure:
.. code-block:: bash
./
├── giphynavigator/
│ ├── __init__.py
│ ├── __main__.py
│ ├── application.py
│ ├── containers.py
│ ├── giphy.py
│ ├── handlers.py
│ ├── services.py
│ └── tests.py
├── config.yml
└── requirements.txt
Container
---------
Declarative container is defined in ``giphynavigator/containers.py``:
.. literalinclude:: ../../examples/miniapps/sanic/giphynavigator/containers.py
:language: python
Handlers
--------
Handler has dependencies on search service and some config options. The dependencies are injected
using :ref:`wiring` feature.
Listing of ``giphynavigator/handlers.py``:
.. literalinclude:: ../../examples/miniapps/sanic/giphynavigator/handlers.py
:language: python
Application factory
-------------------
Application factory creates container, wires it with the ``handlers`` module, creates
``Sanic`` app and setup routes.
Listing of ``giphynavigator/application.py``:
.. literalinclude:: ../../examples/miniapps/sanic/giphynavigator/application.py
:language: python
Tests
-----
Tests use :ref:`provider-overriding` feature to replace giphy client with a mock ``giphynavigator/tests.py``:
.. literalinclude:: ../../examples/miniapps/sanic/giphynavigator/tests.py
:language: python
:emphasize-lines: 34,61,75
Sources
-------
Explore the sources on the `Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/sanic>`_.
.. include:: ../sponsor.rst
.. disqus::

BIN
docs/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

150
docs/index.rst Normal file
View File

@ -0,0 +1,150 @@
=================================================================
Dependency Injector --- Dependency injection framework for Python
=================================================================
.. meta::
:google-site-verification: V1hlKfpgL3AARAElwFcqP4qW1Smsx5bKSRU8O86i20Y
:keywords: Python,Dependency injection,DI,Inversion of Control,IoC,
IoC Container,Factory, Singleton, Design Patterns
:description: Dependency Injector is a dependency injection framework
for Python. It helps to maintain you application structure.
It was designed to be unified, developer-friendly
tool that helps to implement dependency injection design
pattern in formal, pretty, Pythonic way. Dependency Injector
provides implementations of such popular design patterns
like IoC container, Factory and Singleton. Dependency
Injector providers are implemented as C extension types
using Cython.
.. _index:
.. image:: https://img.shields.io/pypi/v/dependency_injector.svg
:target: https://pypi.org/project/dependency-injector/
:alt: Latest Version
.. image:: https://img.shields.io/pypi/l/dependency_injector.svg
:target: https://pypi.org/project/dependency-injector/
:alt: License
.. image:: https://img.shields.io/pypi/pyversions/dependency_injector.svg
:target: https://pypi.org/project/dependency-injector/
:alt: Supported Python versions
.. image:: https://img.shields.io/pypi/implementation/dependency_injector.svg
:target: https://pypi.org/project/dependency-injector/
:alt: Supported Python implementations
.. image:: https://static.pepy.tech/badge/dependency-injector
:target: https://pepy.tech/project/dependency-injector
:alt: Downloads
.. image:: https://static.pepy.tech/badge/dependency-injector/month
:target: https://pepy.tech/project/dependency-injector
:alt: Downloads
.. image:: https://static.pepy.tech/badge/dependency-injector/week
:target: https://pepy.tech/project/dependency-injector
:alt: Downloads
.. image:: https://img.shields.io/pypi/wheel/dependency-injector.svg
:target: https://pypi.org/project/dependency-injector/
:alt: Wheel
.. image:: https://img.shields.io/github/actions/workflow/status/ets-labs/python-dependency-injector/tests-and-linters.yml?branch=master
:target: https://github.com/ets-labs/python-dependency-injector/actions
:alt: Build Status
.. image:: https://coveralls.io/repos/github/ets-labs/python-dependency-injector/badge.svg?branch=master
:target: https://coveralls.io/github/ets-labs/python-dependency-injector?branch=master
:alt: Coverage Status
``Dependency Injector`` is a dependency injection framework for Python.
It helps implementing the dependency injection principle.
Key features of the ``Dependency Injector``:
- **Providers**. Provides ``Factory``, ``Singleton``, ``Callable``, ``Coroutine``, ``Object``,
``List``, ``Dict``, ``Configuration``, ``Resource``, ``Dependency``, and ``Selector`` providers
that help assemble your objects. See :ref:`providers`.
- **Overriding**. Can override any provider by another provider on the fly. This helps in testing
and configuring dev/stage environment to replace API clients with stubs etc. See
:ref:`provider-overriding`.
- **Configuration**. Reads configuration from ``yaml``, ``ini``, and ``json`` files, ``pydantic`` settings,
environment variables, and dictionaries. See :ref:`configuration-provider`.
- **Resources**. Helps with initialization and configuring of logging, event loop, thread
or process pool, etc. Can be used for per-function execution scope in tandem with wiring.
See :ref:`resource-provider`.
- **Containers**. Provides declarative and dynamic containers. See :ref:`containers`.
- **Wiring**. Injects dependencies into functions and methods. Helps integrate with
other frameworks: Django, Flask, Aiohttp, Sanic, FastAPI, etc. See :ref:`wiring`.
- **Asynchronous**. Supports asynchronous injections. See :ref:`async-injections`.
- **Typing**. Provides typing stubs, ``mypy``-friendly. See :ref:`provider-typing`.
- **Performance**. Fast. Written in ``Cython``.
- **Maturity**. Mature and production-ready. Well-tested, documented, and supported.
.. code-block:: python
from dependency_injector import containers, providers
from dependency_injector.wiring import Provide, inject
class Container(containers.DeclarativeContainer):
config = providers.Configuration()
api_client = providers.Singleton(
ApiClient,
api_key=config.api_key,
timeout=config.timeout,
)
service = providers.Factory(
Service,
api_client=api_client,
)
@inject
def main(service: Service = Provide[Container.service]) -> None:
...
if __name__ == "__main__":
container = Container()
container.config.api_key.from_env("API_KEY", required=True)
container.config.timeout.from_env("TIMEOUT", as_=int, default=5)
container.wire(modules=[__name__])
main() # <-- dependency is injected automatically
with container.api_client.override(mock.Mock()):
main() # <-- overridden dependency is injected automatically
With the ``Dependency Injector``, object assembling is consolidated in the container.
Dependency injections are defined explicitly.
This makes it easier to understand and change how the application works.
.. figure:: https://raw.githubusercontent.com/wiki/ets-labs/python-dependency-injector/img/di-readme.svg
:target: https://github.com/ets-labs/python-dependency-injector
Explore the documentation to know more about the ``Dependency Injector``.
.. _contents:
Contents
--------
.. toctree::
:maxdepth: 2
introduction/index
examples/index
tutorials/index
providers/index
containers/index
wiring
examples-other/index
api/index
main/feedback
main/changelog

View File

@ -0,0 +1,315 @@
Dependency injection and inversion of control in Python
=======================================================
.. meta::
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Example
:description: This page describes a usage of the dependency injection and inversion of control
in Python. It contains Python examples that show how to implement dependency
injection. It demonstrates a usage of the dependency injection framework
Dependency Injector, its container, Factory, Singleton and Configuration
providers. The example show how to use Dependency Injector providers overriding
feature for testing or configuring project in different environments and explains
why it's better than monkey-patching.
Originally dependency injection pattern got popular in languages with static typing like Java.
Dependency injection is a principle that helps to achieve an inversion of control. A
dependency injection framework can significantly improve the flexibility of a language
with static typing. Implementation of a dependency injection framework for a language
with static typing is not something that one can do quickly. It will be a quite complex thing
to be done well. And will take time.
Python is an interpreted language with dynamic typing. There is an opinion that dependency
injection doesn't work for it as well as it does for Java. A lot of the flexibility is already
built-in. Also, there is an opinion that a dependency injection framework is something that
Python developer rarely needs. Python developers say that dependency injection can be implemented
easily using language fundamentals.
This page describes the advantages of applying dependency injection in Python. It
contains Python examples that show how to implement dependency injection. It demonstrates the usage
of the ``Dependency Injector`` framework, its container, ``Factory``, ``Singleton``,
and ``Configuration`` providers. The example shows how to use providers' overriding feature
of ``Dependency Injector`` for testing or re-configuring a project in different environments and
explains why it's better than monkey-patching.
What is dependency injection?
-----------------------------
Let's see what the dependency injection is.
Dependency injection is a principle that helps to decrease coupling and increase cohesion.
.. image:: images/coupling-cohesion.png
What is coupling and cohesion?
Coupling and cohesion are about how tough the components are tied.
- **High coupling**. If the coupling is high it's like using superglue or welding. No easy way
to disassemble.
- **High cohesion**. High cohesion is like using screws. Quite easy to disassemble and
re-assemble in a different way. It is an opposite to high coupling.
Cohesion often correlates with coupling. Higher cohesion usually leads to lower coupling and vice versa.
Low coupling brings flexibility. Your code becomes easier to change and test.
How to implement the dependency injection?
Objects do not create each other anymore. They provide a way to inject the dependencies instead.
Before:
.. code-block:: python
import os
class ApiClient:
def __init__(self) -> None:
self.api_key = os.getenv("API_KEY") # <-- dependency
self.timeout = int(os.getenv("TIMEOUT")) # <-- dependency
class Service:
def __init__(self) -> None:
self.api_client = ApiClient() # <-- dependency
def main() -> None:
service = Service() # <-- dependency
...
if __name__ == "__main__":
main()
After:
.. code-block:: python
import os
class ApiClient:
def __init__(self, api_key: str, timeout: int) -> None:
self.api_key = api_key # <-- dependency is injected
self.timeout = timeout # <-- dependency is injected
class Service:
def __init__(self, api_client: ApiClient) -> None:
self.api_client = api_client # <-- dependency is injected
def main(service: Service) -> None: # <-- dependency is injected
...
if __name__ == "__main__":
main(
service=Service(
api_client=ApiClient(
api_key=os.getenv("API_KEY"),
timeout=int(os.getenv("TIMEOUT")),
),
),
)
``ApiClient`` is decoupled from knowing where the options come from. You can read a key and a
timeout from a configuration file or even get them from a database.
``Service`` is decoupled from the ``ApiClient``. It does not create it anymore. You can provide a
stub or other compatible object.
Function ``main()`` is decoupled from ``Service``. It receives it as an argument.
Flexibility comes with a price.
Now you need to assemble and inject the objects like this:
.. code-block:: python
main(
service=Service(
api_client=ApiClient(
api_key=os.getenv("API_KEY"),
timeout=int(os.getenv("TIMEOUT")),
),
),
)
The assembly code might get duplicated and it'll become harder to change the application structure.
Here comes the ``Dependency Injector``.
What does the Dependency Injector do?
-------------------------------------
With the dependency injection pattern, objects lose the responsibility of assembling
the dependencies. The ``Dependency Injector`` absorbs that responsibility.
``Dependency Injector`` helps to assemble and inject the dependencies.
It provides a container and providers that help you with the objects assembly.
When you need an object you place a ``Provide`` marker as a default value of a
function argument. When you call this function, framework assembles and injects
the dependency.
.. code-block:: python
from dependency_injector import containers, providers
from dependency_injector.wiring import Provide, inject
class Container(containers.DeclarativeContainer):
config = providers.Configuration()
api_client = providers.Singleton(
ApiClient,
api_key=config.api_key,
timeout=config.timeout,
)
service = providers.Factory(
Service,
api_client=api_client,
)
@inject
def main(service: Service = Provide[Container.service]) -> None:
...
if __name__ == "__main__":
container = Container()
container.config.api_key.from_env("API_KEY", required=True)
container.config.timeout.from_env("TIMEOUT", as_=int, default=5)
container.wire(modules=[__name__])
main() # <-- dependency is injected automatically
with container.api_client.override(mock.Mock()):
main() # <-- overridden dependency is injected automatically
When you call the ``main()`` function the ``Service`` dependency is assembled and injected automatically.
When you do testing, you call the ``container.api_client.override()`` method to replace the real API
client with a mock. When you call ``main()``, the mock is injected.
You can override any provider with another provider.
It also helps you in a re-configuring project for different environments: replace an API client
with a stub on the dev or stage.
Objects assembling is consolidated in a container. Dependency injections are defined explicitly.
This makes it easier to understand and change how an application works.
Testing, Monkey-patching and dependency injection
-------------------------------------------------
The testability benefit is opposed to monkey-patching.
In Python, you can monkey-patch anything, anytime. The problem with monkey-patching is
that it's too fragile. The cause of it is that when you monkey-patch you do something that
wasn't intended to be done. You monkey-patch the implementation details. When implementation
changes the monkey-patching is broken.
With dependency injection, you patch the interface, not an implementation. This is a way more
stable approach.
Also, monkey-patching is way too dirty to be used outside of the testing code for
re-configuring the project for the different environments.
Conclusion
----------
Dependency injection provides you with three advantages:
- **Flexibility**. The components are loosely coupled. You can easily extend or change the
functionality of a system by combining the components in a different way. You even can do it on
the fly.
- **Testability**. Testing is easier because you can easily inject mocks instead of real objects
that use API or database, etc.
- **Clearness and maintainability**. Dependency injection helps you reveal the dependencies.
Implicit becomes explicit. And "Explicit is better than implicit" (PEP 20 - The Zen of Python).
You have all the components and dependencies defined explicitly in a container. This
provides an overview and control of the application structure. It is easier to understand and
change it.
Is it worth applying dependency injection in Python?
It depends on what you build. The advantages above are not too important if you use Python as a
scripting language. The picture is different when you use Python to create an application. The
larger the application the more significant the benefits.
Is it worth using a framework for applying dependency injection?
The complexity of the dependency injection pattern implementation in Python is
lower than in other languages but it's still in place. It doesn't mean you have to use a
framework but using a framework is beneficial because the framework is:
- Already implemented
- Tested on all platforms and versions of Python
- Documented
- Supported
- Other engineers are familiar with it
An advice at last:
- **Give it a try**. Dependency injection is counter-intuitive. Our nature is that
when we need something the first thought that comes to our mind is to go and get it. Dependency
injection is just like "Wait, I need to state a need instead of getting something right away".
It's like a little investment that will pay-off later. The advice is to just give it a try for
two weeks. This time will be enough for getting your own impression. If you don't like it you
won't lose too much.
- **Common sense first**. Use common sense when applying dependency injection. It is a good
principle, but not a silver bullet. If you do it too much you will reveal too many of the
implementation details. Experience comes with practice and time.
What's next?
------------
Choose one of the following as a next step:
- Look at the application examples:
- :ref:`application-single-container`
- :ref:`application-multiple-containers`
- :ref:`decoupled-packages`
- :ref:`boto3-example`
- :ref:`django-example`
- :ref:`flask-example`
- :ref:`flask-blueprints-example`
- :ref:`aiohttp-example`
- :ref:`sanic-example`
- :ref:`fastapi-example`
- :ref:`fastapi-redis-example`
- :ref:`fastapi-sqlalchemy-example`
- Pass the tutorials:
- :ref:`flask-tutorial`
- :ref:`aiohttp-tutorial`
- :ref:`asyncio-daemon-tutorial`
- :ref:`cli-tutorial`
- Know more about the ``Dependency Injector`` :ref:`key-features`
- Know more about the :ref:`providers`
- Know more about the :ref:`wiring`
- Go to the :ref:`contents`
Useful links
------------
A few useful links related to a dependency injection design pattern for further reading:
+ https://en.wikipedia.org/wiki/Dependency_injection
+ https://martinfowler.com/articles/injection.html
+ https://github.com/ets-labs/python-dependency-injector
+ https://pypi.org/project/dependency-injector/
.. include:: ../sponsor.rst
.. disqus::

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@ -0,0 +1,18 @@
Introduction
============
.. meta::
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control
:description: Current section of the documentation is provides an
overview of the dependency injection, inversion of
control and Dependency Injector framework.
The current section of the documentation provides an overview of the
dependency injection, inversion of control, and the ``Dependency Injector`` framework.
.. toctree::
:maxdepth: 2
di_in_python
key_features
installation

View File

@ -0,0 +1,42 @@
Installation
============
``Dependency Injector`` is available on `PyPI <https://pypi.org/project/dependency-injector/>`_.
To install the latest version you can use ``pip``:
.. code-block:: bash
pip install dependency-injector
Some modules of the ``Dependency Injector`` are implemented as C extensions.
``Dependency Injector`` is distributed as a pre-compiled wheels. Wheels are
available for all supported Python versions on Linux, Windows, and MacOS.
Linux distribution uses `manylinux <https://github.com/pypa/manylinux>`_.
If there is no appropriate wheel for your environment (Python version and OS)
installer will compile the package from sources on your machine. You'll need
a C compiler and Python header files.
To verify the installed version:
.. code-block:: bash
>>> import dependency_injector
>>> dependency_injector.__version__
'4.39.0'
.. note::
When adding ``Dependency Injector`` to ``pyproject.toml`` or ``requirements.txt``
don't forget to pin the version to the current major:
.. code-block:: bash
dependency-injector>=4.0,<5.0
*The next major version can be incompatible.*
All releases are available on the `PyPI release history page <https://pypi.org/project/dependency-injector/#history>`_.
Each release has an appropriate tag. The tags are available on the
`GitHub releases page <https://github.com/ets-labs/python-dependency-injector/releases>`_.
.. disqus::

View File

@ -0,0 +1,43 @@
.. _key-features:
Key features
------------
.. meta::
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control
:description: This article describes key features of the Dependency Injector
framework.
Key features of the ``Dependency Injector``:
- **Providers**. Provides ``Factory``, ``Singleton``, ``Callable``, ``Coroutine``, ``Object``,
``List``, ``Dict``, ``Configuration``, ``Resource``, ``Dependency``, and ``Selector`` providers
that help assemble your objects. See :ref:`providers`.
- **Overriding**. Can override any provider by another provider on the fly. This helps in testing
and configuring dev/stage environment to replace API clients with stubs etc. See
:ref:`provider-overriding`.
- **Configuration**. Reads configuration from ``yaml``, ``ini``, and ``json`` files, ``pydantic`` settings,
environment variables, and dictionaries. See :ref:`configuration-provider`.
- **Resources**. Helps with initialization and configuring of logging, event loop, thread
or process pool, etc. Can be used for per-function execution scope in tandem with wiring.
See :ref:`resource-provider`.
- **Containers**. Provides declarative and dynamic containers. See :ref:`containers`.
- **Wiring**. Injects dependencies into functions and methods. Helps integrate with
other frameworks: Django, Flask, Aiohttp, Sanic, FastAPI, etc. See :ref:`wiring`.
- **Asynchronous**. Supports asynchronous injections. See :ref:`async-injections`.
- **Typing**. Provides typing stubs, ``mypy``-friendly. See :ref:`provider-typing`.
- **Performance**. Fast. Written in ``Cython``.
- **Maturity**. Mature and production-ready. Well-tested, documented, and supported.
The framework stands on the `PEP20 (The Zen of Python) <https://www.python.org/dev/peps/pep-0020/>`_ principle:
.. code-block:: plain
Explicit is better than implicit
You need to specify how to assemble and where to inject the dependencies explicitly.
The power of the framework is in its simplicity.
``Dependency Injector`` is a simple tool for the powerful concept.
.. disqus::

1997
docs/main/changelog.rst Normal file

File diff suppressed because it is too large Load Diff

8
docs/main/feedback.rst Normal file
View File

@ -0,0 +1,8 @@
Feedback
========
To post a question, bug report, a feature proposal or get some help open a
`Github Issue <https://github.com/ets-labs/python-dependency-injector/issues>`_ or leave a comment
below.
.. disqus::

View File

@ -0,0 +1,72 @@
.. _aggregate-provider:
Aggregate provider
==================
.. meta::
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Configuration,Injection,
Aggregate,Polymorphism,Environment Variable,Flexibility
:description: Aggregate provider aggregates other providers.
This page demonstrates how to implement the polymorphism and increase the
flexibility of your application using the Aggregate provider.
:py:class:`Aggregate` provider aggregates a group of other providers.
.. currentmodule:: dependency_injector.providers
.. literalinclude:: ../../examples/providers/aggregate.py
:language: python
:lines: 3-
:emphasize-lines: 24-27
Each provider in the ``Aggregate`` is associated with a key. You can call aggregated providers by providing
their key as a first argument. All positional and keyword arguments following the key will be forwarded to
the called provider:
.. code-block:: python
yaml_reader = container.config_readers("yaml", "./config.yml", foo=...)
You can also retrieve an aggregated provider by providing its key as an attribute name:
.. code-block:: python
yaml_reader = container.config_readers.yaml("./config.yml", foo=...)
To retrieve a dictionary of aggregated providers, use ``.providers`` attribute:
.. code-block:: python
container.config_readers.providers == {
"yaml": <YAML provider>,
"json": <JSON provider>,
}
.. note::
You can not override the ``Aggregate`` provider.
.. note::
When you inject the ``Aggregate`` provider, it is passed "as is".
To use non-string keys or string keys with ``.`` and ``-``, provide a dictionary as a positional argument:
.. code-block:: python
aggregate = providers.Aggregate({
SomeClass: providers.Factory(...),
"key.with.periods": providers.Factory(...),
"key-with-dashes": providers.Factory(...),
})
.. seealso::
:ref:`selector-provider` to make injections based on a configuration value, environment variable, or a result of a callable.
``Aggregate`` provider is different from the :ref:`selector-provider`. ``Aggregate`` provider doesn't select which provider
to inject and doesn't have a selector. It is a group of providers and is always injected "as is". The rest of the interface
of both providers is similar.
.. note::
``Aggregate`` provider is a successor of :ref:`factory-aggregate-provider` provider. ``Aggregate`` provider doesn't have
a restriction on the provider type, while ``FactoryAggregate`` aggregates only ``Factory`` providers.
.. disqus::

110
docs/providers/async.rst Normal file
View File

@ -0,0 +1,110 @@
.. _async-injections:
Asynchronous injections
=======================
.. meta::
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Providers,Async,Injections,Asynchronous,Await,
Asyncio
:description: Dependency Injector providers support asynchronous injections. This page
demonstrates how make asynchronous dependency injections in Python.
Providers support asynchronous injections.
.. literalinclude:: ../../examples/providers/async.py
:language: python
:emphasize-lines: 26-29
:lines: 3-
If provider has any awaitable injections it switches into async mode. In async mode provider always returns awaitable.
This causes a cascade effect:
.. code-block:: bash
provider1() <── Async mode enabled <──┐
│ │
├──> provider2() │
│ │
├──> provider3() <── Async mode enabled <──┤
│ │ │
│ └──> provider4() <── Async provider ───────┘
└──> provider5()
└──> provider6()
In async mode provider prepares injections asynchronously.
If provider has multiple awaitable dependencies, it will run them concurrently. Provider will wait until all
dependencies are ready and inject them afterwards.
.. code-block:: bash
provider1()
├──> provider2() <── Async mode enabled
├──> provider3() <── Async mode enabled
└──> provider4() <── Async mode enabled
Here is what provider will do for the previous example:
.. code-block:: python
injections = await asyncio.gather(
provider2(),
provider3(),
provider4(),
)
await provider1(*injections)
Overriding behaviour
--------------------
In async mode provider always returns awaitable. It applies to the overriding too. If provider in async mode is
overridden by a provider that doesn't return awaitable result, the result will be wrapped into awaitable.
.. literalinclude:: ../../examples/providers/async_overriding.py
:language: python
:emphasize-lines: 19-24
:lines: 3-
Async mode mechanics and API
----------------------------
By default provider's async mode is undefined.
When provider async mode is undefined, provider will automatically select the mode during the next call.
If the result is awaitable, provider will enable async mode, if not - disable it.
If provider async mode is enabled, provider always returns awaitable. If the result is not awaitable,
provider wraps it into awaitable explicitly. You can safely ``await`` provider in async mode.
If provider async mode is disabled, provider behaves the regular way. It doesn't do async injections
preparation or non-awaitables to awaitables conversion.
Once provider async mode is enabled or disabled, provider will stay in this state. No automatic switching
will be done.
.. image:: images/async_mode.png
You can also use following methods to change provider's async mode manually:
- ``Provider.enable_async_mode()``
- ``Provider.disable_async_mode()``
- ``Provider.reset_async_mode()``
To check the state of provider's async mode use:
- ``Provider.is_async_mode_enabled()``
- ``Provider.is_async_mode_disabled()``
- ``Provider.is_async_mode_undefined()``
See also:
- Wiring :ref:`async-injections-wiring`
- Resource provider :ref:`resource-async-initializers`
- :ref:`fastapi-redis-example`
.. disqus::

View File

@ -0,0 +1,20 @@
Callable provider
=================
.. meta::
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Function,Method,Example
:description: Callable provider helps to make dependencies injection into functions. This page
demonstrates how to use a Callable provider.
.. currentmodule:: dependency_injector.providers
:py:class:`Callable` provider calls a function, a method or another callable.
.. literalinclude:: ../../examples/providers/callable.py
:language: python
:lines: 3-
``Callable`` provider handles an injection of the dependencies the same way like a
:ref:`factory-provider`.
.. disqus::

View File

@ -0,0 +1,579 @@
.. _configuration-provider:
Configuration provider
======================
.. meta::
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Configuration,Injection,
Option,Ini,Json,Yaml,Pydantic,Dict,Environment Variable Interpolation,
Environment Variable Substitution,Environment Variable in Config,
Environment Variable in YAML file,Environment Variable in INI file,Default,Load,Read
:description: Configuration provides configuration options to the other providers. This page
demonstrates how to use Configuration provider to inject the dependencies, load
a configuration from an ini or yaml file, a dictionary, an environment variable,
or a pydantic settings object. This page also describes how to substitute (interpolate)
environment variables in YAML and INI configuration files.
.. currentmodule:: dependency_injector.providers
:py:class:`Configuration` provider provides configuration options to the other providers.
.. literalinclude:: ../../examples/providers/configuration/configuration.py
:language: python
:emphasize-lines: 7,12-13
:lines: 3-
It implements the principle "use first, define later".
.. contents::
:local:
:backlinks: none
Loading from an INI file
------------------------
``Configuration`` provider can load configuration from an ``ini`` file using the
:py:meth:`Configuration.from_ini` method:
.. literalinclude:: ../../examples/providers/configuration/configuration_ini.py
:language: python
:lines: 3-
:emphasize-lines: 12
where ``examples/providers/configuration/config.ini`` is:
.. literalinclude:: ../../examples/providers/configuration/config.ini
:language: ini
Alternatively, you can provide a path to the INI file over the configuration provider argument. In that case,
the container will call ``config.from_ini()`` automatically:
.. code-block:: python
:emphasize-lines: 3
class Container(containers.DeclarativeContainer):
config = providers.Configuration(ini_files=["./config.ini"])
if __name__ == "__main__":
container = Container() # Config is loaded from ./config.ini
:py:meth:`Configuration.from_ini` method supports environment variables interpolation.
.. code-block:: ini
[section]
option1 = ${ENV_VAR}
option2 = ${ENV_VAR}/path
option3 = ${ENV_VAR:default}
See also: :ref:`configuration-envs-interpolation`.
Loading from a YAML file
------------------------
``Configuration`` provider can load configuration from a ``yaml`` file using the
:py:meth:`Configuration.from_yaml` method:
.. literalinclude:: ../../examples/providers/configuration/configuration_yaml.py
:language: python
:lines: 3-
:emphasize-lines: 12
where ``examples/providers/configuration/config.yml`` is:
.. literalinclude:: ../../examples/providers/configuration/config.yml
:language: ini
Alternatively, you can provide a path to the YAML file over the configuration provider argument. In that case,
the container will call ``config.from_yaml()`` automatically:
.. code-block:: python
:emphasize-lines: 3
class Container(containers.DeclarativeContainer):
config = providers.Configuration(yaml_files=["./config.yml"])
if __name__ == "__main__":
container = Container() # Config is loaded from ./config.yml
:py:meth:`Configuration.from_yaml` method supports environment variables interpolation.
.. code-block:: ini
section:
option1: ${ENV_VAR}
option2: ${ENV_VAR}/path
option3: ${ENV_VAR:default}
See also: :ref:`configuration-envs-interpolation`.
:py:meth:`Configuration.from_yaml` method uses custom version of ``yaml.SafeLoader``.
To use another loader use ``loader`` argument:
.. code-block:: python
import yaml
container.config.from_yaml("config.yml", loader=yaml.UnsafeLoader)
.. note::
Loading of a yaml configuration requires ``PyYAML`` package.
You can install the ``Dependency Injector`` with an extra dependency::
pip install dependency-injector[yaml]
or install ``PyYAML`` directly::
pip install pyyaml
*Don't forget to mirror the changes in the requirements file.*
Loading from a JSON file
------------------------
``Configuration`` provider can load configuration from a ``json`` file using the
:py:meth:`Configuration.from_json` method:
.. literalinclude:: ../../examples/providers/configuration/configuration_json.py
:language: python
:lines: 3-
:emphasize-lines: 12
where ``examples/providers/configuration/config.json`` is:
.. literalinclude:: ../../examples/providers/configuration/config.json
:language: json
Alternatively, you can provide a path to a json file over the configuration provider argument. In that case,
the container will call ``config.from_json()`` automatically:
.. code-block:: python
:emphasize-lines: 3
class Container(containers.DeclarativeContainer):
config = providers.Configuration(json_files=["./config.json"])
if __name__ == "__main__":
container = Container() # Config is loaded from ./config.json
:py:meth:`Configuration.from_json` method supports environment variables interpolation.
.. code-block:: json
{
"section": {
"option1": "${ENV_VAR}",
"option2": "${ENV_VAR}/path",
"option3": "${ENV_VAR:default}"
}
}
See also: :ref:`configuration-envs-interpolation`.
Loading from a Pydantic settings
--------------------------------
``Configuration`` provider can load configuration from a ``pydantic_settings.BaseSettings`` object using the
:py:meth:`Configuration.from_pydantic` method:
.. literalinclude:: ../../examples/providers/configuration/configuration_pydantic.py
:language: python
:lines: 3-
:emphasize-lines: 32
To get the data from pydantic settings ``Configuration`` provider calls its ``model_dump()`` method.
If you need to pass an argument to this call, use ``.from_pydantic()`` keyword arguments.
.. code-block:: python
container.config.from_pydantic(Settings(), exclude={"optional"})
Alternatively, you can provide a ``pydantic_settings.BaseSettings`` object over the configuration provider argument. In that case,
the container will call ``config.from_pydantic()`` automatically:
.. code-block:: python
:emphasize-lines: 3
class Container(containers.DeclarativeContainer):
config = providers.Configuration(pydantic_settings=[Settings()])
if __name__ == "__main__":
container = Container() # Config is loaded from Settings()
.. note::
``Dependency Injector`` doesn't install ``pydantic-settings`` by default.
You can install the ``Dependency Injector`` with an extra dependency::
pip install dependency-injector[pydantic2]
or install ``pydantic-settings`` directly::
pip install pydantic-settings
*Don't forget to mirror the changes in the requirements file.*
.. note::
For backward-compatibility, Pydantic v1 is still supported.
Passing ``pydantic.BaseSettings`` instances will work just as fine as ``pydantic_settings.BaseSettings``.
Loading from a dictionary
-------------------------
``Configuration`` provider can load configuration from a Python ``dict`` using the
:py:meth:`Configuration.from_dict` method:
.. literalinclude:: ../../examples/providers/configuration/configuration_dict.py
:language: python
:lines: 3-
:emphasize-lines: 12-19
Loading from an environment variable
------------------------------------
``Configuration`` provider can load configuration from an environment variable using the
:py:meth:`Configuration.from_env` method:
.. literalinclude:: ../../examples/providers/configuration/configuration_env.py
:language: python
:lines: 3-
:emphasize-lines: 18-20
You can use ``as_`` argument for the type casting of an environment variable value:
.. code-block:: python
:emphasize-lines: 2,6,10
# API_KEY=secret
container.config.api_key.from_env("API_KEY", as_=str, required=True)
assert container.config.api_key() == "secret"
# SAMPLING_RATIO=0.5
container.config.sampling.from_env("SAMPLING_RATIO", as_=float, required=True)
assert container.config.sampling() == 0.5
# TIMEOUT undefined, default is used
container.config.timeout.from_env("TIMEOUT", as_=int, default=5)
assert container.config.timeout() == 5
Loading a value
---------------
``Configuration`` provider can load configuration value using the
:py:meth:`Configuration.from_value` method:
.. literalinclude:: ../../examples/providers/configuration/configuration_value.py
:language: python
:lines: 3-
:emphasize-lines: 14-15
Loading from the multiple sources
---------------------------------
``Configuration`` provider can load configuration from the multiple sources. Loaded
configuration is merged recursively over the existing configuration.
.. literalinclude:: ../../examples/providers/configuration/configuration_multiple.py
:language: python
:lines: 3-
:emphasize-lines: 12-13
where ``examples/providers/configuration/config.local.yml`` is:
.. literalinclude:: ../../examples/providers/configuration/config.local.yml
:language: ini
.. _configuration-envs-interpolation:
Using environment variables in configuration files
--------------------------------------------------
``Configuration`` provider supports environment variables interpolation in configuration files.
Use ``${ENV_NAME}`` in the configuration file to substitute value from environment
variable ``ENV_NAME``.
.. code-block:: ini
section:
option: ${ENV_NAME}
You can also specify a default value using ``${ENV_NAME:default}`` format. If environment
variable ``ENV_NAME`` is undefined, configuration provider will substitute value ``default``.
.. code-block:: ini
[section]
option = ${ENV_NAME:default}
If you'd like to specify a default value for environment variable inside of the application you can use
``os.environ.setdefault()``.
.. literalinclude:: ../../examples/providers/configuration/configuration_env_interpolation_os_default.py
:language: python
:lines: 3-
:emphasize-lines: 12
If environment variable is undefined and doesn't have a default, ``Configuration`` provider
will replace it with an empty value. This is a default behavior. To raise an error on
undefined environment variable that doesn't have a default value, pass argument
``envs_required=True`` to a configuration reading method:
.. code-block:: python
container.config.from_yaml("config.yml", envs_required=True)
See also: :ref:`configuration-strict-mode`.
.. note::
``Configuration`` provider makes environment variables interpolation before parsing. This preserves
original parser behavior. For instance, undefined environment variable in YAML configuration file
will be replaced with an empty value and then YAML parser will load the file.
Original configuration file:
.. code-block:: ini
section:
option: ${ENV_NAME}
Configuration file after interpolation where ``ENV_NAME`` is undefined:
.. code-block:: ini
section:
option:
Configuration provider after parsing interpolated YAML file contains ``None`` in
option ``section.option``:
.. code-block:: python
assert container.config.section.option() is None
If you want to disable environment variables interpolation, pass ``envs_required=None``:
.. code-block:: yaml
:caption: templates.yml
template_string: 'Hello, ${name}!'
.. code-block:: python
>>> container.config.from_yaml("templates.yml", envs_required=None)
>>> container.config.template_string()
'Hello, ${name}!'
Mandatory and optional sources
------------------------------
By default, methods ``.from_yaml()`` and ``.from_ini()`` ignore errors if configuration file does not exist.
You can use this to specify optional configuration files.
If configuration file is mandatory, use ``required`` argument. Configuration provider will raise an error
if required file does not exist.
You can also use ``required`` argument when loading configuration from dictionaries and environment variables.
Mandatory YAML file:
.. code-block:: python
container.config.from_yaml("config.yaml", required=True)
Mandatory INI file:
.. code-block:: python
container.config.from_ini("config.ini", required=True)
Mandatory dictionary:
.. code-block:: python
container.config.from_dict(config_dict, required=True)
Mandatory environment variable:
.. code-block:: python
container.config.api_key.from_env("API_KEY", required=True)
See also: :ref:`configuration-strict-mode`.
Specifying the value type
-------------------------
You can specify the type of the injected configuration value explicitly.
This helps when you read the value from an ini file or an environment variable and need to
convert it into an ``int`` or a ``float``.
.. literalinclude:: ../../examples/providers/configuration/configuration_type.py
:language: python
:lines: 3-
:emphasize-lines: 19
``Configuration`` provider has next helper methods:
- ``.as_int()``
- ``.as_float()``
- ``.as_(callback, *args, **kwargs)``
The last method ``.as_(callback, *args, **kwargs)`` helps to implement other conversions.
.. literalinclude:: ../../examples/providers/configuration/configuration_type_custom.py
:language: python
:lines: 3-
:emphasize-lines: 18
With the ``.as_(callback, *args, **kwargs)`` you can specify a function that will be called
before the injection. The value from the config will be passed as a first argument. The returned
value will be injected. Parameters ``*args`` and ``**kwargs`` are handled as any other injections.
.. _configuration-strict-mode:
Strict mode and required options
--------------------------------
You can use configuration provider in strict mode. In strict mode configuration provider raises an error
on access to any undefined option.
.. literalinclude:: ../../examples/providers/configuration/configuration_strict.py
:language: python
:lines: 3-
:emphasize-lines: 12
Methods ``.from_*()`` in strict mode raise an exception if configuration file does not exist or
configuration data is undefined:
.. code-block:: python
:emphasize-lines: 10,15,20,25,30
class Container(containers.DeclarativeContainer):
config = providers.Configuration(strict=True)
if __name__ == "__main__":
container = Container()
try:
container.config.from_yaml("does-not_exist.yml") # raise exception
except FileNotFoundError:
...
try:
container.config.from_ini("does-not_exist.ini") # raise exception
except FileNotFoundError:
...
try:
container.config.from_pydantic(EmptySettings()) # raise exception
except ValueError:
...
try:
container.config.from_env("UNDEFINED_ENV_VAR") # raise exception
except ValueError:
...
try:
container.config.from_dict({}) # raise exception
except ValueError:
...
Environment variables interpolation in strict mode raises an exception when encounters
an undefined environment variable without a default value.
.. code-block:: ini
section:
option: ${UNDEFINED}
.. code-block:: python
try:
container.config.from_yaml("undefined_env.yml") # raise exception
except ValueError:
...
You can override ``.from_*()`` methods behaviour in strict mode using ``required`` argument:
.. code-block:: python
class Container(containers.DeclarativeContainer):
config = providers.Configuration(strict=True)
if __name__ == "__main__":
container = Container()
container.config.from_yaml("config.yml")
container.config.from_yaml("config.local.yml", required=False)
You can also use ``.required()`` option modifier when making an injection. It does not require to switch
configuration provider to strict mode.
.. literalinclude:: ../../examples/providers/configuration/configuration_required.py
:language: python
:lines: 11-20
:emphasize-lines: 8-9
.. note::
Modifier ``.required()`` should be specified before type modifier ``.as_*()``.
Aliases
-------
You can use ``Configuration`` provider with a context manager to create aliases.
.. literalinclude:: ../../examples/providers/configuration/configuration_alias.py
:language: python
:lines: 3-
:emphasize-lines: 14,22
.. note::
Library ``environs`` is a 3rd party library. You need to install it
separately::
pip install environs
Documentation is available on GitHub: https://github.com/sloria/environs
Injecting invariants
--------------------
You can inject invariant configuration options based on the value of the other configuration
option.
To use that you should provide the switch-value as an item of the configuration option that
contains sections ``config.options[config.switch]``:
- When the value of the ``config.switch`` is ``A``, the ``config.options.A`` is injected
- When the value of the ``config.switch`` is ``B``, the ``config.options.B`` is injected
.. literalinclude:: ../../examples/providers/configuration/configuration_itemselector.py
:language: python
:lines: 3-
:emphasize-lines: 15,30-31,38
.. disqus::

View File

@ -0,0 +1,27 @@
Coroutine provider
==================
.. meta::
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Coroutine,Asynchronous,
Asyncio,Example
:description: Coroutine provider creates a coroutine. This page demonstrates how to use a
Coroutine provider.
.. currentmodule:: dependency_injector.providers
:py:class:`Coroutine` provider creates a coroutine.
.. literalinclude:: ../../examples/providers/coroutine.py
:language: python
:lines: 3-
.. note::
The example works on Python 3.7+. For earlier versions use ``loop.run_until_complete()``.
``Coroutine`` provider handles an injection of the dependencies the same way like a
:ref:`factory-provider`.
.. note::
``Coroutine`` provider returns ``True`` for ``asyncio.iscoroutinefunction()`` check.
.. disqus::

49
docs/providers/custom.rst Normal file
View File

@ -0,0 +1,49 @@
.. _create-provider:
Creating a custom provider
==========================
.. meta::
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Custom provider, Create
:description: This page demonstrates how to create a custom provider.
.. currentmodule:: dependency_injector.providers
You can create a custom provider.
To create a custom provider you need to follow these rules:
1. New provider class should inherit :py:class:`Provider`.
2. You need to implement the ``Provider._provide()`` method.
3. You need to implement the ``Provider.__deepcopy__()`` method. It should return an
equivalent copy of a provider. All providers must be copied with the ``deepcopy()`` function
from the ``providers`` module. It's essential to pass ``memo`` into ``deepcopy`` in order to keep
the preconfigured ``args`` and ``kwargs`` of stored providers. After the a new provider object
is created, use ``Provider._copy_overriding()`` method to copy all overriding providers. See the
example below.
4. If new provider has a ``__init__()`` method, it should call the parent
``Provider.__init__()``.
5. If new provider stores any other providers, these providers should be listed in
``.related`` property. Property ``.related`` also should yield providers from parent
``.related`` property.
.. literalinclude:: ../../examples/providers/custom_factory.py
:language: python
:lines: 3-
.. note::
1. Prefer delegation over inheritance. If you choose between inheriting a ``Factory`` or
inheriting a ``Provider`` and use ``Factory`` internally - the last is better.
2. When creating a new provider follow the ``Factory``-like injections style. Consistency matters.
3. Use the ``__slots__`` attribute to make sure nothing could be attached to your provider. You
will also save some memory.
.. note::
If you don't find needed provider in the ``providers`` module and experience troubles creating
one by your own - open a
`Github Issue <https://github.com/ets-labs/python-dependency-injector/issues>`_.
I'll help you to resolve the issue if that's possible. If the new provider can be useful for
others I'll include it into the ``providers`` module.
.. disqus::

View File

@ -0,0 +1,38 @@
.. _dependency-provider:
Dependency provider
===================
.. currentmodule:: dependency_injector.providers
:py:class:`Dependency` provider is a placeholder for a dependency of a certain type.
To specify a type of the dependency use ``instance_of`` argument: ``Dependency(instance_of=SomeClass)``.
Dependency provider will control that returned object is an instance of ``instance_of`` type.
.. literalinclude:: ../../examples/providers/dependency.py
:language: python
:lines: 3-
:emphasize-lines: 26,35-36
To provide a dependency you need to override the ``Dependency`` provider. You can call
provider ``.override()`` method or provide an overriding provider when creating a container.
See :ref:`provider-overriding`. If you don't provide a dependency, ``Dependency`` provider
will raise an error:
.. literalinclude:: ../../examples/providers/dependency_undefined_error.py
:language: python
:lines: 18-
You also can provide a default for the dependency. To provide a default use ``default`` argument:
``Dependency(..., default=...)``. Default can be a value or a provider. If default is not a provider,
dependency provider will wrap it into the ``Object`` provider.
.. literalinclude:: ../../examples/providers/dependency_default.py
:language: python
:lines: 16-23
:emphasize-lines: 3
See also: :ref:`check-container-dependencies`.
.. disqus::

37
docs/providers/dict.rst Normal file
View File

@ -0,0 +1,37 @@
Dict provider
=============
.. meta::
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Dict,Injection
:description: Dict provider helps to inject a dictionary of the dependencies. This page demonstrates
how to use Dict provider.
.. currentmodule:: dependency_injector.providers
:py:class:`Dict` provider provides a dictionary of values.
.. literalinclude:: ../../examples/providers/dict.py
:language: python
:lines: 3-
:emphasize-lines: 21-24
``Dict`` provider handles keyword arguments the same way as a :ref:`factory-provider`.
To use non-string keys or keys with ``.`` and ``-`` provide a dictionary as a positional argument:
.. code-block:: python
providers.Dict({
SomeClass: providers.Factory(...),
"key.with.periods": providers.Factory(...),
"key-with-dashes": providers.Factory(...),
})
Example:
.. literalinclude:: ../../examples/providers/dict_non_string_keys.py
:language: python
:lines: 3-
:emphasize-lines: 40-43
.. disqus::

242
docs/providers/factory.rst Normal file
View File

@ -0,0 +1,242 @@
.. _factory-provider:
Factory provider
================
.. meta::
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Factory,Abstract Factory,
Pattern,Example,Aggregate
:description: Factory provider helps to implement dependency injection in Python. This page
demonstrates how to use Factory provider, inject the dependencies, and assemble
object graphs passing the injections deep inside. It also provides the examples
of the Abstract Factory pattern & provider and Factories Aggregation pattern.
.. currentmodule:: dependency_injector.providers
:py:class:`Factory` provider creates new objects.
.. literalinclude:: ../../examples/providers/factory.py
:language: python
:lines: 3-
The first argument of the ``Factory`` provider is a class, a factory function or a method
that creates an object.
The rest of the ``Factory`` positional and keyword arguments are the dependencies.
``Factory`` injects the dependencies every time when creates a new object. The dependencies are
injected following these rules:
+ If the dependency is a provider, this provider is called and the result of the call is injected.
+ If you need to inject the provider itself, you should use the ``.provider`` attribute. More at
:ref:`factory_providers_delegation`.
+ All other dependencies are injected *"as is"*.
+ Positional context arguments are appended after ``Factory`` positional dependencies.
+ Keyword context arguments have the priority over the ``Factory`` keyword dependencies with the
same name.
.. image:: images/factory_init_injections.png
.. literalinclude:: ../../examples/providers/factory_init_injections.py
:language: python
:lines: 3-
``Factory`` provider can inject attributes. Use ``.add_attributes()`` method to specify
attribute injections.
.. literalinclude:: ../../examples/providers/factory_attribute_injections.py
:language: python
:lines: 3-
:emphasize-lines: 18-18
Passing arguments to the underlying providers
---------------------------------------------
``Factory`` provider can pass the arguments to the underlying providers. This helps when you need
to assemble a nested objects graph and pass the arguments deep inside.
Consider the example:
.. image:: images/factory_init_injections_underlying.png
To create an ``Algorithm`` you need to provide all the dependencies: ``ClassificationTask``,
``Loss``, and ``Regularizer``. The last object in the chain, the ``Regularizer`` has a dependency
on the ``alpha`` value. The ``alpha`` value varies from algorithm to algorithm:
.. code-block:: python
Algorithm(
task=ClassificationTask(
loss=Loss(
regularizer=Regularizer(
alpha=alpha, # <-- the dependency
),
),
),
)
``Factory`` provider helps to deal with the such assembly. You need to create the factories for
all the classes and use special double-underscore ``__`` syntax for passing the ``alpha`` argument:
.. literalinclude:: ../../examples/providers/factory_init_injections_underlying.py
:language: python
:lines: 3-
:emphasize-lines: 44,49
When you use ``__`` separator in the name of the keyword argument the ``Factory`` looks for
the dependency with the same name as the left part of the ``__`` expression.
.. code-block:: none
<dependency>__<keyword for the underlying provider>=<value>
If ``<dependency>`` is found the underlying provider will receive the
``<keyword for the underlying provider>=<value>`` as an argument.
.. _factory_providers_delegation:
Passing providers to the objects
--------------------------------
When you need to inject the provider itself, but not the result of its call, use the ``.provider``
attribute of the provider that you're going to inject.
.. image:: images/factory_delegation.png
.. literalinclude:: ../../examples/providers/factory_delegation.py
:language: python
:lines: 3-
:emphasize-lines: 28
.. note:: Any provider has a ``.provider`` attribute.
.. _factory-string-imports:
String imports
--------------
``Factory`` provider can handle string imports:
.. code-block:: python
class Container(containers.DeclarativeContainer):
service = providers.Factory("myapp.mypackage.mymodule.Service")
You can also make a relative import:
.. code-block:: python
# in myapp/container.py
class Container(containers.DeclarativeContainer):
service = providers.Factory(".mypackage.mymodule.Service")
or import a member of the current module just specifying its name:
.. code-block:: python
class Service:
...
class Container(containers.DeclarativeContainer):
service = providers.Factory("Service")
.. note::
``Singleton``, ``Callable``, ``Resource``, and ``Coroutine`` providers handle string imports
the same way as a ``Factory`` provider.
.. _factory-specialize-provided-type:
Specializing the provided type
------------------------------
You can create a specialized ``Factory`` provider that provides only specific type. For doing
this you need to create a subclass of the ``Factory`` provider and define the ``provided_type``
class attribute.
.. literalinclude:: ../../examples/providers/factory_provided_type.py
:language: python
:lines: 3-
:emphasize-lines: 12-14
.. _abstract-factory:
Abstract factory
----------------
:py:class:`AbstractFactory` provider helps when you need to create a provider of some base class
and the particular implementation is not yet know. ``AbstractFactory`` provider is a ``Factory``
provider with two peculiarities:
+ Provides only objects of a specified type.
+ Must be overridden before usage.
.. image:: images/abstract_factory.png
:width: 100%
:align: center
.. literalinclude:: ../../examples/providers/abstract_factory.py
:language: python
:lines: 3-
:emphasize-lines: 34
.. _factory-aggregate-provider:
Factory aggregate
-----------------
:py:class:`FactoryAggregate` provider aggregates multiple factories.
.. seealso::
:ref:`aggregate-provider` it's a successor of ``FactoryAggregate`` provider that can aggregate
any type of provider, not only ``Factory``.
The aggregated factories are associated with the string keys. When you call the
``FactoryAggregate`` you have to provide one of the these keys as a first argument.
``FactoryAggregate`` looks for the factory with a matching key and calls it with the rest of the arguments.
.. image:: images/factory_aggregate.png
:width: 100%
:align: center
.. literalinclude:: ../../examples/providers/factory_aggregate.py
:language: python
:lines: 3-
:emphasize-lines: 33-37,47
You can get a dictionary of the aggregated providers using ``.providers`` attribute.
To get a game provider dictionary from the previous example you can use
``game_factory.providers`` attribute.
You can also access an aggregated factory as an attribute. To create the ``Chess`` object from the
previous example you can do ``chess = game_factory.chess("John", "Jane")``.
.. note::
You can not override the ``FactoryAggregate`` provider.
.. note::
When you inject the ``FactoryAggregate`` provider it is passed "as is".
To use non-string keys or string keys with ``.`` and ``-``, you can provide a dictionary as a positional argument:
.. code-block:: python
providers.FactoryAggregate({
SomeClass: providers.Factory(...),
"key.with.periods": providers.Factory(...),
"key-with-dashes": providers.Factory(...),
})
Example:
.. literalinclude:: ../../examples/providers/factory_aggregate_non_string_keys.py
:language: python
:lines: 3-
:emphasize-lines: 30-33,39-40
.. disqus::

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

57
docs/providers/index.rst Normal file
View File

@ -0,0 +1,57 @@
.. _providers:
Providers
=========
Providers help to assemble the objects. They create objects and inject the dependencies.
Each provider is a callable. You call the provider like a function when you need to create an
object. Provider retrieves the underlying dependencies and inject them into the created object.
It causes the cascade effect that helps to assemble object graphs. See ``Factory``, ``Singleton``,
``Callable`` and other provider docs below.
.. code-block:: bash
provider1()
├──> provider2()
├──> provider3()
│ │
│ └──> provider4()
└──> provider5()
└──> provider6()
Another providers feature is an overriding. You can override any provider with another provider.
This helps in testing. This also helps in overriding API clients with stubs for the development
or staging environment. See the example at :ref:`provider-overriding`.
If you need to inject not the whole object but the parts see :ref:`provided-instance`.
To create a new provider see :ref:`create-provider`.
Providers module API docs - :py:mod:`dependency_injector.providers`
.. toctree::
:maxdepth: 2
factory
singleton
callable
coroutine
object
list
dict
configuration
resource
aggregate
selector
dependency
overriding
provided_instance
inject_self
custom
async
typing_mypy

View File

@ -0,0 +1,20 @@
Injecting container "self"
==========================
You can inject container "self" into container providers.
.. literalinclude:: ../../examples/containers/inject_self.py
:language: python
:lines: 3-
:emphasize-lines: 20, 26
To inject container "self" you need to define ``Self`` provider. Container can have only one ``Self`` provider.
Usually you will use name ``__self__``.
You can also use different name. When you use different name container will also reference
defined ``Self`` provider in ``.__self__`` attribute.
Provider ``Self`` is not listed in container ``.providers`` attributes.
.. disqus::

23
docs/providers/list.rst Normal file
View File

@ -0,0 +1,23 @@
List provider
=============
.. meta::
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,List,Injection
:description: List provider helps to inject a list of the dependencies. This page demonstrates
how to use a List provider.
.. currentmodule:: dependency_injector.providers
:py:class:`List` provider provides a list of values.
.. literalinclude:: ../../examples/providers/list.py
:language: python
:lines: 3-
:emphasize-lines: 21-24
``List`` provider handles positional arguments the same way as a :ref:`factory-provider`.
.. note::
Keyword argument are not supported.
.. disqus::

17
docs/providers/object.rst Normal file
View File

@ -0,0 +1,17 @@
Object provider
===============
.. meta::
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Object
:description: Object provider provides an object "as is". This page demonstrates how to use an
Object provider.
.. currentmodule:: dependency_injector.providers
:py:class:`Object` provider returns an object "as is".
.. literalinclude:: ../../examples/providers/object.py
:language: python
:lines: 3-
.. disqus::

View File

@ -0,0 +1,43 @@
.. _provider-overriding:
Provider overriding
===================
.. meta::
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Override,Test,Unit
:description: This page demonstrates how to implement providers overriding. This helps in
testing and configuring the system for the multiple environments.
.. currentmodule:: dependency_injector.providers
You can override any provider with another provider.
When provider is overridden it calls to the overriding provider instead of providing
the object by its own.
This helps in testing. This also helps in overriding API clients with stubs for the development
or staging environment.
To override a provider you need to call the ``Provider.override()`` method. This method receives
a single argument called ``overriding``. If the ``overriding`` value is a provider, this provider
is called instead of the original. If value is not a provider, this value is returned instead of
calling the original provider.
.. image:: images/overriding.png
:width: 80%
:align: center
.. literalinclude:: ../../examples/providers/overriding.py
:language: python
:lines: 3-
You can override a provider multiple times. In that case the latest ``overriding`` value will be
used. The rest of the overriding values will form a stack.
To reset an overriding you can use the ``Provider.reset_override()`` or
``Provider.reset_last_overriding()`` methods.
You can use a context manager for overriding a provider ``with Provider.override():``. The
overriding will be reset when context closed.
.. disqus::

View File

@ -0,0 +1,38 @@
.. _provided-instance:
Injecting provided object attributes, items, or call its methods
================================================================
.. meta::
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Attribute,Method,Call
:description: This page demonstrates how to inject attributes, items or call method of the
provided instance.
.. currentmodule:: dependency_injector.providers
You can inject provided object attribute, item or result of its method call.
.. literalinclude:: ../../examples/providers/provided_instance.py
:language: python
:emphasize-lines: 28-34
:lines: 3-
To use the feature you should use the ``.provided`` attribute of the injected provider. This
attribute helps to specify what happens with the provided instance before the injection. You can
use any combination of the following:
- an attribute of the provided object
- an item of the provided object
- a call of the provided object method
When you use a call of the provided instance method you can specify the injections for this
method like you do with any other provider.
You can do nested constructions:
.. literalinclude:: ../../examples/providers/provided_instance_complex.py
:language: python
:emphasize-lines: 26-32
:lines: 3-
.. disqus::

362
docs/providers/resource.rst Normal file
View File

@ -0,0 +1,362 @@
.. _resource-provider:
Resource provider
=================
.. meta::
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Resource,Injection,
Logging,Event Loop,Thread Pool
:description: Resource provider provides a component with initialization and shutdown. It works
well for configuring logging, event loop, thread or process pool, etc.
This page demonstrates how to use resource provider.
.. currentmodule:: dependency_injector.providers
:py:class:`Resource` provider provides a component with initialization and shutdown.
.. literalinclude:: ../../examples/providers/resource.py
:language: python
:lines: 3-
Resource providers help to initialize and configure logging, event loop, thread or process pool, etc.
Resource provider is similar to ``Singleton``. Resource initialization happens only once.
You can make injections and use provided instance the same way like you do with any other provider.
.. code-block:: python
:emphasize-lines: 12
class Container(containers.DeclarativeContainer):
config = providers.Configuration()
thread_pool = providers.Resource(
init_thread_pool,
max_workers=config.max_workers,
)
dispatcher = providers.Factory(
TaskDispatcher,
executor=thread_pool,
)
Container has an interface to initialize and shutdown all resources at once:
.. code-block:: python
container = Container()
container.init_resources()
container.shutdown_resources()
You can also initialize and shutdown resources one-by-one using ``init()`` and
``shutdown()`` methods of the provider:
.. code-block:: python
container = Container()
container.thread_pool.init()
container.thread_pool.shutdown()
When you call ``.shutdown()`` method on a resource provider, it will remove the reference to the initialized resource,
if any, and switch to uninitialized state. Some of resource initializer types support specifying custom
resource shutdown.
Resource provider supports 3 types of initializers:
- Function
- Generator
- Subclass of ``resources.Resource``
Function initializer
--------------------
Function is the most common way to specify resource initialization:
.. code-block:: python
def init_resource(argument1=..., argument2=...):
return SomeResource()
class Container(containers.DeclarativeContainer):
resource = providers.Resource(
init_resource,
argument1=...,
argument2=...,
)
Function initializer may not return a value. This often happens when
you configure global resource:
.. code-block:: python
import logging.config
class Container(containers.DeclarativeContainer):
configure_logging = providers.Resource(
logging.config.fileConfig,
fname="logging.ini",
)
Function initializer does not provide a way to specify custom resource shutdown.
Generator initializer
---------------------
Resource provider can use 2-step generators:
- First step of generator is an initialization phase
- The second is step is a shutdown phase
.. code-block:: python
def init_resource(argument1=..., argument2=...):
resource = SomeResource() # initialization
yield resource
# shutdown
...
class Container(containers.DeclarativeContainer):
resource = providers.Resource(
init_resource,
argument1=...,
argument2=...,
)
Generator initialization phase ends on the first ``yield`` statement. You can return a
resource object using ``yield resource`` like in the example above. Returning of the
object is not mandatory. You can leave ``yield`` statement empty:
.. code-block:: python
def init_resource(argument1=..., argument2=...):
# initialization
...
yield
# shutdown
...
class Container(containers.DeclarativeContainer):
resource = providers.Resource(
init_resource,
argument1=...,
argument2=...,
)
Subclass initializer
--------------------
You can create resource initializer by implementing a subclass of the ``resources.Resource``:
.. code-block:: python
from dependency_injector import resources
class MyResource(resources.Resource):
def init(self, argument1=..., argument2=...) -> SomeResource:
return SomeResource()
def shutdown(self, resource: SomeResource) -> None:
# shutdown
...
class Container(containers.DeclarativeContainer):
resource = providers.Resource(
MyResource,
argument1=...,
argument2=...,
)
Subclass must implement two methods: ``init()`` and ``shutdown()``.
Method ``init()`` receives arguments specified in resource provider.
It performs initialization and returns resource object. Returning of the object
is not mandatory.
Method ``shutdown()`` receives resource object returned from ``init()``. If ``init()``
didn't return an object ``shutdown()`` method will be called anyway with ``None`` as a
first argument.
.. code-block:: python
from dependency_injector import resources
class MyResource(resources.Resource):
def init(self, argument1=..., argument2=...) -> None:
# initialization
...
def shutdown(self, _: None) -> None:
# shutdown
...
.. _resource-provider-wiring-closing:
Resources, wiring, and per-function execution scope
---------------------------------------------------
You can compound ``Resource`` provider with :ref:`wiring` to implement per-function
execution scope. For doing this you need to use additional ``Closing`` marker from
``wiring`` module.
.. literalinclude:: ../../examples/wiring/flask_resource_closing.py
:language: python
:lines: 3-
:emphasize-lines: 22
Framework initializes and injects the resource into the function. With the ``Closing`` marker
framework calls resource ``shutdown()`` method when function execution is over.
The example above produces next output:
.. code-block:: bash
Init service
Shutdown service
127.0.0.1 - - [29/Oct/2020 22:39:40] "GET / HTTP/1.1" 200 -
Init service
Shutdown service
127.0.0.1 - - [29/Oct/2020 22:39:41] "GET / HTTP/1.1" 200 -
Init service
Shutdown service
127.0.0.1 - - [29/Oct/2020 22:39:41] "GET / HTTP/1.1" 200 -
.. _resource-async-initializers:
Asynchronous initializers
-------------------------
When you write an asynchronous application, you might need to initialize resources asynchronously. Resource
provider supports asynchronous initialization and shutdown.
Asynchronous function initializer:
.. code-block:: python
async def init_async_resource(argument1=..., argument2=...):
return await connect()
class Container(containers.DeclarativeContainer):
resource = providers.Resource(
init_resource,
argument1=...,
argument2=...,
)
Asynchronous generator initializer:
.. code-block:: python
async def init_async_resource(argument1=..., argument2=...):
connection = await connect()
yield connection
await connection.close()
class Container(containers.DeclarativeContainer):
resource = providers.Resource(
init_async_resource,
argument1=...,
argument2=...,
)
Asynchronous subclass initializer:
.. code-block:: python
from dependency_injector import resources
class AsyncConnection(resources.AsyncResource):
async def init(self, argument1=..., argument2=...):
yield await connect()
async def shutdown(self, connection):
await connection.close()
class Container(containers.DeclarativeContainer):
resource = providers.Resource(
AsyncConnection,
argument1=...,
argument2=...,
)
When you use resource provider with asynchronous initializer you need to call its ``__call__()``,
``init()``, and ``shutdown()`` methods asynchronously:
.. code-block:: python
import asyncio
class Container(containers.DeclarativeContainer):
connection = providers.Resource(init_async_connection)
async def main():
container = Container()
connection = await container.connection()
connection = await container.connection.init()
connection = await container.connection.shutdown()
if __name__ == "__main__":
asyncio.run(main())
Container ``init_resources()`` and ``shutdown_resources()`` methods should be used asynchronously if there is
at least one asynchronous resource provider:
.. code-block:: python
import asyncio
class Container(containers.DeclarativeContainer):
connection1 = providers.Resource(init_async_connection)
connection2 = providers.Resource(init_sync_connection)
async def main():
container = Container()
await container.init_resources()
await container.shutdown_resources()
if __name__ == "__main__":
asyncio.run(main())
See also:
- Provider :ref:`async-injections`
- Wiring :ref:`async-injections-wiring`
- :ref:`fastapi-redis-example`
.. disqus::

View File

@ -0,0 +1,36 @@
.. _selector-provider:
Selector provider
=================
.. meta::
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Configuration,Injection,
Selector,Polymorphism,Environment Variable,Flexibility
:description: Selector selects provider based on a configuration value or another callable.
This page demonstrates how to implement the polymorphism and increase the
flexibility of your application using the Selector provider.
.. currentmodule:: dependency_injector.providers
:py:class:`Selector` provider selects provider based on a configuration value or another callable.
.. literalinclude:: ../../examples/providers/selector.py
:language: python
:lines: 3-
:emphasize-lines: 16-20
The first argument of the ``Selector`` provider is called ``selector``. It can be an option of
a ``Configuration`` provider or any other callable. The ``selector`` callable has to return a
string value. This value is used as a key for selecting the provider.
The providers are provided as keyword arguments. Argument name is used as a key for selecting the
provider.
When a ``Selector`` provider is called, it gets a ``selector`` value and delegates the work to
the provider with a matching name. The ``selector`` callable works as a switch: when the returned
value is changed the ``Selector`` provider will delegate the work to another provider.
.. seealso::
:ref:`aggregate-provider` to inject a group of providers.
.. disqus::

View File

@ -0,0 +1,140 @@
.. _singleton-provider:
Singleton provider
==================
.. meta::
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Singleton,Pattern,Example,
Threads,Multithreading,Scoped
:description: Singleton provider helps to provide a single object. This page
demonstrates how to use a Singleton provider. It also provides the example
of using a singleton and thread locals singleton in the multi-threaded
environment.
.. currentmodule:: dependency_injector.providers
:py:class:`Singleton` provider provides single object. It memorizes the first created object and
returns it on the rest of the calls.
.. literalinclude:: ../../examples/providers/singleton.py
:language: python
:lines: 3-
``Singleton`` provider handles dependencies injection the same way like a :ref:`factory-provider`.
.. note::
``Singleton`` provider makes dependencies injection only when it creates an object. When an object
is created and memorized ``Singleton`` provider just returns it without applying injections.
Specialization of the provided type and abstract singletons work the same like like for the
factories:
- :ref:`factory-specialize-provided-type`
- :ref:`abstract-factory`
``Singleton`` provider scope is tied to the container. Two different containers will provider
two different singleton objects:
.. literalinclude:: ../../examples/providers/singleton_multiple_containers.py
:language: python
:lines: 3-
Resetting memorized object
--------------------------
To reset a memorized object you need to call the ``.reset()`` method of the ``Singleton``
provider.
.. literalinclude:: ../../examples/providers/singleton_resetting.py
:language: python
:lines: 3-
:emphasize-lines: 18
.. note::
Resetting of the memorized object clears the reference to it. Further object's lifecycle is
managed by the garbage collector.
You can use ``.reset()`` method with a context manager. Memorized instance will be reset on
both entering and exiting a context.
.. literalinclude:: ../../examples/providers/singleton_resetting_with.py
:language: python
:lines: 3-
:emphasize-lines: 18-19
Context manager ``.reset()`` returns resetting singleton provider. You can use it for aliasing.
.. code-block:: python
with container.user_service.reset() as user_service:
...
Method ``.reset()`` resets only current provider. To reset all dependent singleton providers
call ``.full_reset()`` method.
.. literalinclude:: ../../examples/providers/singleton_full_resetting.py
:language: python
:lines: 3-
:emphasize-lines: 25
Method ``.full_reset()`` supports context manager interface like ``.reset()`` does.
.. code-block:: python
with container.user_service.full_reset() as user_service:
...
See also: :ref:`reset-container-singletons`.
Using singleton with multiple threads
-------------------------------------
``Singleton`` provider is NOT thread-safe. You need to explicitly establish a synchronization for
using the ``Singleton`` provider in the multi-threading application. Otherwise you could trap
into the race condition problem: ``Singleton`` will create multiple objects.
There are two thread-safe singleton implementations out of the box:
+ :py:class:`ThreadSafeSingleton` - is a thread-safe version of a ``Singleton`` provider. You can use
in multi-threading applications without additional synchronization.
+ :py:class:`ThreadLocalSingleton` - is a singleton provider that uses thread-locals as a storage.
This type of singleton will manage multiple objects - the one object for the one thread.
.. literalinclude:: ../../examples/providers/singleton_thread_locals.py
:language: python
:lines: 3-
:emphasize-lines: 13,15
Implementing scopes
-------------------
To implement a scoped singleton provider use a ``Singleton`` provider and reset its scope when
needed.
.. literalinclude:: ../../examples/providers/singleton_scoped.py
:language: python
:lines: 3-
The output should look like this (each request a ``Service`` object has a different address):
.. code-block:: bash
* Serving Flask app "singleton_scoped" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
<__main__.Service object at 0x1099a9d90>
127.0.0.1 - - [25/Aug/2020 17:33:11] "GET / HTTP/1.1" 200 -
<__main__.Service object at 0x1099a9cd0>
127.0.0.1 - - [25/Aug/2020 17:33:17] "GET / HTTP/1.1" 200 -
<__main__.Service object at 0x1099a9d00>
127.0.0.1 - - [25/Aug/2020 17:33:18] "GET / HTTP/1.1" 200 -
<__main__.Service object at 0x1099a9e50>
127.0.0.1 - - [25/Aug/2020 17:33:18] "GET / HTTP/1.1" 200 -
<__main__.Service object at 0x1099a9d90>
127.0.0.1 - - [25/Aug/2020 17:33:18] "GET / HTTP/1.1" 200 -
.. disqus::

View File

@ -0,0 +1,60 @@
.. _provider-typing:
Typing and mypy
===============
.. meta::
:keywords: Python,DI,Dependency injection,IoC,Inversion of Control,Providers,Typing,Mypy,
Pattern,Example
:description: Dependency Injector providers are mypy-friendly. Providers module goes with the
typing stubs to provide the typing information to ``mypy``, IDEs and editors.
Providers are ``mypy``-friendly.
Providers module goes with the typing stubs. It provides typing information to ``mypy`` and your
IDE.
.. code-block:: python
from dependency_injector import providers
class Animal:
...
class Cat(Animal)
...
provider = providers.Factory(Cat)
if __name__ == "__main__":
animal = provider() # mypy knows that animal is of type "Cat"
You can use ``Provider`` as a generic type. This helps when a provider is an argument of a
function or method.
.. code-block:: python
:emphasize-lines: 12
from dependency_injector import providers
class Animal:
...
class Cat(Animal)
...
provider: providers.Provider[Animal] = providers.Factory(Cat)
if __name__ == "__main__":
animal = provider() # mypy knows that animal is of type "Animal"
.. disqus::

7
docs/sponsor.rst Normal file
View File

@ -0,0 +1,7 @@
.. list-table::
:class: no-border
:align: left
* - Sponsor the project on GitHub:
- .. raw:: html
:file: _static/sponsor.html

864
docs/tutorials/aiohttp.rst Normal file
View File

@ -0,0 +1,864 @@
.. _aiohttp-tutorial:
Aiohttp tutorial
================
.. meta::
:keywords: Python,Aiohttp,Tutorial,Education,Web,API,REST API,Example,DI,Dependency injection,
IoC,Inversion of control,Refactoring,Tests,Unit tests,Pytest,py.test,Bootstrap,
HTML,CSS
:description: This tutorial shows how to build an aiohttp application following the dependency
injection principle. You will create the REST API application, connect to the
Giphy API, cover it with the unit test and make some refactoring.
This tutorial shows how to build an ``aiohttp`` REST API application following the dependency
injection principle.
Start from the scratch or jump to the section:
.. contents::
:local:
:backlinks: none
You can find complete project on the
`Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/aiohttp>`_.
What are we going to build?
---------------------------
.. image:: https://media.giphy.com/media/apvx5lPCPsjN6/source.gif
We will build a REST API application that searches for funny GIFs on the `Giphy <https://giphy.com/>`_.
Let's call it Giphy Navigator.
How does Giphy Navigator work?
- Client sends a request specifying the search query and the number of results.
- Giphy Navigator returns a response in json format.
- The response contains:
- the search query
- the limit number
- the list of gif urls
Example response:
.. code-block:: json
{
"query": "Dependency Injector",
"limit": 10,
"gifs": [
{
"url": "https://giphy.com/gifs/boxes-dependent-swbf2-6Eo7KzABxgJMY"
},
{
"url": "https://giphy.com/gifs/depends-J56qCcOhk6hKE"
},
{
"url": "https://giphy.com/gifs/web-series-ccstudios-bro-dependent-1lhU8KAVwmVVu"
},
{
"url": "https://giphy.com/gifs/TheBoysTV-friends-friend-weneedeachother-XxR9qcIwcf5Jq404Sx"
},
{
"url": "https://giphy.com/gifs/netflix-a-series-of-unfortunate-events-asoue-9rgeQXbwoK53pcxn7f"
},
{
"url": "https://giphy.com/gifs/black-and-white-sad-skins-Hs4YzLs2zJuLu"
},
{
"url": "https://giphy.com/gifs/always-there-for-you-i-am-here-PlayjhCco9jHBYrd9w"
},
{
"url": "https://giphy.com/gifs/stream-famous-dollar-YT2dvOByEwXCdoYiA1"
},
{
"url": "https://giphy.com/gifs/i-love-you-there-for-am-1BhGzgpZXYWwWMAGB1"
},
{
"url": "https://giphy.com/gifs/life-like-twerk-9hlnWxjHqmH28"
}
]
}
The task is naive and that's exactly what we need for the tutorial.
Prepare the environment
-----------------------
Let's create the environment for the project.
First we need to create a project folder:
.. code-block:: bash
mkdir giphynav-aiohttp-tutorial
cd giphynav-aiohttp-tutorial
Now let's create and activate virtual environment:
.. code-block:: bash
python3 -m venv venv
. venv/bin/activate
Environment is ready and now we're going to create the layout of the project.
Project layout
--------------
Create next structure in the current directory. All files should be empty. That's ok for now.
Initial project layout::
./
├── giphynavigator/
│ ├── __init__.py
│ ├── application.py
│ ├── containers.py
│ └── handlers.py
├── venv/
└── requirements.txt
Install the requirements
------------------------
Now it's time to install the project requirements. We will use next packages:
- ``dependency-injector`` - the dependency injection framework
- ``aiohttp`` - the web framework
- ``pyyaml`` - the YAML files parsing library, used for the reading of the configuration files
- ``pytest-aiohttp`` - the helper library for the testing of the ``aiohttp`` application
- ``pytest-cov`` - the helper library for measuring the test coverage
Put next lines into the ``requirements.txt`` file:
.. code-block:: bash
dependency-injector
aiohttp
pyyaml
pytest-aiohttp
pytest-cov
and run next in the terminal:
.. code-block:: bash
pip install -r requirements.txt
Let's also install the ``httpie``. It is a user-friendly command-line HTTP client for the API era.
We will use it for the manual testing.
Run the command in the terminal:
.. code-block:: bash
pip install httpie
The requirements are setup. Now we will build a minimal application.
Minimal application
-------------------
In this section we will build a minimal application. It will have an endpoint that
will answer our requests in json format. There will be no payload for now.
Edit ``handlers.py``:
.. code-block:: python
"""Handlers module."""
from aiohttp import web
async def index(request: web.Request) -> web.Response:
query = request.query.get("query", "Dependency Injector")
limit = int(request.query.get("limit", 10))
gifs = []
return web.json_response(
{
"query": query,
"limit": limit,
"gifs": gifs,
},
)
Now let's create a container. Container will keep all of the application components and their dependencies.
Edit ``containers.py``:
.. code-block:: python
"""Containers module."""
from dependency_injector import containers
class Container(containers.DeclarativeContainer):
...
Container is empty for now. We will add the providers in the following sections.
Finally we need to create ``aiohttp`` application factory. It will create and configure container
and ``web.Application``. It is traditionally called ``create_app()``.
We will assign ``index`` handler to handle user requests to the root ``/`` of our web application.
Put next into the ``application.py``:
.. code-block:: python
"""Application module."""
from aiohttp import web
from .containers import Container
from . import handlers
def create_app() -> web.Application:
container = Container()
app = web.Application()
app.container = container
app.add_routes([
web.get("/", handlers.index),
])
return app
if __name__ == "__main__":
app = create_app()
web.run_app(app)
Now we're ready to run our application
Do next in the terminal:
.. code-block:: bash
python -m giphynavigator.application
The output should be something like:
.. code-block:: bash
======== Running on http://0.0.0.0:8080 ========
(Press CTRL+C to quit)
Let's check that it works. Open another terminal session and use ``httpie``:
.. code-block:: bash
http http://0.0.0.0:8080/
You should see:
.. code-block:: json
HTTP/1.1 200 OK
Content-Length: 844
Content-Type: application/json; charset=utf-8
Date: Wed, 29 Jul 2020 21:01:50 GMT
Server: Python/3.10 aiohttp/3.6.2
{
"gifs": [],
"limit": 10,
"query": "Dependency Injector"
}
Minimal application is ready. Let's connect our application with the Giphy API.
Giphy API client
----------------
In this section we will integrate our application with the Giphy API.
We will create our own API client using ``aiohttp`` client.
Create ``giphy.py`` module in the ``giphynavigator`` package:
.. code-block:: bash
:emphasize-lines: 6
./
├── giphynavigator/
│ ├── __init__.py
│ ├── application.py
│ ├── containers.py
│ ├── giphy.py
│ └── handlers.py
├── venv/
└── requirements.txt
and put next into it:
.. code-block:: python
"""Giphy client module."""
from aiohttp import ClientSession, ClientTimeout
class GiphyClient:
API_URL = "https://api.giphy.com/v1"
def __init__(self, api_key, timeout):
self._api_key = api_key
self._timeout = ClientTimeout(timeout)
async def search(self, query, limit):
"""Make search API call and return result."""
url = f"{self.API_URL}/gifs/search"
params = {
"q": query,
"api_key": self._api_key,
"limit": limit,
}
async with ClientSession(timeout=self._timeout) as session:
async with session.get(url, params=params) as response:
if response.status != 200:
response.raise_for_status()
return await response.json()
Now we need to add ``GiphyClient`` into the container. The ``GiphyClient`` has two dependencies
that have to be injected: the API key and the request timeout. We will need to use two more
providers from the ``dependency_injector.providers`` module:
- ``Factory`` provider. It will create a ``GiphyClient`` client.
- ``Configuration`` provider. It will provide an API key and a request timeout for the ``GiphyClient``
client. We will specify the location of the configuration file. The configuration provider will parse
the configuration file when we create a container instance.
Edit ``containers.py``:
.. code-block:: python
:emphasize-lines: 3-5,10-16
"""Containers module."""
from dependency_injector import containers, providers
from . import giphy
class Container(containers.DeclarativeContainer):
config = providers.Configuration(yaml_files=["config.yml"])
giphy_client = providers.Factory(
giphy.GiphyClient,
api_key=config.giphy.api_key,
timeout=config.giphy.request_timeout,
)
Now let's add the configuration file. We will use YAML. Create an empty file ``config.yml`` in
the root root of the project:
.. code-block:: bash
:emphasize-lines: 9
./
├── giphynavigator/
│ ├── __init__.py
│ ├── application.py
│ ├── containers.py
│ ├── giphy.py
│ └── handlers.py
├── venv/
├── config.yml
└── requirements.txt
and put next into it:
.. code-block:: yaml
giphy:
request_timeout: 10
We will use the ``GIPHY_API_KEY`` environment variable to provide the API key. Lets edit
``create_app()`` to fetch the key value from it.
Edit ``application.py``:
.. code-block:: python
:emphasize-lines: 11
"""Application module."""
from aiohttp import web
from .containers import Container
from . import handlers
def create_app() -> web.Application:
container = Container()
container.config.giphy.api_key.from_env("GIPHY_API_KEY")
app = web.Application()
app.container = container
app.add_routes([
web.get("/", handlers.index),
])
return app
if __name__ == "__main__":
app = create_app()
web.run_app(app)
Now we need to create an API key and set it to the environment variable.
As for now, dont worry, just take this one:
.. code-block:: bash
export GIPHY_API_KEY=wBJ2wZG7SRqfrU9nPgPiWvORmloDyuL0
.. note::
To create your own Giphy API key follow this
`guide <https://support.giphy.com/hc/en-us/articles/360020283431-Request-A-GIPHY-API-Key>`_.
The Giphy API client and the configuration setup is done. Let's proceed to the search service.
Search service
--------------
Now it's time to add the ``SearchService``. It will:
- Perform the search.
- Format result data.
``SearchService`` will use ``GiphyClient``.
Create ``services.py`` module in the ``giphynavigator`` package:
.. code-block:: bash
:emphasize-lines: 8
./
├── giphynavigator/
│ ├── __init__.py
│ ├── application.py
│ ├── containers.py
│ ├── giphy.py
│ ├── handlers.py
│ └── services.py
├── venv/
├── config.yml
└── requirements.txt
and put next into it:
.. code-block:: python
"""Services module."""
from .giphy import GiphyClient
class SearchService:
def __init__(self, giphy_client: GiphyClient):
self._giphy_client = giphy_client
async def search(self, query, limit):
"""Search for gifs and return formatted data."""
if not query:
return []
result = await self._giphy_client.search(query, limit)
return [{"url": gif["url"]} for gif in result["data"]]
The ``SearchService`` has a dependency on the ``GiphyClient``. This dependency will be
injected when we add ``SearchService`` to the container.
Edit ``containers.py``:
.. code-block:: python
:emphasize-lines: 5,18-21
"""Containers module."""
from dependency_injector import containers, providers
from . import giphy, services
class Container(containers.DeclarativeContainer):
config = providers.Configuration(yaml_files=["config.yml"])
giphy_client = providers.Factory(
giphy.GiphyClient,
api_key=config.giphy.api_key,
timeout=config.giphy.request_timeout,
)
search_service = providers.Factory(
services.SearchService,
giphy_client=giphy_client,
)
The search service is ready. In next section we're going to put it to work.
Make the search work
--------------------
Now we are ready to put the search into work. Let's inject ``SearchService`` into
the ``index`` handler. We will use :ref:`wiring` feature.
Edit ``handlers.py``:
.. code-block:: python
:emphasize-lines: 4-7,10-14,18
"""Handlers module."""
from aiohttp import web
from dependency_injector.wiring import Provide, inject
from .services import SearchService
from .containers import Container
@inject
async def index(
request: web.Request,
search_service: SearchService = Provide[Container.search_service],
) -> web.Response:
query = request.query.get("query", "Dependency Injector")
limit = int(request.query.get("limit", 10))
gifs = await search_service.search(query, limit)
return web.json_response(
{
"query": query,
"limit": limit,
"gifs": gifs,
},
)
To make the injection work we need to wire the container with the ``handlers`` module.
Let's configure the container to automatically make wiring with the ``handlers`` module when we
create a container instance.
Edit ``containers.py``:
.. code-block:: python
:emphasize-lines: 10
"""Containers module."""
from dependency_injector import containers, providers
from . import giphy, services
class Container(containers.DeclarativeContainer):
wiring_config = containers.WiringConfiguration(modules=[".handlers"])
config = providers.Configuration(yaml_files=["config.yml"])
giphy_client = providers.Factory(
giphy.GiphyClient,
api_key=config.giphy.api_key,
timeout=config.giphy.request_timeout,
)
search_service = providers.Factory(
services.SearchService,
giphy_client=giphy_client,
)
Make sure the app is running:
.. code-block:: bash
python -m giphynavigator.application
and make a request to the API in the terminal:
.. code-block:: bash
http http://0.0.0.0:8080/ query=="wow,it works" limit==5
You should see:
.. code-block:: json
HTTP/1.1 200 OK
Content-Length: 492
Content-Type: application/json; charset=utf-8
Date: Fri, 09 Oct 2020 01:35:48 GMT
Server: Python/3.10 aiohttp/3.6.2
{
"gifs": [
{
"url": "https://giphy.com/gifs/dollyparton-3xIVVMnZfG3KQ9v4Ye"
},
{
"url": "https://giphy.com/gifs/tennistv-unbelievable-disbelief-cant-believe-UWWJnhHHbpGvZOapEh"
},
{
"url": "https://giphy.com/gifs/discoverychannel-nugget-gold-rush-rick-ness-KGGPIlnC4hr4u2s3pY"
},
{
"url": "https://giphy.com/gifs/soulpancake-wow-work-xUe4HVXTPi0wQ2OAJC"
},
{
"url": "https://giphy.com/gifs/readingrainbow-teamwork-levar-burton-reading-rainbow-3o7qE1EaTWLQGDSabK"
}
],
"limit": 5,
"query": "wow,it works"
}
.. image:: https://media.giphy.com/media/3oxHQCI8tKXoeW4IBq/source.gif
The search works!
Make some refactoring
---------------------
Our ``index`` handler has two hardcoded config values:
- Default search query
- Default results limit
Let's make some refactoring. We will move these values to the config.
Edit ``handlers.py``:
.. code-block:: python
:emphasize-lines: 14-15,17-18
"""Handlers module."""
from aiohttp import web
from dependency_injector.wiring import Provide, inject
from .services import SearchService
from .containers import Container
@inject
async def index(
request: web.Request,
search_service: SearchService = Provide[Container.search_service],
default_query: str = Provide[Container.config.default.query],
default_limit: int = Provide[Container.config.default.limit.as_int()],
) -> web.Response:
query = request.query.get("query", default_query)
limit = int(request.query.get("limit", default_limit))
gifs = await search_service.search(query, limit)
return web.json_response(
{
"query": query,
"limit": limit,
"gifs": gifs,
},
)
Let's update the config.
Edit ``config.yml``:
.. code-block:: yaml
:emphasize-lines: 3-5
giphy:
request_timeout: 10
default:
query: "Dependency Injector"
limit: 10
The refactoring is done. We've made it cleaner - hardcoded values are now moved to the config.
Tests
-----
In this section we will add some tests.
Create ``tests.py`` module in the ``giphynavigator`` package:
.. code-block:: bash
:emphasize-lines: 9
./
├── giphynavigator/
│ ├── __init__.py
│ ├── application.py
│ ├── containers.py
│ ├── giphy.py
│ ├── handlers.py
│ ├── services.py
│ └── tests.py
├── venv/
├── config.yml
└── requirements.txt
and put next into it:
.. code-block:: python
:emphasize-lines: 32,59,73
"""Tests module."""
from unittest import mock
import pytest
from giphynavigator.application import create_app
from giphynavigator.giphy import GiphyClient
@pytest.fixture
def app():
app = create_app()
yield app
app.container.unwire()
@pytest.fixture
def client(app, aiohttp_client, loop):
return loop.run_until_complete(aiohttp_client(app))
async def test_index(client, app):
giphy_client_mock = mock.AsyncMock(spec=GiphyClient)
giphy_client_mock.search.return_value = {
"data": [
{"url": "https://giphy.com/gif1.gif"},
{"url": "https://giphy.com/gif2.gif"},
],
}
with app.container.giphy_client.override(giphy_client_mock):
response = await client.get(
"/",
params={
"query": "test",
"limit": 10,
},
)
assert response.status == 200
data = await response.json()
assert data == {
"query": "test",
"limit": 10,
"gifs": [
{"url": "https://giphy.com/gif1.gif"},
{"url": "https://giphy.com/gif2.gif"},
],
}
async def test_index_no_data(client, app):
giphy_client_mock = mock.AsyncMock(spec=GiphyClient)
giphy_client_mock.search.return_value = {
"data": [],
}
with app.container.giphy_client.override(giphy_client_mock):
response = await client.get("/")
assert response.status == 200
data = await response.json()
assert data["gifs"] == []
async def test_index_default_params(client, app):
giphy_client_mock = mock.AsyncMock(spec=GiphyClient)
giphy_client_mock.search.return_value = {
"data": [],
}
with app.container.giphy_client.override(giphy_client_mock):
response = await client.get("/")
assert response.status == 200
data = await response.json()
assert data["query"] == app.container.config.default.query()
assert data["limit"] == app.container.config.default.limit()
Now let's run it and check the coverage:
.. code-block:: bash
py.test giphynavigator/tests.py --cov=giphynavigator
You should see:
.. code-block::
platform darwin -- Python 3.10.0, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
plugins: asyncio-0.16.0, anyio-3.3.4, aiohttp-0.3.0, cov-3.0.0
collected 3 items
giphynavigator/tests.py ... [100%]
---------- coverage: platform darwin, python 3.10.0-final-0 ----------
Name Stmts Miss Cover
---------------------------------------------------
giphynavigator/__init__.py 0 0 100%
giphynavigator/application.py 13 2 85%
giphynavigator/containers.py 7 0 100%
giphynavigator/giphy.py 14 9 36%
giphynavigator/handlers.py 10 0 100%
giphynavigator/services.py 9 1 89%
giphynavigator/tests.py 37 0 100%
---------------------------------------------------
TOTAL 90 12 87%
.. note::
Take a look at the highlights in the ``tests.py``.
It emphasizes the overriding of the ``GiphyClient``. The real API call are mocked.
Conclusion
----------
In this tutorial we've built an ``aiohttp`` REST API application following the dependency
injection principle.
We've used the ``Dependency Injector`` as a dependency injection framework.
:ref:`containers` and :ref:`providers` helped to specify how to assemble search service and
giphy client.
:ref:`configuration-provider` helped to deal with reading YAML file and environment variable.
We used :ref:`wiring` feature to inject the dependencies into the ``index()`` handler.
:ref:`provider-overriding` feature helped in testing.
We kept all the dependencies injected explicitly. This will help when you need to add or
change something in future.
You can find complete project on the
`Github <https://github.com/ets-labs/python-dependency-injector/tree/master/examples/miniapps/aiohttp>`_.
What's next?
- Look at the other :ref:`tutorials`
- Know more about the :ref:`providers`
- Go to the :ref:`contents`
.. include:: ../sponsor.rst
.. disqus::

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

1038
docs/tutorials/cli.rst Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Some files were not shown because too many files have changed in this diff Show More