Skip to main content

Platform-independent file locking module

Project description

The lockfile package exports a LockFile class which provides a simple API for locking files. Unlike the Windows msvcrt.locking function, the fcntl.lockf and flock functions, and the deprecated posixfile module, the API is identical across both Unix (including Linux and Mac) and Windows platforms. The lock mechanism relies on the atomic nature of the link (on Unix) and mkdir (on Windows) system calls. An implementation based on SQLite is also provided, more as a demonstration of the possibilities it provides than as production-quality code.

Note: In version 0.9 the API changed in two significant ways:

  • It changed from a module defining several classes to a package containing several modules, each defining a single class.
  • Where classes had been named SomethingFileLock before the last two words have been reversed, so that class is now SomethingLockFile.

The previous module-level definitions of LinkFileLock, MkdirFileLock and SQLiteFileLock will be retained until the 1.0 release.

Available from:

git://git.openstack.org/openstack/pylockfile

To install:

pip install lockfile

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for lockfile, version 0.10.2
Filename, size File type Python version Upload date Hashes
Filename, size lockfile-0.10.2-py2-none-any.whl (12.9 kB) File type Wheel Python version py2 Upload date Hashes View hashes
Filename, size lockfile-0.10.2.tar.gz (20.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page