lockfile 0.2 - platform-independent advisory locks for Python

skip at pobox.com skip at pobox.com
Sat Nov 17 13:47:25 CET 2007


I've released lockfile 0.2.  Changes since the 0.1 release:

    * Added 2.4.diff file to patch lockfile to work with Python 2.4 (removes
      use of with statement).

    * Renamed _FileLock base class to LockBase to expose it (and its
      docstrings) to pydoc.

    * Got rid of time.sleep() calls in tests (thanks to Konstantin
      Veretennicov).

    * Use thread.get_ident() as the thread discriminator.

    * Updated documentation a bit.

What is lockfile?
=================

A number of implementations of file locks are out there, but as an
exploration of the possibilities I wrote the lockfile module.  It offers
these features:

    * A platform-independent API
    * Three classes implementing file locks
      - LinkFileLock - relies on atomic nature of the link(2) system call.
      - MkdirFileLock - relies on atomic nature of the mkdir(2) systemm
        call.
      - SQLiteFileLock - provides locks through a SQLite database.
    * Locking is done on a per-thread basis by default, though locking can
      be done on a per-process basis instead.
    * Context manager support.

The lockfile module is available from PyPI:

    http://pypi.python.org/pypi/lockfile/

I welcome feedback from anyone who gives it a whirl.  The code is stored in
a Mercurial repository on my laptop, so subject to occasional access
problems when I'm on the train others are welcome to have access to the
source code.  If that's of interest to you, drop me a note.

-- 
Skip Montanaro - skip at pobox.com - http://www.webfast.com/~skip/


More information about the Python-announce-list mailing list