tox-dev / filelock

A platform-independent file lock for Python.
https://py-filelock.readthedocs.io
The Unlicense
747 stars 107 forks source link

Poetry build fails with new filelock bugfix version #343

Closed wassupxP closed 2 months ago

wassupxP commented 2 months ago

Hi guys, new bugfix release broke all poetry build. Seems that the bugfix changed API, is this intended? I believe this can be reproduced on any python package when building via poetry.

pip install poetry
poetry build
Traceback:
Traceback (most recent call last):
  File "/opt/contrib/lib/python3.9/site-packages/filelock/_api.py", line 388, in __del__
Exception ignored in: <function BaseFileLock.__del__ at 0x10684e940>
Traceback (most recent call last):
  File "/opt/contrib/lib/python3.9/site-packages/filelock/_api.py", line 388, in __del__
    self.release(force=True)
  File "/opt/contrib/lib/python3.9/site-packages/virtualenv/util/lock.py", line 34, in release
    with self.thread_safe:
AttributeError: '_CountedFileLock' object has no attribute 'thread_safe'
    self.release(force=True)
  File "/opt/contrib/lib/python3.9/site-packages/virtualenv/util/lock.py", line 34, in release
    with self.thread_safe:
AttributeError: '_CountedFileLock' object has no attribute 'thread_safe'
failed to build image setuptools, pip because:
Traceback (most recent call last):
  File "/opt/contrib/lib/python3.9/site-packages/virtualenv/seed/embed/via_app_data/via_app_data.py", line 54, in _install
    with parent.non_reentrant_lock_for_key(wheel_img.name):
  File "/opt/contrib/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "/opt/contrib/lib/python3.9/site-packages/virtualenv/util/lock.py", line 142, in non_reentrant_lock_for_key
    with _CountedFileLock(str(self.path / f"{name}.lock")):
  File "/opt/contrib/lib/python3.9/site-packages/filelock/_api.py", line 117, in __call__
    instance = super().__call__(
TypeError: __init__() got an unexpected keyword argument 'timeout'
Traceback (most recent call last):
  File "/opt/contrib/lib/python3.9/site-packages/virtualenv/seed/embed/via_app_data/via_app_data.py", line 54, in _install
    with parent.non_reentrant_lock_for_key(wheel_img.name):
  File "/opt/contrib/lib/python3.9/contextlib.py", line 119, in __enter__
    return next(self.gen)
  File "/opt/contrib/lib/python3.9/site-packages/virtualenv/util/lock.py", line 142, in non_reentrant_lock_for_key
    with _CountedFileLock(str(self.path / f"{name}.lock")):
  File "/opt/contrib/lib/python3.9/site-packages/filelock/_api.py", line 117, in __call__
    instance = super().__call__(
TypeError: __init__() got an unexpected keyword argument 'timeout'
donsokolone commented 2 months ago

Hi, I stumbled upon the same problem with 3.15.2 when running tox which uses filelock as dependency.

gaborbernat commented 2 months ago

Yanked. Sorry for the trouble. cc @kwist-sgr, please make your fix on top of https://github.com/tox-dev/filelock/pull/344

wassupxP commented 2 months ago

Do you know what is the ETA for this one? Would it be possible to drop this release as poetry and tox is used by plenty of users?

Thanks for the prompt response though!

donsokolone commented 2 months ago

@wassupxP you could exclude this version from your requirements to get you up and running quickly

filelock>=3.13.1,!=3.15.2
gaborbernat commented 2 months ago

Some relevant discussion about the problem in #340

wassupxP commented 2 months ago

In my standard flow I won't even get to installation of my packages. The proposed workaround won't work for me, but thanks @donsokolone. I already have a workaround by forcing installation of previous version before poetry installation or falling back to pip for a while.

hanssl commented 2 months ago

I have not found a way to block 3.15.x because the file dependency is not in my code. Creating the poetry venv pulls in filelock via virtualenv.

Screenshot 2024-06-19 at 11 34 00 AM

ugomancz commented 2 months ago

I believe this issue has been fixed with the 3.15.3 release. I am not able to reproduce the issue anymore.

wassupxP commented 2 months ago

Yes, thank you for quick fix, closing the ticket.