1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
|
[project]
name = 'flufl.lock'
authors = [
{name = 'Barry Warsaw', email = 'barry@python.org'},
]
description = 'NFS-safe file locking with timeouts for POSIX and Windows'
readme = 'README.rst'
requires-python = '>=3.10'
license = {text = 'Apache-2.0'}
keywords = [
'locking',
'locks',
'lock',
]
classifiers = [
'Development Status :: 5 - Production/Stable',
'Development Status :: 6 - Mature',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Operating System :: POSIX',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
]
dependencies = [
'atpublic',
'psutil',
]
dynamic = ['version']
[dependency-groups]
docs = [
'furo',
'sphinx',
'sphinx-autobuild',
'sphinx-copybutton',
]
[project.urls]
'Home Page' = 'https://flufllock.readthedocs.io'
'Documentation' = 'https://flufllock.readthedocs.io'
'Source Code' = 'https://gitlab.com/warsaw/flufl.lock.git'
'Bug Tracker' = 'https://gitlab.com/warsaw/flufl.lock/issues'
[tool.hatch.version]
path = 'src/flufl/lock/__init__.py'
[tool.hatch.build.targets.wheel]
packages = [
'src/flufl',
]
[tool.hatch.build.targets.sdist]
include = [
'src/flufl/',
'docs/',
'tests/',
'conftest.py',
]
excludes = [
'**/.mypy_cache',
]
[tool.hatch.envs.default]
installer = 'uv'
[tool.hatch.envs.default.scripts]
all = [
'hatch test --all',
'hatch run qa:qa',
'hatch run docs:docs',
]
[tool.hatch.envs.hatch-test]
default-args = ['tests', 'docs']
extra-dependencies = [
'diff-cover',
'sybil',
]
[tool.hatch.envs.hatch-test.scripts]
run = [
'coverage run -m pytest{env:HATCH_TEST_ARGS:} {args}',
'coverage combine',
'coverage report',
'coverage xml',
'- diff-cover coverage.xml',
]
run-cov = 'hatch test'
cov-combine = ''
cov-report = ''
[[tool.hatch.envs.test.matrix]]
python = ['3.10', '3.11', '3.12', '3.13', '3.14']
[tool.hatch.envs.qa]
dependencies = [
'ruff',
'mypy',
]
[tool.hatch.envs.qa.env-vars]
MODULE_NAME = '{env:MODULE_NAME:flufl.lock}'
MODULE_PATH = '{env:MODULE_PATH:src/flufl/lock}'
[tool.hatch.envs.qa.scripts]
qa = [
'hatch fmt --check src',
'mypy -p {env:MODULE_NAME}',
]
fix = [
'hatch fmt src',
]
preview = [
'hatch fmt --diff src',
]
[tool.hatch.envs.hatch-static-analysis]
config-path = 'none'
[tool.hatch.envs.docs]
dependency-groups = [
'docs',
]
[tool.hatch.envs.docs.scripts]
docs = [
'sphinx-build docs build/html',
]
serve = [
'sphinx-autobuild docs build/html --port 9000 --open-browser',
]
[tool.coverage.run]
source = ['flufl.lock']
branch = true
parallel = true
[tool.coverage.report]
fail_under = 100
show_missing = true
exclude_also = [
'if TYPE_CHECKING:',
]
[tool.ruff]
line-length = 100
src = ['src']
[tool.ruff.lint.extend-per-file-ignores]
# Essentially, ignore all lint warnings in these configuration files.
'conftest.py' = [
'ARG002',
'I001',
'S101',
]
'docs/conf.py' = [
'A',
'DTZ',
'E',
'I',
'UP',
]
'src/flufl/lock/_lockfile.py' = [
# Naive datetimes are fine for our purposes.
'DTZ005', # `datetime.datetime.now()` called without a `tz` argument
'DTZ006', # `datetime.datetime.fromtimestamp()` called without a `tz` argument
'EM101', # Exception must not use a string literal, assign to variable first
# We use constant `2` for linkcount checks in places.
'PLR2004', # Magic value used in comparison
# Lock.__enter__() is annotated to reutrn `Lock` rather than `Self`. I don't want to add a
# conditional runtime dependency on typing_extensions just for this type. Once Python 3.11 is
# our minimim version, we can change the return annotation of this function to Self.
'PYI034', # `__enter__` methods in classes like `Lock` usually return `self` at runtime
# We use random.randint() for non-cryptographic purposes.
'S311', # Standard pseudo-random generators are not suitable for cryptographic purposes
'TRY003', # Avoid specifying long messages outside the exception class
'TRY400', # Use `logging.exception` instead of `logging.error`
]
[tool.ruff.format]
quote-style = 'single'
[tool.ruff.lint.pydocstyle]
convention = 'pep257'
[tool.ruff.lint.isort]
case-sensitive = true
classes = ['SEP']
forced-separate = ['docutils', 'sphinx']
known-first-party = ['flufl.lock']
length-sort-straight = true
lines-after-imports = 2
lines-between-types = 1
order-by-type = true
section-order = ['standard-library', 'third-party', 'local-folder', 'first-party']
[tool.mypy]
mypy_path = 'src'
# Disallow dynamic typing
disallow_any_generics = true
disallow_subclassing_any = true
# Untyped definitions and calls
disallow_untyped_calls = false
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_untyped_decorators = false
# None and Optional handling
no_implicit_optional = true
# Configuring warnings
warn_redundant_casts = true
warn_unused_ignores = true
warn_no_return = true
warn_return_any = true
warn_unreachable = true
# Miscellaneous strictness flags
implicit_reexport = false
strict_equality = true
# Configuring error messages
show_error_context = true
show_column_numbers = true
show_error_codes = true
pretty = true
show_absolute_path = true
# Miscellaneous
warn_unused_configs = true
verbosity = 0
[[tool.mypy.overrides]]
module = [
'psutil',
'pytest',
'sybil.*',
]
ignore_missing_imports = true
[build-system]
requires = ['hatchling']
build-backend = 'hatchling.build'
|