NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI, #49 most downloaded on PyPI
A platform independent file lock.
Latest stable
4.3.0
Last release today
22 Nov 2026
Ships on a steady schedule
a new release about every 9 days
Nearly every release is documented
notes for 60 of the last 60 stable releases
2 versions withdrawn
withdrawn after publishing
12 years old
147 releases · first in 2014
Drag across the ruler to compare, or tap a release to open it.
<!-- Release notes generated using configuration in .github/release.yml at 3.23.0 -->
<!-- Release notes generated using configuration in .github/release.yml at 3.23.0 -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.22.0...3.23.0
Change the project license from Unlicense to MIT. PR #479 - by @gaborbernat .
List fasteners among the similar libraries in the documentation. PR #478 - by @gaborbernat .
Change the project license from Unlicense to MIT. 479 - by gaborbernat.
List fasteners among the similar libraries in the documentation. 478 - by gaborbernat.
Your coding agent can read these notes before it upgrades. Set up the MCP server →
<!-- Release notes generated using configuration in .github/release.yml at 3.22.0 -->
<!-- Release notes generated using configuration in .github/release.yml at 3.22.0 -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.21.2...3.22.0
Detect and break stale soft locks. PR #476 - by @gaborbernat .
Disable stale-lock detection on Windows until its implementation is safe. PR #477 - by @gaborbernat .
Detect and break stale soft locks. 476 - by gaborbernat.
Disable stale-lock detection on Windows until its implementation is safe. 477 - by gaborbernat.
<!-- Release notes generated using configuration in .github/release.yml at 3.21.2 -->
<!-- Release notes generated using configuration in .github/release.yml at 3.21.2 -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.21.1...3.21.2
Handle ImportError when the sqlite3 C library is unavailable. PR #475 - by @gaborbernat .
Handle ImportError when the sqlite3 C library is unavailable. 475 - by gaborbernat.
<!-- Release notes generated using configuration in .github/release.yml at 3.21.1 -->
<!-- Release notes generated using configuration in .github/release.yml at 3.21.1 -->
sqlite3 when importing ReadWriteLock by @bayandin in https://github.com/tox-dev/filelock/pull/473Full Changelog: https://github.com/tox-dev/filelock/compare/3.21.0...3.21.1
Import ReadWriteLock when sqlite3 is unavailable. PR #473 - by @bayandin .
Import ~filelock.ReadWriteLock when sqlite3 is unavailable. 473 - by bayandin.
<!-- Release notes generated using configuration in .github/release.yml at 3.21.0 -->
<!-- Release notes generated using configuration in .github/release.yml at 3.21.0 -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.20.3...3.21.0
<!-- Release notes generated using configuration in .github/release.yml at 3.20.4 -->
<!-- Release notes generated using configuration in .github/release.yml at 3.20.4 -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.20.3...3.20.4
Add a SQLite-backed ReadWriteLock . PR #399 - by @leventov
Allow Unix lock files to be removed after release. PR #408 - by @sbc100
Add a SQLite-backed ~filelock.ReadWriteLock. 399 - by leventov
Allow Unix lock files to be removed after release. 408 - by sbc100
Fix TOCTOU symlink vulnerability in SoftFileLock by @gaborbernat in https://github.com/tox-dev/filelock/pull/465
<!-- Release notes generated using configuration in .github/release.yml at main -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.20.2...3.20.3
Fix TOCTOU symlink vulnerability in SoftFileLock PR #465 - by @gaborbernat .
Fix TOCTOU symlink vulnerability in ~filelock.SoftFileLock 465 - by gaborbernat.
<!-- Release notes generated using configuration in .github/release.yml at main -->
<!-- Release notes generated using configuration in .github/release.yml at main -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.20.1...3.20.2
Support Unix systems without os.O_NOFOLLOW PR #463 - by @mwilliamson .
Support Unix systems without os.O_NOFOLLOW 463 - by mwilliamson.
CVE-2025-68146: Fix TOCTOU symlink vulnerability in lock file creation by @gaborbernat in https://github.com/tox-dev/filelock/pull/461
<!-- Release notes generated using configuration in .github/release.yml at main -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.20.0...3.20.1
Fix TOCTOU symlink vulnerability in lock file creation PR #461 - by @gaborbernat .
Fix TOCTOU symlink vulnerability in lock file creation 461 - by gaborbernat.
<!-- Release notes generated using configuration in .github/release.yml at main -->
<!-- Release notes generated using configuration in .github/release.yml at main -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.19.1...3.20.0
<!-- Release notes generated using configuration in .github/release.yml at main -->
<!-- Release notes generated using configuration in .github/release.yml at main -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.19.0...3.19.1
<!-- Release notes generated using configuration in .github/release.yml at main -->
<!-- Release notes generated using configuration in .github/release.yml at main -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.17.0...3.18.0
Support fcntl check on Emscripten PR #398 - by @juntyr .
Indicate that locks are exclusive/write locks PR #394 - by @bicarlsen .
Support fcntl check on Emscripten 398 - by juntyr.
Indicate that locks are exclusive/write locks 394 - by bicarlsen.
<!-- Release notes generated using configuration in .github/release.yml at main -->
<!-- Release notes generated using configuration in .github/release.yml at main -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.16.1...3.17.0
<!-- Release notes generated using configuration in .github/release.yml at main -->
<!-- Release notes generated using configuration in .github/release.yml at main -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.16.0...3.16.1
<!-- Release notes generated using configuration in .github/release.yml at main -->
<!-- Release notes generated using configuration in .github/release.yml at main -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.15.4...3.16.0
<!-- Release notes generated using configuration in .github/release.yml at main -->
<!-- Release notes generated using configuration in .github/release.yml at main -->
file_lock as positional argument by @kwist-sgr in https://github.com/tox-dev/filelock/pull/347Full Changelog: https://github.com/tox-dev/filelock/compare/3.15.3...3.15.4
<!-- Release notes generated using configuration in .github/release.yml at main -->
<!-- Release notes generated using configuration in .github/release.yml at main -->
TypeError: _CountedFileLock.__init__() got an unexpected keyword argument 'timeout' by @kwist-sgr in https://github.com/tox-dev/filelock/pull/345Full Changelog: https://github.com/tox-dev/filelock/compare/3.15.2...3.15.3
Fix TypeError: _CountedFileLock.init() got an unexpected keyword argument PR #345 - by @kwist-sgr .
Fix TypeError: _CountedFileLock.__init__() got an unexpected keyword argument 345 - by kwist-sgr.
<!-- Release notes generated using configuration in .github/release.yml at main -->
<!-- Release notes generated using configuration in .github/release.yml at main -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.15.1...3.15.2
Use a metaclass to implement the singleton pattern PR #340 - by @kwist-sgr .
Use a metaclass to implement the singleton pattern 340 - by kwist-sgr.
<!-- Release notes generated using configuration in .github/release.yml at main -->
<!-- Release notes generated using configuration in .github/release.yml at main -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.15.0...3.15.1
Restore init method; more robust initialization for singleton locks PR #338 - by @ethanbb .
Restore __init__ method; more robust initialization for singleton locks 338 - by ethanbb.
<!-- Release notes generated using configuration in .github/release.yml at main -->
<!-- Release notes generated using configuration in .github/release.yml at main -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.14.0...3.15.0
Add asyncio support PR #332 - by @Ovizro .
Don’t re-initialize BaseFileLock when returning existing singleton instance PR #334 - by @ethanbb .
Add asyncio support 332 - by Ovizro.
Don't re-initialize ~filelock.BaseFileLock when returning existing singleton instance 334 - by ethanbb.
<!-- Release notes generated using configuration in .github/release.yml at main -->
<!-- Release notes generated using configuration in .github/release.yml at main -->
blocking parameter on lock constructor with tests and docs by @iamkhav in https://github.com/tox-dev/filelock/pull/325Full Changelog: https://github.com/tox-dev/filelock/compare/3.13.4...3.14.0
Add blocking parameter on lock constructor PR #325 - by @iamkhav .
<!-- Release notes generated using configuration in .github/release.yml at main -->
<!-- Release notes generated using configuration in .github/release.yml at main -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.13.3...3.13.4
Raise error on incompatible singleton timeout and mode arguments PR #320 - by @nefrob .
Raise error on incompatible singleton timeout and mode arguments 320 - by nefrob.
<!-- Release notes generated using configuration in .github/release.yml at main -->
<!-- Release notes generated using configuration in .github/release.yml at main -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.13.2...3.13.3
Make singleton class instance dict unique per subclass PR #318 - by @nefrob .
Make singleton class instance dict unique per subclass 318 - by nefrob.
<!-- Release notes generated using configuration in .github/release.yml at main -->
<!-- Release notes generated using configuration in .github/release.yml at main -->
/tmp by @kota-iizuka in https://github.com/tox-dev/filelock/pull/317Full Changelog: https://github.com/tox-dev/filelock/compare/3.13.1...3.13.2
Fix permission denied error when lock file is placed in /tmp PR #317 - by @kota-iizuka .
Fix permission denied error when lock file is placed in /tmp 317 - by kota-iizuka.
<!-- Release notes generated using configuration in .github/release.yml at main -->
<!-- Release notes generated using configuration in .github/release.yml at main -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.13.0...3.13.1
Allow users to subclass FileLock with custom keyword arguments PR #284 - by @hmaarrfk .
Allow users to subclass ~filelock.FileLock with custom keyword arguments 284 - by hmaarrfk.
<!-- Release notes generated using configuration in .github/release.yml at 3.13.0 -->
<!-- Release notes generated using configuration in .github/release.yml at 3.13.0 -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.12.4...3.13.0
Support reentrant locking on lock file path via optional is_singleton instance PR #283 - by @nefrob .
Support reentrant locking on lock file path via optional is_singleton instance 283 - by nefrob.
<!-- Release notes generated using configuration in .github/release.yml at main -->
<!-- Release notes generated using configuration in .github/release.yml at main -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.12.3...3.12.4
Change typing-extensions to be installed only with the [typing] extra PR #276 - by @asottile .
Change typing-extensions to be installed only with the [typing] extra 276 - by asottile.
<!-- Release notes generated using configuration in .github/release.yml at main -->
<!-- Release notes generated using configuration in .github/release.yml at main -->
Full Changelog: https://github.com/tox-dev/filelock/compare/3.12.2...3.12.3
Restore 'if TYPE_CHECKING' syntax for FileLock definition by @dlax in https://github.com/tox-dev/py-filelock/pull/245
Full Changelog: https://github.com/tox-dev/py-filelock/compare/3.12.1...3.12.2
Restore if TYPE_CHECKING syntax for FileLock definition PR #245 - by @dlax .
Restore if TYPE_CHECKING syntax for ~filelock.FileLock definition 245 - by dlax.
Add trusted-publish by @gaborbernat in https://github.com/tox-dev/py-filelock/pull/236
Full Changelog: https://github.com/tox-dev/py-filelock/compare/3.12.0...3.12.1
Fix: #225 :Get rid of warning about inability to link to _thread._local. by @csm10495 in https://github.com/tox-dev/py-filelock/pull/226
Full Changelog: https://github.com/tox-dev/py-filelock/compare/3.11.0...3.12.0
Allow callers to disable thread-local lock state at construction; it remains enabled by default. PR #232 - by @csm10495 .
Fix a lock hang on Windows. PR #231 - by @TheMatt2 .
Allow callers to disable thread-local lock state at construction; it remains enabled by default. 232 - by csm10495.
Fix a lock hang on Windows. 231 - by TheMatt2.
Bump pypa/gh-action-pypi-publish from 1.8.3 to 1.8.5 by @dependabot in https://github.com/tox-dev/py-filelock/pull/218
Full Changelog: https://github.com/tox-dev/py-filelock/compare/3.10.7...3.11.0
Keep lock state local to each thread. PR #219 - by @csm10495 .
use fchmod by @jfennick in https://github.com/tox-dev/py-filelock/pull/214
Full Changelog: https://github.com/tox-dev/py-filelock/compare/3.10.6...3.10.7
Use os.fchmod() to avoid a os.chmod() failure on PyPy via Anaconda. PR #214 - by @jfennick .
Use os.fchmod to avoid a os.chmod failure on PyPy via Anaconda. 214 - by jfennick.
Bugfix/147 by @jahrules in https://github.com/tox-dev/py-filelock/pull/213
Full Changelog: https://github.com/tox-dev/py-filelock/compare/3.10.5...3.10.6
Raise unexpected file-opening errors from SoftFileLock instead of repeatedly waiting for a lock that cannot be acquired. PR #213 - by @jahrules and @gaborbernat .
Raise unexpected file-opening errors from ~filelock.SoftFileLock instead of repeatedly waiting for a lock that cannot be acquired. 213 - by jahrules and gaborbernat.
proposed fix for issue #67 by @jahrules in https://github.com/tox-dev/py-filelock/pull/212
Full Changelog: https://github.com/tox-dev/py-filelock/compare/3.10.4...3.10.5
Raise NotImplementedError when a Unix filesystem does not support flock instead of waiting indefinitely. PR #212 - by @jahrules .
Raise NotImplementedError when a Unix filesystem does not support flock instead of waiting indefinitely. 212 - by jahrules.
updated os.open to preserve mode by @jahrules in https://github.com/tox-dev/py-filelock/pull/211
Full Changelog: https://github.com/tox-dev/py-filelock/compare/3.10.3...3.10.4
Apply the requested file mode when creating a Unix lock file, including when the file cannot later be changed with chmod . PR #211 - by @jahrules .
Apply the requested file mode when creating a Unix lock file, including when the file cannot later be changed with chmod. 211 - by jahrules.
Bump pypa/gh-action-pypi-publish from 1.8.1 to 1.8.3 by @dependabot in https://github.com/tox-dev/py-filelock/pull/207
Full Changelog: https://github.com/tox-dev/py-filelock/compare/3.10.2...3.10.3
changed from os.umask to os.chmod by @jahrules in https://github.com/tox-dev/py-filelock/pull/206
Full Changelog: https://github.com/tox-dev/py-filelock/compare/3.10.1...3.10.2
Bug fix for using filelock with threaded programs causing undesired file permissions - by @jahrules .
Bug fix for using filelock with threaded programs causing undesired file permissions - by jahrules.
Bump pypa/gh-action-pypi-publish from 1.7.1 to 1.8.1 by @dependabot in https://github.com/tox-dev/py-filelock/pull/200
Full Changelog: https://github.com/tox-dev/py-filelock/compare/3.10.0...3.10.1
added multiuser support and associated tests by @jahrules in https://github.com/tox-dev/py-filelock/pull/192
Full Changelog: https://github.com/tox-dev/py-filelock/compare/3.9.1...3.10.0
Add support for explicit file modes for lockfiles PR #192 - by @jahrules .
Add support for explicit file modes for lockfiles 192 - by jahrules.
[pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/tox-dev/py-filelock/pull/188
Full Changelog: https://github.com/tox-dev/py-filelock/compare/3.9.0...3.9.1
Use time.perf_counter() instead of time.monotonic() to calculate timeouts. PR #194 - by @zpz .
Use time.perf_counter instead of time.monotonic to calculate timeouts. 194 - by zpz.
Move to hatchling build backend by @gaborbernat in https://github.com/tox-dev/py-filelock/pull/185
Full Changelog: https://github.com/tox-dev/py-filelock/compare/3.8.2...3.9.0
Bump pypa/gh-action-pypi-publish from 1.5.1 to 1.6.1 by @dependabot in https://github.com/tox-dev/py-filelock/pull/178
Full Changelog: https://github.com/tox-dev/py-filelock/compare/3.8.1...3.8.2
Update the published license classifier to Unlicense. PR #180 - by @jond01
Update the published license classifier to Unlicense. 180 - by jond01
[pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/tox-dev/py-filelock/pull/166
Full Changelog: https://github.com/tox-dev/py-filelock/compare/3.8.0...3.8.1
Make FileLock valid in mypy type annotations. PR #177 - by @gaborbernat .
Make ~filelock.FileLock valid in mypy type annotations. 177 - by gaborbernat.
[pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/tox-dev/py-filelock/pull/149
Full Changelog: https://github.com/tox-dev/py-filelock/compare/3.7.1...3.8.0
Add Python 3.11 support. PR #158 - by @gaborbernat .
State timeout units in the API docstrings. PR #148 - by @jnordberg .
Add Python 3.11 support. 158 - by gaborbernat.
State timeout units in the API docstrings. 148 - by jnordberg.
- Point README documentation links to the site index - by @gaborbernat .
Point README documentation links to the site index - by @gaborbernat .
Point README documentation links to the site index - by gaborbernat.
- Allow a lock attempt to return immediately when the lock cannot be acquired. PR #142 - by @myheroyuki .
Allow a lock attempt to return immediately when the lock cannot be acquired. PR #142 - by @myheroyuki .
Allow a lock attempt to return immediately when the lock cannot be acquired. 142 - by myheroyuki.
- Fix pylint warning “Abstract class WindowsFileLock with abstract methods instantiated” PR #135 - by @vonschultz
Fix pylint warning “Abstract class WindowsFileLock with abstract methods instantiated” PR #135 - by @vonschultz
Fix pylint warning “Abstract class UnixFileLock with abstract methods instantiated” PR #135 - by @vonschultz
Fix pylint warning "Abstract class ~filelock.WindowsFileLock with abstract methods instantiated" 135 - by vonschultz
Fix pylint warning "Abstract class ~filelock.UnixFileLock with abstract methods instantiated" 135 - by vonschultz
- Use a monotonic clock for timeouts so wall-clock changes do not change their duration. PR #136 - by @avian2 .
Use a monotonic clock for timeouts so wall-clock changes do not change their duration. PR #136 - by @avian2 .
Use a monotonic clock for timeouts so wall-clock changes do not change their duration. 136 - by avian2.
- Allow a lock to be used as a context decorator. PR #128 - by Hirsch Alter.
Allow a lock to be used as a context decorator. PR #128 - by Hirsch Alter.
Allow a lock to be used as a context decorator. 128 - by Hirsch Alter.
- Drop Python 3.6 support. PR #125 - by @gaborbernat .
Drop Python 3.6 support. PR #125 - by @gaborbernat .
- Point argument deprecation warnings at the caller by setting stacklevel . PR #121 - by @XuehaiPan .
Point argument deprecation warnings at the caller by setting stacklevel . PR #121 - by @XuehaiPan .
Point argument deprecation warnings at the caller by setting stacklevel. 121 - by XuehaiPan.
- Add correct spelling of poll interval parameter for acquire() method, raise deprecation warning when using the misspelled form PR #119 - by @XuehaiP…
Add correct spelling of poll interval parameter for acquire() method, raise deprecation warning when using the misspelled form PR #119 - by @XuehaiPan .
Add correct spelling of poll interval parameter for ~filelock.BaseFileLock.acquire method, raise deprecation warning when using the misspelled form 119 - by XuehaiPan.
- Accept pathlib.Path and pathlib.PurePath in the FileLock constructor. PR #110 - by @f-koehler .
Accept pathlib.Path and pathlib.PurePath in the FileLock constructor. PR #110 - by @f-koehler .
Accept pathlib.Path and pathlib.PurePath in the ~filelock.FileLock constructor. 110 - by f-koehler.
- Leave the log level of the filelock logger as not set (previously was set to warning) PR #108 - by @gaborbernat
Leave the log level of the filelock logger as not set (previously was set to warning) PR #108 - by @gaborbernat
Add changelog to the documentation PR #108 - by @gaborbernat
Leave the log level of the filelock logger as not set (previously was set to warning) 108 - by gaborbernat
Add changelog to the documentation 108 - by gaborbernat
- Drop Python 2.7 and 3.5 support. PR #100 - by @gaborbernat .
Drop Python 2.7 and 3.5 support. PR #100 - by @gaborbernat .
Add type annotations. PR #100 - by @gaborbernat .
Document asyncio support - by @gaborbernat
Drop Python 2.7 and 3.5 support. 100 - by gaborbernat.
Add type annotations. 100 - by gaborbernat.
Document asyncio support - by gaborbernat
- Changed logger name from filelock._api to filelock PR #97 - by @hkennyv
Changed logger name from filelock._api to filelock PR #97 - by @hkennyv
Add a tutorial covering lock acquisition, timeouts, and recursive use - by @gaborbernat .
Changed logger name from filelock._api to filelock 97 - by hkennyv
Add a tutorial covering lock acquisition, timeouts, and recursive use - by gaborbernat.
1. #96 - Raise when trying to acquire in R/O or missing folder 2. #95 - Move log from info to debug
Move lock acquire/release log from INFO to DEBUG PR #95 - by @gaborbernat
Raise when trying to acquire in R/O or missing folder PR #96 - by @gaborbernat
Move lock acquire/release log from INFO to DEBUG 95 - by gaborbernat
Raise when trying to acquire in R/O or missing folder 96 - by gaborbernat
- Fix the LICENSE link. PR #63 - by @sharkwouter .
Fix the LICENSE link. PR #63 - by @sharkwouter .
Update links for the project’s move to tox-dev. PR #88 - by @hugovk .
Fix the LICENSE link. 63 - by sharkwouter.
Update links for the project's move to tox-dev. 88 - by hugovk.
- Fix package setup on Python 2 - by Benedikt Schmitt.
Fix package setup on Python 2 - by Benedikt Schmitt.
Correct the timeout documentation: zero means no wait, while a negative value waits indefinitely. issue #49 - by Benedikt Schmitt; reported by @AnkurTank .
Fix package upload to PyPI by keeping the license summary on one line - by Benedikt Schmitt.
Update the published PyPI classifiers - by @hugovk .
Fix package setup on Python 2 - by Benedikt Schmitt.
Correct the timeout documentation: zero means no wait, while a negative value waits indefinitely. 49 - by Benedikt Schmitt; reported by AnkurTank.
Fix package upload to PyPI by keeping the license summary on one line - by Benedikt Schmitt.
Update the published PyPI classifiers - by hugovk.
One column per quarter.