{"id":15937019,"url":"https://github.com/jonasrauber/lockfile","last_synced_at":"2025-06-22T07:38:05.536Z","repository":{"id":78301481,"uuid":"263284565","full_name":"jonasrauber/lockfile","owner":"jonasrauber","description":"lockfile provides a minimalistic and modern implementation of a simple file-based lock mechanism for Python","archived":false,"fork":false,"pushed_at":"2020-05-12T09:54:32.000Z","size":9,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T19:47:17.456Z","etag":null,"topics":["filelock","lock","lockfile","multiprocessing","python","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonasrauber.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-12T08:56:37.000Z","updated_at":"2023-07-02T08:23:47.000Z","dependencies_parsed_at":"2023-07-24T13:30:51.264Z","dependency_job_id":null,"html_url":"https://github.com/jonasrauber/lockfile","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jonasrauber/lockfile","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonasrauber%2Flockfile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonasrauber%2Flockfile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonasrauber%2Flockfile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonasrauber%2Flockfile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonasrauber","download_url":"https://codeload.github.com/jonasrauber/lockfile/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonasrauber%2Flockfile/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261255901,"owners_count":23131479,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["filelock","lock","lockfile","multiprocessing","python","python3"],"created_at":"2024-10-07T04:41:44.089Z","updated_at":"2025-06-22T07:38:00.521Z","avatar_url":"https://github.com/jonasrauber.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n   :target: https://github.com/ambv/black\n\n======================================================================================\nlockfile\n======================================================================================\n\n🔥 Why lockfile\n----------------\n\n**lockfile** provides a minimalistic and modern\nimplementation of a simple file-based lock mechanism for Python.\n\n- **Minimalistic**: lockfile does one thing, and one thing only\n- **Modern**: lockfile supports ``pathlib.Path`` objects\n- **Type annotated**: lockfile provides comprehensive type annotations\n- **Convinient**: lockfile automatically appendx a ``.lock`` suffix if needed\n- **Clean**: all code is formatted with `Black \u003chttps://black.readthedocs.io/\u003e`_\n  and checked with `MyPy \u003chttps://mypy.readthedocs.io/\u003e`_\n  and `flake8 \u003chttps://flake8.pycqa.org/\u003e`_\n\nThere are a number of alternatives such as\n`py-filelock \u003chttps://github.com/benediktschmitt/py-filelock\u003e`_ and\n`FileLock \u003chttps://github.com/dmfrey/FileLock\u003e`_ that actually inspired\nthis project but are more complex and somewhat outdated.\n\n\n📖 Documentation\n-----------------\n\nJust look at this README and the code, it's really simple.\n\n\n🚀 Quickstart\n--------------\n\nNo installation, just copy\n`lockfile.py \u003chttps://github.com/jonasrauber/lockfile/raw/master/lockfile.py\u003e`_\nto your project. It has zero dependencies beyond Python 3.6 or newer.\n\nIf you think an installable package might be useful, just open an issue.\n\n\n🎉 Example\n-----------\n\nYou can safely run the following code in two separate processes:\n\n.. code-block:: python\n\n   from pathlib import Path\n   from lockfile import Lock\n\n   path = Path(\"example.txt\")\n   with Lock(path):\n       # Note: you don't need to use the lock to write to that specific file,\n       # it can be used for anything\n\n       with open(path, \"w\") as f:\n           f.write(\"Hello!\")\n\n\n🗺 Use cases\n------------\n\nWhenever you need a simple, file-based locking mechanism in Python, for example\nwhen you want to write to the same file from different processes, possibly\neven from different machines using a shared file system (Note: NFS will\nusually not provide the necessary guarantees, but there are other shared\n(cluster) file systems that do).\n\n\n🐍 Compatibility\n-----------------\n\nPython 3.6 and newer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonasrauber%2Flockfile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonasrauber%2Flockfile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonasrauber%2Flockfile/lists"}