{ "info": { "author": "Zope Foundation", "author_email": "zope-dev@zope.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Zope Public License", "Natural Language :: English", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development" ], "description": "*************************\nBasic inter-process locks\n*************************\n\nThe zc.lockfile package provides a basic portable implementation of\ninterprocess locks using lock files. The purpose if not specifically\nto lock files, but to simply provide locks with an implementation\nbased on file-locking primitives. Of course, these locks could be\nused to mediate access to *other* files. For example, the ZODB file\nstorage implementation uses file locks to mediate access to\nfile-storage database files. The database files and lock file files\nare separate files.\n\n.. contents::\n\nDetailed Documentation\n**********************\n\nLock file support\n=================\n\nThe ZODB lock_file module provides support for creating file system\nlocks. These are locks that are implemented with lock files and\nOS-provided locking facilities. To create a lock, instantiate a\nLockFile object with a file name:\n\n >>> import zc.lockfile\n >>> lock = zc.lockfile.LockFile('lock')\n\nIf we try to lock the same name, we'll get a lock error:\n\n >>> import zope.testing.loggingsupport\n >>> handler = zope.testing.loggingsupport.InstalledHandler('zc.lockfile')\n >>> try:\n ... zc.lockfile.LockFile('lock')\n ... except zc.lockfile.LockError:\n ... print(\"Can't lock file\")\n Can't lock file\n\n.. We don't log failure to acquire.\n\n >>> for record in handler.records: # doctest: +ELLIPSIS\n ... print(record.levelname+' '+record.getMessage())\n\nTo release the lock, use it's close method:\n\n >>> lock.close()\n\nThe lock file is not removed. It is left behind:\n\n >>> import os\n >>> os.path.exists('lock')\n True\n\nOf course, now that we've released the lock, we can create it again:\n\n >>> lock = zc.lockfile.LockFile('lock')\n >>> lock.close()\n\n.. Cleanup\n\n >>> import os\n >>> os.remove('lock')\n\nHostname in lock file\n=====================\n\nIn a container environment (e.g. Docker), the PID is typically always\nidentical even if multiple containers are running under the same operating\nsystem instance.\n\nClearly, inspecting lock files doesn't then help much in debugging. To identify\nthe container which created the lock file, we need information about the\ncontainer in the lock file. Since Docker uses the container identifier or name\nas the hostname, this information can be stored in the lock file in addition to\nor instead of the PID.\n\nUse the ``content_template`` keyword argument to ``LockFile`` to specify a\ncustom lock file content format:\n\n >>> lock = zc.lockfile.LockFile('lock', content_template='{pid};{hostname}')\n >>> lock.close()\n\nIf you now inspected the lock file, you would see e.g.:\n\n $ cat lock\n 123;myhostname\n\n\nChange History\n***************\n\n2.0 (2019-08-08)\n================\n\n- Extracted new ``SimpleLockFile`` that removes implicit behavior\n writing to the lock file, and instead allows a subclass to define\n that behavior.\n (`#15 `_)\n\n- ``SimpleLockFile`` and thus ``LockFile`` are now new-style classes.\n Any clients relying on ``LockFile`` being an old-style class will\n need to be adapted.\n\n- Drop support for Python 3.4.\n\n- Add support for Python 3.8b3.\n\n\n1.4 (2018-11-12)\n================\n\n- Claim support for Python 3.6 and 3.7.\n\n- Drop Python 2.6 and 3.3.\n\n\n1.3.0 (2018-04-23)\n==================\n\n- Stop logging failure to acquire locks. Clients can do that if they wish.\n\n- Claim support for Python 3.4 and 3.5.\n\n- Drop Python 3.2 support because pip no longer supports it.\n\n1.2.1 (2016-06-19)\n==================\n\n- Fixed: unlocking and locking didn't work when a multiprocessing\n process was running (and presumably other conditions).\n\n1.2.0 (2016-06-09)\n==================\n\n- Added the ability to include the hostname in the lock file content.\n\n- Code and ReST markup cosmetics.\n [alecghica]\n\n1.1.0 (2013-02-12)\n==================\n\n- Added Trove classifiers and made setup.py zest.releaser friendly.\n\n- Added Python 3.2, 3.3 and PyPy 1.9 support.\n\n- Removed Python 2.4 and Python 2.5 support.\n\n1.0.2 (2012-12-02)\n==================\n\n- Fixed: the fix included in 1.0.1 caused multiple pids to be written\n to the lock file\n\n1.0.1 (2012-11-30)\n==================\n\n- Fixed: when there was lock contention, the pid in the lock file was\n lost.\n\n Thanks to Daniel Moisset reporting the problem and providing a fix\n with tests.\n\n- Added test extra to declare test dependency on ``zope.testing``.\n\n- Using Python's ``doctest`` module instead of depreacted\n ``zope.testing.doctest``.\n\n1.0.0 (2008-10-18)\n==================\n\n- Fixed a small bug in error logging.\n\n1.0.0b1 (2007-07-18)\n====================\n\n- Initial release\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/zopefoundation/zc.lockfile", "keywords": "lock", "license": "ZPL 2.1", "maintainer": "", "maintainer_email": "", "name": "zc.lockfile", "package_url": "https://pypi.org/project/zc.lockfile/", "platform": "", "project_url": "https://pypi.org/project/zc.lockfile/", "project_urls": { "Homepage": "https://github.com/zopefoundation/zc.lockfile" }, "release_url": "https://pypi.org/project/zc.lockfile/2.0/", "requires_dist": [ "setuptools", "zope.testing ; extra == 'test'" ], "requires_python": "", "summary": "Basic inter-process locks", "version": "2.0" }, "last_serial": 5648300, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "6cf83766ef9935c33e240b0904c7a45e", "sha256": "1f170e46eff20ae6c81cad5465f26702f3d3435e0511fb7983cd61a6ed84d5c0" }, "downloads": -1, "filename": "zc.lockfile-1.0.0.tar.gz", "has_sig": false, "md5_digest": "6cf83766ef9935c33e240b0904c7a45e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4014, "upload_time": "2008-10-18T17:19:51", "url": "https://files.pythonhosted.org/packages/fe/cf/7e0d2764a100f3ca26ad348039593f2c699a9299c4474f84484055ac0b11/zc.lockfile-1.0.0.tar.gz" } ], "1.0.0b1": [ { "comment_text": "", "digests": { "md5": "5584c80063f6c69f5a0133ea32b05a9d", "sha256": "5c08a7c651f52c046bf92df27894d60342177b219f86b4c4eb90f7cb9c53d028" }, "downloads": -1, "filename": "zc.lockfile-1.0.0b1.tar.gz", "has_sig": false, "md5_digest": "5584c80063f6c69f5a0133ea32b05a9d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3616, "upload_time": "2007-07-18T11:27:21", "url": "https://files.pythonhosted.org/packages/70/fa/87798cd88d00418cdf43cf94bc126f5c6d1efc2d7cfaed1de7e3099cbff0/zc.lockfile-1.0.0b1.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "0b08def47a48ad298c705d8220ed23c3", "sha256": "4698b5d90234fff41e585420aec9206aa4c9f783818f7a263ab31f52ead73d34" }, "downloads": -1, "filename": "zc.lockfile-1.0.1.tar.gz", "has_sig": false, "md5_digest": "0b08def47a48ad298c705d8220ed23c3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8605, "upload_time": "2012-11-20T21:47:52", "url": "https://files.pythonhosted.org/packages/e2/8d/fa7aab5b03a96bb6a90facb6fb37a83985e83fc1866c265a8d2b271749cd/zc.lockfile-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "f099d4cf2583a0c7bea0146a44dc4d59", "sha256": "96bb2aa0438f3e29a31e4702316f832ec1482837daef729a92e28c202d8fba5c" }, "downloads": -1, "filename": "zc.lockfile-1.0.2.tar.gz", "has_sig": false, "md5_digest": "f099d4cf2583a0c7bea0146a44dc4d59", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8876, "upload_time": "2012-12-02T17:54:33", "url": "https://files.pythonhosted.org/packages/ed/80/412ad00eb5dc988d1b1f2307e70b3b3d9fb6cf1b0ca69fb989c8a06a558b/zc.lockfile-1.0.2.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "8e46b830417363501363bd09e1af1ecc", "sha256": "1489ff1c4f655420793c46af5b427537e62435b02e83e92d7f74a73ed8a56198" }, "downloads": -1, "filename": "zc.lockfile-1.1.0.zip", "has_sig": false, "md5_digest": "8e46b830417363501363bd09e1af1ecc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16645, "upload_time": "2013-02-12T21:05:44", "url": "https://files.pythonhosted.org/packages/87/11/885923d10a17a88dd8f8c9cb7dbc20830d6a630bc311dc9cd4faa343f75d/zc.lockfile-1.1.0.zip" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "8587b30ec9fa1d0bc81ca5caef49a60c", "sha256": "072f47bae2b9bf7aec8e30448f475172d74c6c7d6b54dd7304e31f3fad6ee4f4" }, "downloads": -1, "filename": "zc.lockfile-1.2.0.tar.gz", "has_sig": false, "md5_digest": "8587b30ec9fa1d0bc81ca5caef49a60c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11243, "upload_time": "2016-06-09T12:57:30", "url": "https://files.pythonhosted.org/packages/23/c7/b17e6fe624d0e7c581ca4392b4811d534ff82e036cbe9993a278a38c8aae/zc.lockfile-1.2.0.tar.gz" } ], "1.2.1": [ { "comment_text": "", "digests": { "md5": "163f0293d53a84f608f9008d9c0afc60", "sha256": "11db91ada7f22fe8aae268d4bfdeae012c4fe655f66bbb315b00822ec00d043e" }, "downloads": -1, "filename": "zc.lockfile-1.2.1.tar.gz", "has_sig": false, "md5_digest": "163f0293d53a84f608f9008d9c0afc60", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12187, "upload_time": "2016-06-19T16:27:26", "url": "https://files.pythonhosted.org/packages/bd/84/0299bbabbc9d3f84f718ba1039cc068030d3ad723c08f82a64337edf901e/zc.lockfile-1.2.1.tar.gz" } ], "1.3.0": [ { "comment_text": "", "digests": { "md5": "6624ae27089c3c52894ade444d3655b1", "sha256": "96cb13769e042988ea25d23d44cf09342ea0f887083d0f9736968f3617665853" }, "downloads": -1, "filename": "zc.lockfile-1.3.0.tar.gz", "has_sig": false, "md5_digest": "6624ae27089c3c52894ade444d3655b1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11031, "upload_time": "2018-04-23T14:15:30", "url": "https://files.pythonhosted.org/packages/f5/fe/efb94907d8b2b81c3beab1bd628ff67e310d82816b94aa00b52062727ea9/zc.lockfile-1.3.0.tar.gz" } ], "1.4": [ { "comment_text": "", "digests": { "md5": "d1a1fb34929cef8b509726a8aec2a77e", "sha256": "95a8e3846937ab2991b61703d6e0251d5abb9604e18412e2714e1b90db173253" }, "downloads": -1, "filename": "zc.lockfile-1.4.tar.gz", "has_sig": false, "md5_digest": "d1a1fb34929cef8b509726a8aec2a77e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11075, "upload_time": "2018-11-12T09:59:08", "url": "https://files.pythonhosted.org/packages/58/c2/d7c89bdad237b4b7837609172be3e8bf5630796c0020494a15b97ece8eb1/zc.lockfile-1.4.tar.gz" } ], "2.0": [ { "comment_text": "", "digests": { "md5": "b67870cfec3f19b165aab8de8c51f43f", "sha256": "cc33599b549f0c8a248cb72f3bf32d77712de1ff7ee8814312eb6456b42c015f" }, "downloads": -1, "filename": "zc.lockfile-2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b67870cfec3f19b165aab8de8c51f43f", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9712, "upload_time": "2019-08-08T05:51:19", "url": "https://files.pythonhosted.org/packages/6c/2a/268389776288f0f26c7272c70c36c96dcc0bdb88ab6216ea18e19df1fadd/zc.lockfile-2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3895445752278ddcc4578658c3c9a492", "sha256": "307ad78227e48be260e64896ec8886edc7eae22d8ec53e4d528ab5537a83203b" }, "downloads": -1, "filename": "zc.lockfile-2.0.tar.gz", "has_sig": false, "md5_digest": "3895445752278ddcc4578658c3c9a492", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11923, "upload_time": "2019-08-08T05:51:21", "url": "https://files.pythonhosted.org/packages/11/98/f21922d501ab29d62665e7460c94f5ed485fd9d8348c126697947643a881/zc.lockfile-2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b67870cfec3f19b165aab8de8c51f43f", "sha256": "cc33599b549f0c8a248cb72f3bf32d77712de1ff7ee8814312eb6456b42c015f" }, "downloads": -1, "filename": "zc.lockfile-2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b67870cfec3f19b165aab8de8c51f43f", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9712, "upload_time": "2019-08-08T05:51:19", "url": "https://files.pythonhosted.org/packages/6c/2a/268389776288f0f26c7272c70c36c96dcc0bdb88ab6216ea18e19df1fadd/zc.lockfile-2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3895445752278ddcc4578658c3c9a492", "sha256": "307ad78227e48be260e64896ec8886edc7eae22d8ec53e4d528ab5537a83203b" }, "downloads": -1, "filename": "zc.lockfile-2.0.tar.gz", "has_sig": false, "md5_digest": "3895445752278ddcc4578658c3c9a492", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11923, "upload_time": "2019-08-08T05:51:21", "url": "https://files.pythonhosted.org/packages/11/98/f21922d501ab29d62665e7460c94f5ed485fd9d8348c126697947643a881/zc.lockfile-2.0.tar.gz" } ] }