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 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281
|
# SPDX-License-Identifier: MIT OR Apache-2.0
[build-system]
requires = ["hatchling", "hatch-vcs", "hatch-fancy-pypi-readme>=22.8.0"]
build-backend = "hatchling.build"
[project]
dynamic = ["readme", "version"]
name = "structlog"
description = "Structured Logging for Python"
authors = [{ name = "Hynek Schlawack", email = "hs@ox.cx" }]
requires-python = ">=3.8"
license = "MIT OR Apache-2.0"
keywords = ["logging", "structured", "structure", "log"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: Apache Software License",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"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",
"Topic :: System :: Logging",
"Typing :: Typed",
]
dependencies = ["typing-extensions; python_version<'3.11'"]
[project.urls]
Documentation = "https://www.structlog.org/"
Changelog = "https://github.com/hynek/structlog/blob/main/CHANGELOG.md"
GitHub = "https://github.com/hynek/structlog"
Funding = "https://github.com/sponsors/hynek"
Tidelift = "https://tidelift.com?utm_source=lifter&utm_medium=referral&utm_campaign=hynek"
Mastodon = "https://mastodon.social/@hynek"
Bluesky = "https://bsky.app/profile/hynek.me"
Twitter = "https://twitter.com/hynek"
[dependency-groups]
tests = [
"freezegun>=0.2.8",
"pretend",
"pytest-asyncio>=0.17",
"pytest>=6.0",
"simplejson",
]
# Need Twisted & Rich for stubs.
# Otherwise mypy fails in tox.
typing = ["mypy>=1.4", "rich", "twisted"]
docs = [
"cogapp",
"furo",
"myst-parser",
"sphinx",
"sphinx-notfound-page",
"sphinxcontrib-mermaid",
"sphinxext-opengraph",
"twisted",
]
dev = [
{include-group = "tests"},
{include-group = "typing"},
]
[tool.hatch.version]
source = "vcs"
raw-options = { local_scheme = "no-local-version" }
[tool.pytest.ini_options]
addopts = ["-ra", "--strict-markers", "--strict-config"]
testpaths = "tests"
xfail_strict = true
filterwarnings = ["once::Warning"]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
[tool.coverage.run]
parallel = true
branch = true
source = ["structlog"]
[tool.coverage.paths]
source = ["src", ".tox/py*/**/site-packages"]
[tool.coverage.report]
show_missing = true
skip_covered = true
omit = ["src/structlog/_greenlets.py"]
exclude_lines = [
# a more strict default pragma
"\\# pragma: no cover\\b",
# allow defensive code
"^\\s*raise AssertionError\\b",
"^\\s*raise NotImplementedError\\b",
"^\\s*return NotImplemented\\b",
"^\\s*raise$",
# typing-related code
"^if (False|TYPE_CHECKING):",
": \\.\\.\\.(\\s*#.*)?$",
"^ +\\.\\.\\.$",
"-> ['\"]?NoReturn['\"]?:",
]
[tool.interrogate]
omit-covered-files = true
verbose = 2
fail-under = 100
whitelist-regex = ["test_.*"]
[tool.ruff]
src = ["src", "tests"]
line-length = 79
[tool.ruff.lint]
select = ["ALL"]
ignore = [
"A", # shadowing is fine
"ANN", # Mypy is better at this
"ARG", # unused arguments are common w/ interfaces
"C901", # sometimes you trade complexity for performance
"COM", # Formatter takes care of our commas
"D", # We prefer our own docstring style.
"E501", # leave line-length enforcement to formatter
"EM101", # simple strings are fine
"FBT", # bools are our friends
"FIX", # Yes, we want XXX as a marker.
"INP001", # sometimes we want Python files outside of packages
"ISC001", # conflicts with formatter
"N802", # some names are non-pep8 due to stdlib logging / Twisted
"N803", # ditto
"N806", # ditto
"PLR0913", # leave complexity to me
"PLR2004", # numbers are sometimes fine
"PLW2901", # overwriting a loop var can be useful
"RUF001", # leave my smart characters alone
"SLF001", # private members are accessed by friendly functions
"T201", # prints are fine
"TC", # TYPE_CHECKING blocks break autodocs
"TD", # we don't follow other people's todo style
"TID252", # Relative imports are fine
"TRY003", # simple strings are fine
"TRY004", # too many false negatives
"TRY300", # else blocks are nice, but code-locality is nicer
"PTH", # pathlib can be slow, so no point to rewrite
]
[tool.ruff.lint.per-file-ignores]
"tests/*" = [
"B018", # "useless" expressions can be useful in tests
"BLE", # tests have different rules around exceptions
"EM", # tests have different rules around exceptions
"LOG001", # need to instantiate log messages in tests
"PLC1901", # empty strings are falsey, but are less specific in tests
"RUF012", # no type hints in tests
"S", # it's test; chill out security
"SIM300", # Yoda rocks in tests
"TRY", # tests have different rules around exceptions
]
[tool.ruff.lint.isort]
lines-between-types = 1
lines-after-imports = 2
[tool.mypy]
strict = true
pretty = true
show_error_codes = true
enable_error_code = ["ignore-without-code"]
ignore_missing_imports = true
warn_return_any = false
[[tool.mypy.overrides]]
module = "tests.*"
ignore_errors = true
[[tool.mypy.overrides]]
module = "tests.typing.*"
ignore_errors = false
[tool.hatch.metadata.hooks.fancy-pypi-readme]
content-type = "text/markdown"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
text = '''<p align="center">
<img
src="https://www.structlog.org/en/stable/_static/structlog_logo_small.png"
alt="structlog mascot"
/>
</p>
'''
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
path = "README.md"
start-after = "<!-- begin-short -->\n"
end-before = "\n<!-- end-short -->"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
path = "README.md"
start-after = "<!-- begin-meta -->\n"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
text = """
## Release Information
"""
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
path = "CHANGELOG.md"
start-after = "<!-- changelog follows -->"
pattern = "\n(###.+?\n)## "
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
text = """
---
[Full Changelog →](https://www.structlog.org/en/stable/changelog.html)
"""
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
path = "README.md"
start-at = "## Credits"
end-before = "<!-- begin-meta -->"
# Point sponsor image URLs to versions.
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
pattern = 'docs\/_static\/sponsors'
replacement = 'https://www.structlog.org/en/$HFPR_VERSION/_static/sponsors'
[[tool.sponcon.sponsors]]
title = "Variomedia AG"
url = "https://www.variomedia.de/"
img = "Variomedia.svg"
[[tool.sponcon.sponsors]]
title = "Tidelift"
url = "https://tidelift.com/?utm_source=lifter&utm_medium=referral&utm_campaign=hynek"
img = "Tidelift.svg"
[[tool.sponcon.sponsors]]
title = "Klaviyo"
url = "https://klaviyo.com/"
img = "Klaviyo.svg"
[[tool.sponcon.sponsors]]
title = "Privacy Solutions"
url = "https://privacy-solutions.org/"
img = "Privacy-Solutions.svg"
[[tool.sponcon.sponsors]]
title = "emsys renewables"
url = "https://www.emsys-renewables.com/"
img = "emsys-renewables.svg"
[[tool.sponcon.sponsors]]
title = "FilePreviews"
url = "https://filepreviews.io/"
img = "FilePreviews.svg"
[[tool.sponcon.sponsors]]
title = "Polar"
url = "https://polar.sh/"
img = "Polar.svg"
|