Deprecate version attribute
Change-Id: Ibcfb2adb9e831ab613a8b9667a1c999e962d1e35 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
1 parent
bfb2218504
commit
091344cfcc
2 files changed
+22
-2
No files matched your search
+16
-2
@@ -10,6 +10,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from typing import cast
|
||||
import warnings
|
||||
|
||||
import pbr.version
|
||||
|
||||
from etcd3gw.client import client
|
||||
@@ -19,8 +22,6 @@ from etcd3gw.lock import Lock
|
||||
from etcd3gw import types
|
||||
from etcd3gw import utils
|
||||
|
||||
__version__ = pbr.version.VersionInfo('etcd3gw').version_string()
|
||||
|
||||
__all__ = (
|
||||
'Etcd3Client',
|
||||
'Lease',
|
||||
@@ -29,3 +30,16 @@ __all__ = (
|
||||
'types',
|
||||
'utils',
|
||||
)
|
||||
|
||||
|
||||
def __getattr__(name: str) -> str:
|
||||
if name == '__version__':
|
||||
warnings.warn(
|
||||
"Accessing etcd3gw.__version__ is deprecated and will be "
|
||||
"removed in a future release. Use importlib.metadata instead: "
|
||||
"importlib.metadata.version('etcd3gw')",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return cast(str, pbr.version.VersionInfo('etcd3gw').version_string())
|
||||
raise AttributeError(f"module 'etcd3gw' has no attribute {name!r}")
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
deprecations:
|
||||
- |
|
||||
The ``etcd3gw.__version__`` attribute has been deprecated for removal.
|
||||
Prefer use of ``importlib.metadata`` to inspect version information for
|
||||
installed packages.
|
||||
Reference in new issue
Block a user