This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Project Description

Improves fcntl.flock usage.

flock is a Unix command for file locking, the mecanism that controls access restrictions of files.


Exclusive blocking lock:

from flockcontext import FlockOpen

with FlockOpen('/tmp/my.lock', 'w') as lock:

Exclusive non-blocking lock:

from flockcontext import FlockOpen

    with FlockOpen('/tmp/my.lock', 'w', blocking=False) as lock:
except IOError as e:
    print('Can not acquire lock')

Shared blocking lock:

from flockcontext import Flock

with FlockOpen('/tmp/my.lock', 'w', exclusive=False) as lock:

Acquire and release within context:

from flockcontext import FlockOpen

with FlockOpen('/tmp/my.lock', 'w') as lock:
    print('Lock acquired')

    print('Lock released')

    print('Lock acquired')

Locking alredy opened file:

from flockcontext import Flock

with open('/tmp/my.lock', 'w') as fd:
    with Flock(fd):


  • Free software: BSD license


0.3.1 (2015-08-24)

  • Add syntax highlighting for code exemples
  • Add Flock manager exemple in README

0.3.0 (2015-08-21)

  • Add FlockOpen context manager.

0.2.0 (2015-08-20)

  • Add Flock relase and acquire capability withing context.

0.1.0 (2015-08-19)

  • Add Flock context manager.
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
flockcontext-0.3.1-py2.py3-none-any.whl (5.2 kB) Copy SHA256 Checksum SHA256 3.4 Wheel Aug 24, 2015
flockcontext-0.3.1.tar.gz (13.5 kB) Copy SHA256 Checksum SHA256 Source Aug 24, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting