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 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369
|
# --------- Commitizen -------------
[tool.commitizen]
name = "cz_conventional_commits"
version = "1.17.0"
tag_format = "$version"
version_files = [
"pyproject.toml:version",
"src/yamlfix/version.py",
]
# --------- Autoimport -------------
[tool.autoimport.common_statements]
"factories" = "from tests import factories"
# --------- PDM -------------
[project]
# PEP 621 project metadata
# See https://www.python.org/dev/peps/pep-0621/
dynamic = ["version"]
authors = [
{name = "Lyz", email = "lyz-code-security-advisories@riseup.net"},
]
license = {text = "GPL-3.0-only"}
requires-python = ">=3.9.1"
dependencies = [
"click>=8.1.3",
"ruyaml>=0.91.0",
"maison>=2.0.0",
"pydantic>=2.8.2",
]
name = "yamlfix"
description = "A simple opionated yaml formatter that keeps your comments!"
readme = "README.md"
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: Unix",
"Operating System :: POSIX",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Utilities",
"Natural Language :: English",
]
[project.urls]
Issues = "https://github.com/lyz-code/yamlfix/issues"
homepage = "https://github.com/lyz-code/yamlfix"
documentation = "https://lyz-code.github.io/yamlfix"
[project.scripts]
yamlfix = "yamlfix.entrypoints.cli:cli"
[tool.pdm.version]
source = "file"
path = "src/yamlfix/version.py"
[tool.pdm.build]
editable-backend = "path"
package-dir = "src"
source-includes = ["tests/"]
[tool.pdm.resolution.overrides]
# To be removed once https://github.com/flakeheaven/flakeheaven/issues/132 is solved
"importlib-metadata" = ">=3.10"
[tool.pdm.dev-dependencies]
lint = [
"yamllint>=1.27.1",
"flake8-aaa>=0.12.2",
"flake8-annotations>=2.9.1",
"flake8-annotations-complexity>=0.0.7",
"flake8-typing-imports>=1.12.0,!=1.13.0",
"flake8-bugbear>=22.8.23",
"flake8-debugger>=4.1.2",
"flake8-fixme>=1.1.1",
"flake8-markdown>=0.3.0",
"flake8-mutable>=1.2.0",
"flake8-pytest>=1.4",
"flake8-pytest-style>=1.6.0",
"flake8-simplify>=0.19.3",
"flake8-variables-names>=0.0.5",
"flake8-comprehensions>=3.10.0",
"flake8-expression-complexity>=0.0.11",
"flake8-use-fstring>=1.4",
"flake8-eradicate>=1.3.0",
"flake8-docstrings>=1.6.0",
"pep8-naming>=0.13.2",
"dlint>=0.13.0",
"pylint>=2.15.2",
"flakeheaven>=3.0.0",
]
test = [
"pytest>=7.1.3",
"pytest-cov>=3.0.0",
"pytest-xdist>=3.0.2",
"pytest-freezegun>=0.4.2",
"pydantic-factories>=1.6.1",
]
doc = [
"mkdocs>=1.3.1",
"mkdocs-git-revision-date-localized-plugin>=1.1.0",
"mkdocs-htmlproofer-plugin>=0.8.0",
"mkdocs-minify-plugin>=0.5.0",
"mkdocs-autolinks-plugin>=0.6.0",
"mkdocs-material>=8.4.2",
"mkdocstrings[python]>=0.18",
"markdown-include>=0.7.0",
"mkdocs-section-index>=0.3.4",
]
security = [
"safety>=2.3.1, <3",
"bandit>=1.7.3",
]
fixers = [
"autoimport>=1.2.2",
"black>=24.3.0",
"isort>=5.10.1",
"yamlfix>=1.0.1",
]
typing = [
"mypy>=0.971",
"types-click>=7.1.8",
]
dev = [
"pre-commit>=2.20.0",
"twine>=4.0.1",
"commitizen>=2.32.2",
]
# The next ones are required to manually solve the dependencies issues
dependencies = [
# Until flakeheaven supports flake8 5.x
# https://github.com/flakeheaven/flakeheaven/issues/132
"flake8>=4.0.1,<5.0.0",
"pyflakes<2.5.0",
]
[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"
# --------- Black -------------
[tool.black]
line-length = 88
target-version = ['py37', 'py38', 'py39', 'py310']
include = '\.pyi?$'
exclude = '''
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
# The following are specific to Black, you probably don't want those.
| blib2to3
| tests/data
| profiling
)/
'''
# --------- Pytest -------------
[tool.pytest.ini_options]
minversion = "6.0"
addopts = "-n auto"
testpaths = "tests"
norecursedirs = [
".tox",
".git",
"*/migrations/*",
"*/static/*",
"docs",
"venv",
]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"secondary: mark tests that use functionality tested in the same file (deselect with '-m \"not secondary\"')"
]
filterwarnings = [
"error",
# Until https://github.com/ktosiek/pytest-freezegun/issues/35 is merged
"ignore::DeprecationWarning:pytest_freezegun.*",
]
# --------- Coverage -------------
[tool.coverage.report]
exclude_lines = [
# Have to re-enable the standard pragma
'pragma: no cover',
# Type checking can not be tested
'if TYPE_CHECKING:',
# Ignore the Abstract classes definition
'raise NotImplementedError',
]
# --------- Isort -------------
[tool.isort]
profile = "black"
src_paths = ["src", "test"]
# --------- Flakeheaven -------------
[tool.flakeheaven]
format = "grouped"
max_line_length = 88
show_source = true
docstring-convention = "google"
[tool.flakeheaven.plugins]
flake8-aaa = ["+*"]
flake8-annotations = [
"+*",
"-ANN101", # There is usually no need to type the self argument of class methods.
"-ANN102", # There is usually no need to type the cls argument of class methods.
]
flake8-annotations-complexity = ["+*"]
flake8-bugbear = ["+*"]
flake8-comprehensions = ["+*"]
flake8-debugger = ["+*"]
flake8-docstrings = [
"+*",
"-D101", # Missing docstring, already covered by C0115 of pylint
]
flake8-eradicate = ["+*"]
flake8-expression-complexity = ["+*"]
flake8-fixme = ["+*"]
flake8-markdown = ["+*"]
flake8-mutable = ["+*"]
flake8-pytest = ["+*"]
flake8-pytest-style = ["+*"]
flake8-simplify = ["+*"]
flake8-use-fstring = [
"+*",
'-FS003' # f-string missing prefix
]
flake8-typing-imports = [
"+*",
"-TYP001", # guard import by `if False: # TYPE_CHECKING`: TYPE_CHECKING (not in
# 3.5.0, 3.5.1). We don't support Python < 3.7
"-TYP002", # @overload is broken in <3.5.2, but we don't support Python 3.5
]
flake8-variables-names = ["+*"]
dlint = ["+*"]
pylint = [
"+*",
"-C0411", # %s should be placed before %s,
# see https://github.com/PyCQA/pylint/issues/2175 and https://github.com/PyCQA/pylint/issues/1797
"-R0903", # Too few methods warning, but if you define an interface with just one
# method that's fine
"-W1203", # Use %s formatting in logging functions. Deprecated rule in favor of
# f-strings.
"-W1201", # Use lazy % formatting in logging functions. Deprecated rule in favor of
# f-strings.
"-C0301", # Lines too long. Already covered by E501.
]
mccabe = ["+*"]
pep8-naming = ["+*"]
pycodestyle = [
"+*",
"-W503", # No longer applies, incompatible with newer version of PEP8
# see https://github.com/PyCQA/pycodestyle/issues/197
# and https://github.com/psf/black/issues/113
"-E704", # Black collapses implementations of classes/functions consisting solely of ...
# See https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#e701-e704
]
pyflakes = [
"+*",
"-F841", # Unused variable, already covered by W0612 of pylint
"-F821", # Undefined variable, already covered by E0602 of pylint
]
[tool.flakeheaven.exceptions."tests/"]
flake8-docstrings = [
"-D205", # 1 blank line required between summary line and description
"-D212", # Multi-line docstring summary should start at the first line
"-D400", # First line should end with a period
"-D415", # First line should end with a period, question mark, or exclamation point
]
flake8-annotations = [
"-ANN001",
"-ANN401", # Dynamically typed expressions (typing.Any) are disallowed
]
pylint = [
"-R0201", # Method could be a function. Raised because the methods of a test class
# don't use the self object, which is not wrong.
"-W0613", # Unused argument in function, but in tests there are fixtures that even
# though they are not used in the function directly, they are used to
# configure the test.
"-R0904", # Too many public methods (25/20) (too-many-public-methods)
"-C0302", # Allows module to have unlimited number of lines.
]
[tool.flakeheaven.exceptions."tests/factories.py"]
pylint = [
"-R0903", # Too few methods warning, but is the way to define factoryboy factories.
]
[tool.flakeheaven.exceptions."tests/unit/test_views.py"]
pycodestyle = [
"-E501", # lines too long. As we are testing the output of the terminal, the test is
# cleaner if we show the actual result without splitting long lines.
]
# --------- Pylint -------------
[tool.pylint.'TYPECHECK']
generated-members = "sh"
[tool.pylint.'MESSAGES CONTROL']
extension-pkg-whitelist = "pydantic"
# --------- Mypy -------------
[tool.mypy]
show_error_codes = true
follow_imports = "silent"
ignore_missing_imports = false
strict_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
disallow_any_generics = true
check_untyped_defs = true
no_implicit_reexport = true
warn_unused_configs = true
disallow_subclassing_any = true
disallow_incomplete_defs = true
disallow_untyped_decorators = true
disallow_untyped_calls = true
disallow_untyped_defs = true
plugins = [
"pydantic.mypy"
]
[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
warn_untyped_fields = true
[[tool.mypy.overrides]]
module = "tests.*"
# Required to not have error: Untyped decorator makes function on fixtures and
# parametrize decorators
disallow_untyped_decorators = false
[[tool.mypy.overrides]]
module = [
"goodconf",
"pytest",
"_io.*"
]
ignore_missing_imports = true
|