This package provides static type checking stubs for the `filelock` library, enabling tools like MyPy to verify type correctness. It is part of the Python typeshed project, which maintains high-quality stubs generally kept up-to-date with the latest versions of their respective runtime libraries. Releases follow typeshed's continuous integration and release cycle, reflecting updates to the underlying `filelock` library.
pip install types-filelockVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates the usage of the `filelock` library, for which `types-filelock` provides type hints. To run this code with type checking, ensure both `filelock` and `types-filelock` are installed. The `FileLock` context manager ensures that the enclosed code block is executed exclusively, preventing race conditions across processes.
Ensure `filelock` is listed in your project's dependencies and installed alongside `types-filelock`.
Always import symbols directly from the `filelock` package, e.g., `from filelock import FileLock`.
If encountering type errors due to new `filelock` features, consider pinning `filelock` to an older version until stubs are updated, or temporarily ignoring specific `mypy` errors.