-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpyproject.toml
153 lines (128 loc) · 4.58 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
########### BASIC METADATA ###############
[project]
authors = [
{email = "[email protected]"},
{name = "Thomas Steen Rasmussen"}
]
classifiers = [
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
]
description = "Multi-target Prometheus exporter with an exclusive focus on DNS monitoring"
dynamic = ["version"]
keywords = ["prometheus", "dns", "monitoring"]
license = {text = "BSD 3-Clause License"}
name = "dns_exporter"
readme = "README.md"
requires-python = ">=3.9"
########### DEPENDENCIES ###############
dependencies = [
"dnspython[doh,dnssec,idna,doq] >= 2.7.0",
"PyYAML >= 6.0",
"prometheus-client >= 0.15.0",
"PySocks >= 1.7.1",
]
[project.optional-dependencies]
dev = ["pre-commit == 4.0.1", "setuptools-scm == 8.1.0"]
test = ["pytest == 8.3.4", "coverage[toml]==7.6.10", "pytest-cov==6.0.0", "tox == 4.23.2", "requests==2.32.3", "pytest-randomly==3.16.0", "pytest-mock==3.14.0", "gera2ld.socks==0.5.0"]
docs = ["Sphinx==8.1.3", "furo==2024.8.6"]
########## SCRIPTS ####################
[project.scripts]
dns_exporter = "dns_exporter.entrypoint:main"
########## URLS #######################
[project.urls]
homepage = "https://github.com/tykling/dns_exporter"
documentation = "https://dns-exporter.readthedocs.org/"
########### SETUPTOOLS ################
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
write_to = "src/dns_exporter/_version.py"
[tool.setuptools]
package-dir = {"" = "src"}
packages = ["dns_exporter"]
########### RUFF ######################
[tool.ruff]
target-version = "py39"
line-length = 120
[tool.ruff.lint]
select = ["ALL"]
ignore = [
"G004", # Logging statement uses f-string
"ANN101", # Missing type annotation for `self` in method
"ANN102", # Missing type annotation for `cls` in classmethod
"EM101", # Exception must not use a string literal, assign to variable first
"COM812", # missing-trailing-comma (https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules)
"ISC001", # single-line-implicit-string-concatenation (https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules)
]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.per-file-ignores]
"src/tests/*.py" = [
"S101", # asserts allowed in tests...
"ARG", # Unused function args -> fixtures nevertheless are functionally relevant...
"FBT", # Don't care about booleans as positional arguments in tests, e.g. via @pytest.mark.parametrize()
"PLR2004", # Magic value used in comparison, ...
"ANN001", # Missing type annotation for function argument ...
"ANN201", # Missing return type annotation for public function ...
"S113", # Probable use of requests call without timeout
"E501", # Line too long
]
"conftest.py" = [
"T201", # print()
"ANN001", # Missing type annotation for function argument ...
"ANN201", # Missing return type annotation for public function ...
"INP001", # File `conftest.py` is part of an implicit namespace package. Add an `__init__.py`
"PT004", # Fixture ... does not return anything, add leading underscore
]
"src/docs/source/conf.py" = [
"INP001", # File ... is part of an implicit namespace package. Add an `__init__.py`.
"A001", # Variable `copyright` is shadowing a Python builtin
]
############ MYPY #####################
[tool.mypy]
python_version = "3.9"
exclude = [
"build/",
"venv/",
"src/conftest.py",
"src/tests/",
"src/docs/source/conf.py",
]
########### COVERAGE.PY ###############
[tool.coverage.run]
omit = ["_version.py"]
########### PYTEST ####################
[tool.pytest.ini_options]
log_format = "%(asctime)s pytest %(levelname)s %(name)s.%(funcName)s():%(lineno)i: %(message)s"
log_date_format = "%Y-%m-%d %H:%M:%S"
# consider warnings errors except PytestUnraisableExceptionWarning and ResourceWarning which happens regularly in socket code,
# and a DeprecationWarning in aioquic
filterwarnings = [
"error",
"ignore::pytest.PytestUnraisableExceptionWarning",
"ignore::ResourceWarning",
"ignore::DeprecationWarning:aioquic.*",
]
addopts = "--cov=dns_exporter/ --cov-report=xml --cov-report=html --cov-config=../pyproject.toml"
########### TOX #######################
[tool.tox]
envlist = ["py39", "py310", "py311", "py312"]
skipsdist = true
[tool.tox.env_run_base]
description = "Run test under {base_python}"
change_dir = "src/"
deps = [
"pytest",
"pytest-cov",
"pytest-randomly",
"pytest-order",
"pytest-mock",
"gera2ld.socks",
"-e.[test]",
]
commands = [
["pytest"]
]