Merge branch 'release/3.16.1' into master

This commit is contained in:
Roman Mogylatov 2020-06-16 22:34:36 -04:00
commit 86021f2948
9 changed files with 2546 additions and 2528 deletions

View File

@ -11,3 +11,4 @@ Dependency Injector Contributors
+ Dmitry Kuzmin (xotonic) + Dmitry Kuzmin (xotonic)
+ supakeen (supakeen) + supakeen (supakeen)
+ Bruno P. Kinoshita (kinow) + Bruno P. Kinoshita (kinow)
+ RobinsonMa (RobinsonMa)

View File

@ -36,7 +36,7 @@ build: clean cythonize
# Compile C extensions # Compile C extensions
python setup.py build_ext --inplace python setup.py build_ext --inplace
docs-live: clean docs-live:
sphinx-autobuild docs docs/_build/html sphinx-autobuild docs docs/_build/html
install: uninstall clean cythonize install: uninstall clean cythonize

View File

@ -1,10 +1,11 @@
var disqus_shortname; var disqus_shortname;
var disqus_identifier; var disqus_identifier;
(function() {{
$(function() {
var disqus_thread = $("#disqus_thread"); var disqus_thread = $("#disqus_thread");
disqus_shortname = disqus_thread.data('disqus-shortname'); disqus_shortname = disqus_thread.data('disqus-shortname');
disqus_identifier = disqus_thread.data('disqus-identifier'); disqus_identifier = disqus_thread.data('disqus-identifier');
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
}})(); });

View File

@ -293,4 +293,4 @@ disqus_shortname = 'python-dependency-injector'
def setup(app): def setup(app):
app.add_stylesheet('sphinx_rtd_theme-hotfix.css') app.add_css_file('sphinx_rtd_theme-hotfix.css')

View File

@ -7,9 +7,16 @@ that were made in every particular version.
From version 0.7.6 *Dependency Injector* framework strictly From version 0.7.6 *Dependency Injector* framework strictly
follows `Semantic versioning`_ follows `Semantic versioning`_
3.16.1
------
- Update ``singleton_thread_locals.py`` to support Python 3 (thanks to
`RobinsonMa <https://github.com/RobinsonMa>`_,
`PR #252 <https://github.com/ets-labs/python-dependency-injector/pull/252>`_).
- Fix Disqus comments.
- Fix warnings in API docs.
3.16.0 3.16.0
------ ------
- Add ``List`` provider - Add ``List`` provider
`issue #243 <https://github.com/ets-labs/python-dependency-injector/issues/243>`_, `issue #243 <https://github.com/ets-labs/python-dependency-injector/issues/243>`_,
`PR #251 <https://github.com/ets-labs/python-dependency-injector/pull/251>`_. `PR #251 <https://github.com/ets-labs/python-dependency-injector/pull/251>`_.
@ -19,7 +26,6 @@ follows `Semantic versioning`_
- Add support of six 1.15.0. - Add support of six 1.15.0.
- Regenerate C sources using Cython 0.29.20. - Regenerate C sources using Cython 0.29.20.
3.15.6 3.15.6
------ ------
- Fix changelog typo. - Fix changelog typo.
@ -65,18 +71,18 @@ follows `Semantic versioning`_
------- -------
- Fix ``3.14.11`` degradation issue causing inability of using ``Delegate`` provider in - Fix ``3.14.11`` degradation issue causing inability of using ``Delegate`` provider in
``DeclarativeContainer`` when this container is instantiated with overriding of delegating ``DeclarativeContainer`` when this container is instantiated with overriding of delegating
provider (thanks to `GitterRemote <https://github .com/GitterRemote>`_, issue details are provider (thanks to `GitterRemote <https://github .com/GitterRemote>`_, issue details are here
`here <https://github.com/ets-labs/python-dependency-injector/issues/235>`_). `#235 <https://github.com/ets-labs/python-dependency-injector/issues/235>`_).
3.14.11 3.14.11
------- -------
- Fix issue causing creation of a copy of provided object by ``Object`` provider when it was a - Fix issue causing creation of a copy of provided object by ``Object`` provider when it was a
part of ``DeclarativeContainer`` and this container was instantiated (thanks to part of ``DeclarativeContainer`` and this container was instantiated (thanks to
`davidcim <https://github.com/davidcim>`_, issue details are `davidcim <https://github.com/davidcim>`_, issue details are here
`here <https://github.com/ets-labs/python-dependency-injector/issues/231>`_). `#231 <https://github.com/ets-labs/python-dependency-injector/issues/231>`_).
3.14.10 3.14.10
------ -------
- Make spelling fix for the list of contributors. - Make spelling fix for the list of contributors.
3.14.9 3.14.9
@ -480,6 +486,7 @@ follows `Semantic versioning`_
2. Add makefile (``clean``, ``test``, ``build``, ``install``, ``uninstall`` 2. Add makefile (``clean``, ``test``, ``build``, ``install``, ``uninstall``
& ``publish`` commands). & ``publish`` commands).
3. Update repository structure: 3. Update repository structure:
1. Sources are moved under ``src/`` folder. 1. Sources are moved under ``src/`` folder.
2. Tests are moved under ``tests/unit/`` folder. 2. Tests are moved under ``tests/unit/`` folder.

