Merge branch 'release/4.0.1' into master

This commit is contained in:
Roman Mogylatov 2020-10-16 14:10:37 -04:00
commit 88b3482ced
4 changed files with 19 additions and 5 deletions

View File

@ -7,6 +7,15 @@ that were made in every particular version.
From version 0.7.6 *Dependency Injector* framework strictly
follows `Semantic versioning`_
4.0.1
-----
- Extend ``Configuration.from_ini()`` and ``Configuration.from_yaml()`` typing stubs to
accept ``pathlib.Path``. The methods were already compatible with ``pathlib.Path``
and just did not accept it in their signatures (see
`PR 300 <https://github.com/ets-labs/python-dependency-injector/pull/300>`_). Fix
was provided by `JarnoRFB <https://github.com/JarnoRFB>`_. Many thanks to you again,
JarnoRFB.
4.0.0
-----
New features:

View File

@ -1,6 +1,6 @@
"""Top-level package."""
__version__ = '4.0.0'
__version__ = '4.0.1'
"""Version number.
:type: str

View File

@ -1,5 +1,6 @@
from __future__ import annotations
from pathlib import Path
from typing import (
TypeVar,
Generic,
@ -136,8 +137,8 @@ class ConfigurationOption(Provider):
def as_float(self) -> TypedConfigurationOption[float]: ...
def as_(self, callback: _Callable[..., T], *args: Injection, **kwargs: Injection) -> TypedConfigurationOption[T]: ...
def update(self, value: Any) -> None: ...
def from_ini(self, filepath: str) -> None: ...
def from_yaml(self, filepath: str) -> None: ...
def from_ini(self, filepath: Union[Path, str]) -> None: ...
def from_yaml(self, filepath: Union[Path, str]) -> None: ...
def from_dict(self, options: Dict[str, Any]) -> None: ...
def from_env(self, name: str, default: Optional[Any] = None) -> None: ...
@ -157,8 +158,8 @@ class Configuration(Object):
def set(self, selector: str, value: Any) -> OverridingContext: ...
def reset_cache(self) -> None: ...
def update(self, value: Any) -> None: ...
def from_ini(self, filepath: str) -> None: ...
def from_yaml(self, filepath: str) -> None: ...
def from_ini(self, filepath: Union[Path, str]) -> None: ...
def from_yaml(self, filepath: Union[Path, str]) -> None: ...
def from_dict(self, options: Dict[str, Any]) -> None: ...
def from_env(self, name: str, default: Optional[Any] = None) -> None: ...

View File

@ -1,3 +1,4 @@
from pathlib import Path
from dependency_injector import providers
@ -9,7 +10,10 @@ provider1 = providers.Factory(dict, a=config1.a)
config2 = providers.Configuration()
config2.from_dict({})
config2.from_ini('config.ini')
config2.from_ini(Path('config.ini'))
config2.from_yaml('config.yml')
config2.from_yaml(Path('config.yml'))
config2.from_env('ENV', 'default')
# Test 3: to check as_*() methods