[build-system] build-backend = "hatchling.build" requires = [ "hatch-vcs>=0.5", "hatchling>=1.29", ] [project] name = "filelock" description = "A platform independent file lock." readme = "README.md" keywords = [ "application", "cache", "directory", "log", "user", ] license = "MIT" maintainers = [ { name = "Bernát Gábor", email = "gaborjbernat@gmail.com" }, ] requires-python = ">=3.10" classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", "Programming Language :: Python :: 3.15", "Topic :: Internet", "Topic :: Software Development :: Libraries", "Topic :: System", ] dynamic = [ "version", ] urls.Documentation = "https://py-filelock.readthedocs.io" urls.Homepage = "https://github.com/tox-dev/py-filelock" urls.Source = "https://github.com/tox-dev/py-filelock" urls.Tracker = "https://github.com/tox-dev/py-filelock/issues" [dependency-groups] dev = [ { include-group = "coverage" }, { include-group = "docs" }, { include-group = "fix" }, { include-group = "pkg-meta" }, { include-group = "release" }, { include-group = "test" }, { include-group = "type" }, ] test = [ "covdefaults>=2.3", "diff-cover>=10.2", "exceptiongroup>=1.2; python_version<'3.11'", "pytest>=9.0.3", "pytest-asyncio>=1.3", "pytest-cov>=7.1", "pytest-mock>=3.15.1", "pytest-randomly>=3.16", "pytest-timeout>=2.4", "virtualenv>=21.2", ] type = [ "ty>=0.0.30", { include-group = "docs" }, { include-group = "release" }, { include-group = "test" }, ] docs = [ "furo>=2025.12.19", "sphinx>=9.1", "sphinx-autodoc-typehints>=3.9.11", "sphinx-copybutton>=0.5.2", "sphinx-design>=0.7", "sphinx-llm>=0.4.1", "sphinx-sitemap>=2.9", "sphinxcontrib-mermaid>=2.0.1", "sphinxcontrib-towncrier>=0.5.0a0", "sphinxext-opengraph>=0.13", "towncrier>=24.8", ] coverage = [ "covdefaults>=2.3", "coverage[toml]>=7.13.5", "diff-cover>=10.2", ] fix = [ "pre-commit-uv>=4.2.1", ] pkg-meta = [ "check-wheel-contents>=0.6.3", "twine>=6.2", "uv>=0.11.5", ] release = [ "towncrier>=24.8", ] [tool.hatch] version.source = "vcs" build.hooks.vcs.version-file = "src/filelock/version.py" build.targets.sdist.include = [ "/src", "/tasks", "/tests", "/tox.toml", ] [tool.ruff] line-length = 120 format.preview = true format.docstring-code-line-length = 100 format.docstring-code-format = true lint.select = [ "ALL", ] lint.ignore = [ "CPY", # No copyright statements "DOC", # no support yet "escape-sequence-in-docstring", # Use `r"""` if any backslashes in a docstring "hardcoded-bind-all-interfaces", # Possible binding to all interface "incorrect-blank-line-before-class", # `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible "missing-blank-line-after-summary", # 1 blank line required between summary line and description "missing-trailing-comma", # Conflict with formatter "multi-line-summary-first-line", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible "non-empty-init-module", # `__init__` module should only contain docstrings and re-exports "non-imperative-mood", # First line of docstring should be in imperative mood "single-line-implicit-string-concatenation", # Conflict with formatter ] lint.per-file-ignores."tasks/**/*.py" = [ "assert", # asserts state the platform a Windows-only script already refuses to run outside of, narrowing it for ty "D", # don't care about documentation in tasks scripts "implicit-namespace-package", # no implicit namespace "print", # print allowed in scripts "subprocess-without-shell-equals-true", # `subprocess` call: check for execution of untrusted input ] lint.per-file-ignores."tests/**/*.py" = [ "assert", # asserts allowed in tests "blind-except", # blind exception catching acceptable in test helpers "D", # don't care about documentation in tests "FBT", # don't care about booleans as positional arguments in tests "implicit-namespace-package", # no implicit namespace "import-outside-top-level", # import should be at top-level "import-private-name", # private name import from external module "magic-value-comparison", # Magic value used in comparison, consider replacing with a constant variable "non-lowercase-variable-in-function", # variable in function should be lowercase "private-member-access", # accessing private members acceptable in tests "subprocess-without-shell-equals-true", # `subprocess` call: check for execution of untrusted input "too-many-arguments", # too many arguments in function definition "too-many-positional-arguments", # too many positional arguments "too-many-statements-in-try-clause", # try/finally cleanup blocks in tests legitimately hold many statements ] lint.isort = { known-first-party = [ "filelock", ], required-imports = [ "from __future__ import annotations", ] } lint.preview = true [tool.codespell] builtin = "clear,usage,en-GB_to_en-US" ignore-words-list = "master" count = true quiet-level = 3 [tool.pyproject-fmt] max_supported_python = "3.15" [tool.ty] src.exclude = [] # Mirrors pytest's pythonpath so the tests' `coverage_pragmas` import resolves here too. environment.extra-paths = [ ".", "tasks", ] environment.python-version = "3.14" [tool.pytest] ini_options.testpaths = [ "tests", ] # The project root lets the tests import each other as tests.*; tasks holds coverage_pragmas, whose CAPABILITIES probes # drive both the coverage exclusions and the skipif gates, so a test can never be skipped while coverage still demands # its lines. coverage imports that plugin by name in the subprocesses it patches, so it stays a top-level module. ini_options.pythonpath = [ ".", "tasks", ] ini_options.markers = [ "requires_hard_links: exercises StrictSoftFileLock, which needs os.link; skipped where it is missing (Termux/Android)", ] ini_options.filterwarnings = [ "error", # CPython's resource tracker refuses to unregister a semaphore while it is already cleaning up, and warns instead. # multiprocessing.Event and Value expose no close, so only the collector frees them, and it picks the moment. Seen # on 3.12 alone. Filtering the tracker's own warning keeps the finalizer from raising rather than hiding the raise. "ignore:ResourceTracker called reentrantly for resource cleanup:UserWarning", ] ini_options.verbosity_assertions = 2 ini_options.asyncio_default_fixture_loop_scope = "session" ini_options.timeout = 20 [tool.coverage] # The pragma plugin configures the run; measuring it would report the tooling alongside the package under test. run.omit = [ "*/tasks/*", ] run.concurrency = [ "multiprocessing", "thread", ] run.parallel = true run.plugins = [ "covdefaults", "coverage_pragmas", ] run.patch = [ "_exit", "subprocess", ] run.sigterm = true paths.other = [ ".", "*/filelock", "*\\filelock", ] paths.source = [ "src", "*/.tox/*/lib/*/site-packages", "*/.tox/*/Lib/site-packages", "**/src", "**\\src", ] report.fail_under = 100 html.skip_covered = false [tool.towncrier] name = "filelock" directory = "docs/changelog" filename = "docs/changelog.rst" template = "docs/changelog/template.jinja2" title_format = false issue_format = ":pr:`{issue}`" type = [ { directory = "breaking", name = "Backward incompatible changes", showcontent = true }, { directory = "feature", name = "Features", showcontent = true }, { directory = "bugfix", name = "Bug fixes", showcontent = true }, { directory = "doc", name = "Improved documentation", showcontent = true }, { directory = "packaging", name = "Packaging updates", showcontent = true }, ]