Metadata-Version: 2.4
Name: entirius-py-lockfile
Version: 2.0.0
Summary: File-based lock preventing concurrent runs of the same process
Project-URL: Repository, https://github.com/entirius/entirius-py-lockfile
Author: Entirius
License-Expression: MPL-2.0
License-File: LICENSE
Requires-Python: >=3.11
Provides-Extra: dev
Requires-Dist: pre-commit; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Provides-Extra: test
Requires-Dist: pytest; extra == 'test'
Description-Content-Type: text/markdown

# lockfile

File-based lock (via `fcntl.flock`) preventing concurrent runs of the same process —
atomic across forked processes, unlike thread-level locks and semaphores.

## Installation

```shell
pip install entirius-py-lockfile
```

## Usage

```python
from lockfile import LockFile

lock = LockFile("/var/run/my-job.lock")
lock.acquire()          # raises if already held (non-blocking by default)
try:
    ...                 # critical section
finally:
    lock.release()
```

Pass `wait_for_acquire=True` to block until the lock is available instead of raising.

## Development

```shell
make install     # sync dependencies (uv)
make check       # lint + format check (ruff)
make test        # test suite (pytest)
```

Development and agent instructions: [AGENTS.md](AGENTS.md).

## License

Mozilla Public License 2.0 — see [LICENSE](LICENSE).
