-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyproject.toml
263 lines (241 loc) · 6.88 KB
/
pyproject.toml
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
[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"
[project]
name = "loggia"
description = "A convenient logging configuration manager for Python's standard logging library and Loguru."
authors = [
{ name = "Gabriel Dugny", email = "[email protected]" },
{ name = "Elie Bleton", email = "[email protected]" },
{ name = "Jonathan Gallon", email = "[email protected]" },
]
dependencies = [
"python-json-logger>=2.0.7",
"typing-extensions>=4.7.1 ; python_version < '3.10'",
]
requires-python = ">=3.9"
readme = "README.md"
license = { file = "LICENSE" }
dynamic = ["version"]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: ISC License (ISCL)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Typing :: Typed",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: System :: Logging",
"Topic :: Utilities",
"Operating System :: OS Independent",
"Environment :: Console",
"Environment :: Web Environment",
]
[project.urls]
Repository = "https://github.com/ManoManoTech/loggia"
Documentation = "https://manomanotech.github.io/loggia/latest/"
Changelog = "https://manomanotech.github.io/loggia/latest/CHANGELOG/"
[project.optional-dependencies]
loguru = ["loguru>=0.7.0"]
rich = ["rich>=13.3.4"]
ddtrace = ["ddtrace>=1.18.0"]
[tool.pdm]
plugins = [
"sync-pre-commit-lock"
]
[tool.pdm.version]
source = "scm"
write_to = "loggia/_version.py"
write_template = "__version__: str = \"{}\"\n"
# Common settings for all scripts
[tool.pdm.scripts._]
env_file = ".env"
[tool.pdm.scripts]
# Lint
lint-pylint = { cmd = "pylint loggia", help = "Run pylint" }
lint-mypy = { shell = "mypy", help = "Run mypy type checker" }
lint-ruff = { cmd = "ruff check .", help = "Run ruff linter" }
lint = { composite = [
"lint-ruff",
"lint-pylint",
"lint-mypy",
], help = "Run all linters (ruff, pylint, mypy)." }
# Format
fmt-black = { cmd = "ruff format .", help = "Run ruff black-like formatter" }
fmt-ruff = { cmd = "ruff check . --fix --select I001", help = "Run isort-like import sorting with ruff" }
fmt = { composite = [
"fmt-black",
"fmt-ruff",
], help = "Run all formatters (black-like ruff, isort-like ruff)" }
# Tests
test = { cmd = "pytest", help = "Run the tests" }
test-cov = { cmd = "pytest --junitxml=pytest-report.xml --cov --cov-report xml:pytest-coverage.xml --cov-fail-under=0 --cov-report html", help = "Run the tests with coverage, and generate reports" }
# Docs
docs-serve = { cmd = "mkdocs serve", help = "Serve the docs locally" }
docs-build = { cmd = "mkdocs build --strict", help = "Build the docs" }
[tool.pdm.dev-dependencies]
dev = [
"mypy>=1.4",
"pylint>=3.0.3",
"pytest-cov>=4.0.0",
"yamllint>=1.28.0",
"ipdb>=0.13.13",
"rich>=13.3.4",
"gunicorn>=20.1.0",
"hypercorn>=0.14.3",
"ruff>=0.3.5",
"tox>=4.11.1",
"tox-pdm>=0.6.1",
]
tests = [
"pytest>=7.2.0",
"pytest-mock>=3.10.0",
"pytest-random-order>=1.1.0",
]
doc = [
"mkdocs>=1.4.2",
"mkdocs-material>=8.5.11",
"mkdocs-git-revision-date-plugin>=0.3.2",
"mkdocs-include-markdown-plugin>=6.0.0",
"mkdocstrings[python]>=0.19.1",
"mkdocs-section-index>=0.3.4",
"mdx-truly-sane-lists>=1.3",
"mike>=1.1.2",
"black>=24.4.2",
]
debug = ["check-wheel-contents>=0.4.0"]
[tool.pytest]
[tool.pytest.ini_options]
minversion = "7.0"
addopts = "-ra -q --pdbcls=IPython.terminal.debugger:Pdb"
testpaths = ["tests"]
pythonpath = [
"."
]
[tool.coverage]
[tool.coverage.run]
branch = true
parallel = true
omit = ["tests/*", ".venv/*"]
source = ["loggia"]
[tool.coverage.report]
exclude_lines = [
"no cov",
"def __repr__",
"if TYPE_CHECKING:",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
'class .*\bProtocol\):',
'@(abc\.)?abstractmethod]',
]
[tool.pylint]
[tool.pylint.main]
py-version = "3.9"
disable = [
"C",
"R0903",
"R1735",
"W0511",
"W0212",
"too-many-instance-attributes",
"too-many-branches",
]
[tool.pylint.format]
max-line-length = 180
[tool.ruff]
line-length = 140
[tool.ruff.lint]
ignore = [
"E501", # Line too long
"ANN101", # Missing type annotation for self in method
"ANN102", # Missing type annotation for cls in classmethod
"ANN401", # Dynamically typed expressions are disallowed
"ARG002", # Unused argument
"ARG005", # Unused lambda argument
"TD",
"SLF001", # Private member accessed
"EM102", # Exception must not use an f-string literal, assign to variable first
"C408", # Unnecessary `dict` call (rewrite as a literal)
"D100", # Missing docstring in public module
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"D107", # Missing docstring in `__init__`
"SIM105", # Use `contextlib.suppress(X)` instead of `try`-`except`-`pass`
"EM101", # Exception must not use a string literal, assign to variable first
"TRY", # Avoid specifying long messages outside the exception class
"FIX003", # Line contains XXX
"N817", # CamelCase `XxXx` imported as acronym `XX`
"N813", # CamelCase `XxXx` imported as lowercase `xxxx`
"ICN003", # Members of `datetime` should not be imported explicitely
"COM812", # Conflicts with formatter
"ISC001", # Conflicts with formatter
]
select = ["ALL"]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.flake8-annotations]
allow-star-arg-any = true
mypy-init-return = true
suppress-dummy-args = true
suppress-none-returning = true
[tool.ruff.lint.flake8-unused-arguments]
ignore-variadic-names = true
[tool.ruff.lint.flake8-tidy-imports]
ban-relative-imports = "all"
[tool.ruff.lint.flake8-errmsg]
max-string-length = 20
[tool.ruff.lint.flake8-import-conventions]
# Declare the banned `from` imports.
banned-from = [
"datetime",
"os",
"sys",
"logging",
"time",
"re",
]
[tool.ruff.lint.flake8-builtins]
builtins-ignorelist = ["filter", "format"]
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = [
"S101",
"D",
"ANN",
"B018",
"TRY",
"EM",
"N802",
"INP001",
"ARG",
"PLR2004",
]
"loggia/presets/*.py" = ["D101"]
[tool.mypy]
files = ["loggia"]
python_version = "3.9"
strict = true
strict_optional = true
allow_redefinition = false
ignore_missing_imports = true
local_partial_types = true
no_implicit_optional = true
warn_unreachable = true
warn_no_return = false
check_untyped_defs = true
[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
disallow_incomplete_defs = false
[tool.pyright]
include = ["src"]
exclude = ["**/__pycache__",]
reportMissingImports = true
reportMissingTypeStubs = false
pythonVersion = "3.9"