python-etcd3 icon indicating copy to clipboard operation
python-etcd3 copied to clipboard

0.12.0 release pulls in incompatible tenacity 7.0.0

Open mtraynham opened this issue 3 years ago • 1 comments

Seems by default tenacity 7.0.0 is being pulled in and causes the below exception:

  File "python3.8/site-packages/etcd3/locks.py", line 136, in __enter__
    self.acquire()
  File "python3.8/site-packages/etcd3/locks.py", line 103, in acquire
    return _acquire()
  File "python3.8/site-packages/tenacity/__init__.py", line 339, in wrapped_f
    return self(f, *args, **kw)
  File "python3.8/site-packages/tenacity/__init__.py", line 430, in __call__
    do = self.iter(retry_state=retry_state)
  File "python3.8/site-packages/tenacity/__init__.py", line 382, in iter
    sleep = self.wait(retry_state=retry_state)
TypeError: wait() got an unexpected keyword argument 'retry_state'

Strangely, the tagged version in this repo seems to reflect it should be tenacity 5.0.2. But the one on PyPi installed copy has tenacity >=6.1.0.

I've pinned locally to 6.1.0 to correct the issue.

mtraynham avatar Apr 16 '21 17:04 mtraynham

I'm getting this issue with the latest version in PyPI while trying the examples on the readme.

with etcd_client.lock('lock') as lock:
    # do something
    print('start lock)
    import time
    time.sleep(30)
    print('end lock')

If the lock is already acquired it results in this exception:

<ipython-input-67-4b12c0c78fcd> in <module>
----> 1 with etcd_client.lock('doot-machine') as lock:
      2     # do something
      3     print('start doot-machine')
      4     import time
      5     time.sleep(30)

~/.virtualenvs/rage/lib/python3.8/site-packages/etcd3/locks.py in __enter__(self)
    134 
    135     def __enter__(self):
--> 136         self.acquire()
    137         return self
    138 

~/.virtualenvs/rage/lib/python3.8/site-packages/etcd3/locks.py in acquire(self, timeout)
    101 
    102         try:
--> 103             return _acquire()
    104         except tenacity.RetryError:
    105             return False

~/.virtualenvs/rage/lib/python3.8/site-packages/tenacity/__init__.py in wrapped_f(*args, **kw)
    322         @functools.wraps(f)
    323         def wrapped_f(*args: t.Any, **kw: t.Any) -> t.Any:
--> 324             return self(f, *args, **kw)
    325 
    326         def retry_with(*args: t.Any, **kwargs: t.Any) -> WrappedFn:

~/.virtualenvs/rage/lib/python3.8/site-packages/tenacity/__init__.py in __call__(self, fn, *args, **kwargs)
    402         retry_state = RetryCallState(retry_object=self, fn=fn, args=args, kwargs=kwargs)
    403         while True:
--> 404             do = self.iter(retry_state=retry_state)
    405             if isinstance(do, DoAttempt):
    406                 try:

~/.virtualenvs/rage/lib/python3.8/site-packages/tenacity/__init__.py in iter(self, retry_state)
    362 
    363         if self.wait:
--> 364             sleep = self.wait(retry_state=retry_state)
    365         else:
    366             sleep = 0.0

TypeError: wait() got an unexpected keyword argument 'retry_state'

Since the problem seems to be fixed in the source - perhaps the maintainers could make a version 0.12.1 release with the correct package requirements to PyPI?

lukeplausin avatar Jan 03 '22 01:01 lukeplausin