Repository: reagento/dishka

Issue:
Add scope property to container
I was wondering what scope a container currently has and found out it's accessible through ``container.registry.scope``.
Maybe it makes sense to add a property to both containers?

````python
@property
def scope() -> Scope:
    return self.registry.scope
````

Hints from issue comments:
@Tishka17: Sounds acceptable. Let's do it

Solution patch:
diff --git a/docs/provider/index.rst b/docs/provider/index.rst
index 63f8705..dc2fece 100644
--- a/docs/provider/index.rst
+++ b/docs/provider/index.rst
@@ -73,7 +73,7 @@ Your class-based provider can have ``__init__`` method and methods access ``self
     container = make_container(provider)
 
 
-Dependencies have scope and there are three places to set it (according to their priority):
+Dependencies have scope and there are three places to set it (from highest to lowest priority):
 
 * When registering single factory passing to ``provide`` method
 
diff --git a/src/dishka/async_container.py b/src/dishka/async_container.py
index f988530..0180e55 100644
--- a/src/dishka/async_container.py
+++ b/src/dishka/async_container.py
@@ -68,6 +68,10 @@ class AsyncContainer:
         self._exits: list[Exit] = []
         self.close_parent = close_parent
 
+    @property
+    def scope(self) -> BaseScope:
+        return self.registry.scope
+
     @property
     def context(self) -> MutableMapping[DependencyKey, Any]:
         warnings.warn(
diff --git a/src/dishka/container.py b/src/dishka/container.py
index 8ecc998..3492f5a 100644
--- a/src/dishka/container.py
+++ b/src/dishka/container.py
@@ -68,6 +68,10 @@ class Container:
         self._exits: list[Exit] = []
         self.close_parent = close_parent
 
+    @property
+    def scope(self) -> BaseScope:
+        return self.registry.scope
+
     @property
     def context(self) -> MutableMapping[DependencyKey, Any]:
         warnings.warn(


Test patch:
diff --git a/tests/unit/container/test_enter_exit.py b/tests/unit/container/test_enter_exit.py
index 759a63a..dd5b93b 100644
--- a/tests/unit/container/test_enter_exit.py
+++ b/tests/unit/container/test_enter_exit.py
@@ -34,7 +34,7 @@ def test_sync_create(provide_scope, start_scope, expected_scope):
             return 100
 
     container = make_container(MyProvider(), start_scope=start_scope)
-    assert container.registry.scope is expected_scope
+    assert container.scope is expected_scope
     a = container.get(ClassA)
     assert a
     assert a.dep == 100
@@ -66,7 +66,7 @@ async def test_async_create(provide_scope, start_scope, expected_scope):
             return 100
 
     container = make_async_container(MyProvider(), start_scope=start_scope)
-    assert container.registry.scope is expected_scope
+    assert container.scope is expected_scope
     a = await container.get(ClassA)
     assert a
     assert a.dep == 100