A lock and a witness for config files too many hands edit: flock plus a content-hash compare-and-swap refuse a write whose base bytes moved, and inotify with /proc names whoever writes around the lock. Stdlib only. Python, MIT licensed, standard library first. Source and docs: https://gitlab.com/ameobius-ai/cfg-guard
cfg-guard is a Python library that provides file-level locking and change-witnessing for configuration files using flock, content-hash compare-and-swap, and inotify.
- for
- Developers who need safe concurrent edits of config files in Python projects
- pricing
- open source
works withPython
Key features
6 features of cfg-guard
- Flock-based lock — Uses OS file lock (flock) to prevent simultaneous writes.
- Content-hash compare-and-swap — Refuses a write if the base file bytes have changed since read.
- Inotify + /proc writer identification — Detects and reports the process that attempted an out-of-order write.
- Standard-library only — No external dependencies; works with Python's stdlib.
- Simple installation — Install via pip with a single command.
- MIT licensed source — Open-source code hosted on GitLab.
Use cases
- Prevent concurrent CI jobs from overwriting shared config files
- Audit which process modified a configuration during deployment
- Ensure config integrity when multiple developers edit the same file
- Guard critical service configuration against accidental corruption
cfg-guard vs alternatives
cfg-guard | Snyk | Gitea | ||
|---|---|---|---|---|
| Best for | File locking with change audit | Vulnerability and misconfiguration scanning | Static code security analysis | Self-hosted Git repositories |
| Pricing | Open source | Free | Subscription | Free |
| DevHunt upvotes | 1 | 0 | 0 | 0 |
| Launched | Oct 2031 | — | — | — |
- cfg-guard vs Trivy: Trivy scans for misconfigurations, not file-level locking
- cfg-guard vs Snyk: Semgrep performs static code analysis, not runtime file locking
- cfg-guard vs Gitea: Gitea is a Git service for code hosting, unrelated to config file locking
cfg-guard FAQ
How do I install cfg-guard?+
Run pip install cfg-guard to add the library to your Python environment.
What kind of files does it protect?+
It is designed for configuration files that may be edited by multiple processes or users.
Does cfg-guard require any external services?+
No, it relies only on the Python standard library and OS primitives.
How does it identify the writer of a conflicting change?+
It uses inotify together with /proc to name the process that attempted to write around the lock.
Is the project open source?+
Yes, the code is MIT licensed and hosted on GitLab.
Summarized by DevHunt from ameobius-products.ameobius-lane.workers.dev · Oct 24, 2026. Details may change; check the official site.

cfg-guard
Snyk
Gitea