View File

@ -1,26 +1,26 @@
"""`ThreadLocalSingleton` providers example.""" """`ThreadLocalSingleton` providers example."""
import threading import threading
import Queue import queue
import dependency_injector.providers as providers import dependency_injector.providers as providers
def example(example_object, queue): def example(example_object, queue_object):
"""Put provided object in the provided queue.""" """Put provided object in the provided queue."""
queue.put(example_object) queue_object.put(example_object)
# Create thread-local singleton provider for some object (main thread): # Create thread-local singleton provider for some object (main thread):
thread_local_object = providers.ThreadLocalSingleton(object) thread_local_object = providers.ThreadLocalSingleton(object)
# Create singleton provider for thread-safe queue: # Create singleton provider for thread-safe queue:
queue = providers.Singleton(Queue.Queue) queue_factory = providers.ThreadSafeSingleton(queue.Queue)
# Create callable provider for example(), inject dependencies: # Create callable provider for example(), inject dependencies:
example = providers.DelegatedCallable(example, example = providers.DelegatedCallable(example,
example_object=thread_local_object, example_object=thread_local_object,
queue=queue) queue_object=queue_factory)
# Create factory provider for threads that are targeted to execute example(): # Create factory provider for threads that are targeted to execute example():
thread_factory = providers.Factory(threading.Thread, thread_factory = providers.Factory(threading.Thread,
@ -43,8 +43,8 @@ if __name__ == '__main__':
# Making some asserts (main thread): # Making some asserts (main thread):
all_objects = set() all_objects = set()
while not queue().empty(): while not queue_factory().empty():
all_objects.add(queue().get()) all_objects.add(queue_factory().get())
assert len(all_objects) == len(threads) assert len(all_objects) == len(threads)
# Queue contains same number of objects as number of threads where # Queue contains same number of objects as number of threads where

View File

@ -1,6 +1,6 @@
"""Dependency injector top-level package.""" """Dependency injector top-level package."""
__version__ = '3.16.0' __version__ = '3.16.1'
"""Version number that follows semantic versioning. """Version number that follows semantic versioning.
:type: str :type: str

File diff suppressed because it is too large Load Diff

View File

@ -82,6 +82,7 @@ cdef class Provider(object):
All providers should extend this class. All providers should extend this class.
.. py:attribute:: overridden .. py:attribute:: overridden
:noindex:
Tuple of overriding providers, if any. Tuple of overriding providers, if any.
@ -366,6 +367,7 @@ cdef class Dependency(Provider):
database = database_provider() database = database_provider()
.. py:attribute:: instance_of .. py:attribute:: instance_of
:noindex:
Class of required dependency. Class of required dependency.
@ -459,6 +461,7 @@ cdef class ExternalDependency(Dependency):
Use :py:class:`Dependency` instead. Use :py:class:`Dependency` instead.
.. py:attribute:: instance_of .. py:attribute:: instance_of
:noindex:
Class of required dependency. Class of required dependency.
@ -1386,6 +1389,7 @@ cdef class DelegatedFactory(Factory):
:type: type | None :type: type | None
.. py:attribute:: cls .. py:attribute:: cls
:noindex:
Class that provides object. Class that provides object.
Alias for :py:attr:`provides`. Alias for :py:attr:`provides`.
@ -1723,6 +1727,7 @@ cdef class Singleton(BaseSingleton):
:type: type | None :type: type | None
.. py:attribute:: cls .. py:attribute:: cls
:noindex:
Class that provides object. Class that provides object.
Alias for :py:attr:`provides`. Alias for :py:attr:`provides`.
@ -1765,6 +1770,7 @@ cdef class DelegatedSingleton(Singleton):
:type: type | None :type: type | None
.. py:attribute:: cls .. py:attribute:: cls
:noindex:
Class that provides object. Class that provides object.
Alias for :py:attr:`provides`. Alias for :py:attr:`provides`.
@ -1821,6 +1827,7 @@ cdef class DelegatedThreadSafeSingleton(ThreadSafeSingleton):
:type: type | None :type: type | None
.. py:attribute:: cls .. py:attribute:: cls
:noindex:
Class that provides object. Class that provides object.
Alias for :py:attr:`provides`. Alias for :py:attr:`provides`.
@ -1842,6 +1849,7 @@ cdef class ThreadLocalSingleton(BaseSingleton):
:type: type | None :type: type | None
.. py:attribute:: cls .. py:attribute:: cls
:noindex:
Class that provides object. Class that provides object.
Alias for :py:attr:`provides`. Alias for :py:attr:`provides`.
@ -1889,6 +1897,7 @@ cdef class DelegatedThreadLocalSingleton(ThreadLocalSingleton):
:type: type | None :type: type | None
.. py:attribute:: cls .. py:attribute:: cls
:noindex:
Class that provides object. Class that provides object.
Alias for :py:attr:`provides`. Alias for :py:attr:`provides`.