Skip to content

Commit

Permalink
moved config for ruff, mypy, pytest, and coverage into pyproject toml
Browse files Browse the repository at this point in the history
  • Loading branch information
KerstenBreuer committed Dec 18, 2023
1 parent 5250e98 commit 6413750
Show file tree
Hide file tree
Showing 6 changed files with 188 additions and 86 deletions.
5 changes: 0 additions & 5 deletions .coveragerc

This file was deleted.

12 changes: 0 additions & 12 deletions .mypy.ini

This file was deleted.

82 changes: 82 additions & 0 deletions .pyproject_generation/pyproject_template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,85 @@ classifiers = [

[tool.setuptools.packages.find]
where = ["src"]

[tool.ruff]
exclude = [
".git",
".devcontainer",
"__pycache__",
"build",
"dist",
]
ignore = [
"E", # pycodestyle errors
"W", # pycodestyle warnings - pycodestyle covered by black
"PLW", # pylint warnings
"RUF001", # ambiguous unicode character strings
"RUF010", # explicit conversion to string or repr: !s or !r
"RUF012", # mutable class variables need typing.ClassVar annotation
"N818", # Errors need to have Error suffix
"B008", # function call in arg defaults,
"PLR2004", # magic numbers should be constants
"D205", # blank-line-after-summary
"D400", # first doc line ends in period
"D401", # non-imperative-mood
"D107", # missing docstring in __init__
"D206", # indent-with-spaces (ignored for formatter)
"D300", # triple-single-quotes (ignored for formatter)
]
line-length = 88
select = [
"C90", # McCabe Complexity
"F", # pyflakes codes
"I", # isort
"S", # flake8-bandit
"B", # flake8-bugbear
"N", # pep8-naming
"UP", # pyupgrade
"PL", # pylint
"RUF", # ruff
"SIM", # flake8-simplify
"D", # pydocstyle
]
fixable = [
"UP", # e.g. List -> list
"I", # sort imports
"D", # pydocstyle
]
src = ["src", "tests", "examples", "scripts"]
target-version = "py39"

[tool.ruff.mccabe]
max-complexity = 10

[tool.ruff.per-file-ignores]
"scripts/*" = ["PL", "S", "SIM", "D"]
"tests/*" = ["S", "SIM", "PLR", "B011"]
".devcontainer/*" = ["S", "SIM", "D"]
"examples/*" = ["S", "D"]
"__init__.py" = ["D"]

[tool.ruff.pydocstyle]
convention = "pep257"

[tool.mypy]
disable_error_code = "import"
show_error_codes = true
exclude = [
'build/lib/',
]
warn_redundant_casts = true
warn_unused_ignores = true
check_untyped_defs = true
no_site_packages = false

[tool.pytest.ini_options]
minversion = "7.1"
asyncio_mode = "strict"

[tool.coverage.paths]
source = [
"src",
"/workspace/src",
"**/lib/python*/site-packages",
]
64 changes: 0 additions & 64 deletions .ruff.toml

This file was deleted.

106 changes: 106 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,109 @@ my-microservice = "my_microservice.__main__:run"
where = [
"src",
]

[tool.ruff]
exclude = [
".git",
".devcontainer",
"__pycache__",
"build",
"dist",
]
ignore = [
"E",
"W",
"PLW",
"RUF001",
"RUF010",
"RUF012",
"N818",
"B008",
"PLR2004",
"D205",
"D400",
"D401",
"D107",
"D206",
"D300",
]
line-length = 88
select = [
"C90",
"F",
"I",
"S",
"B",
"N",
"UP",
"PL",
"RUF",
"SIM",
"D",
]
fixable = [
"UP",
"I",
"D",
]
src = [
"src",
"tests",
"examples",
"scripts",
]
target-version = "py39"

[tool.ruff.mccabe]
max-complexity = 10

[tool.ruff.per-file-ignores]
"scripts/*" = [
"PL",
"S",
"SIM",
"D",
]
"tests/*" = [
"S",
"SIM",
"PLR",
"B011",
]
".devcontainer/*" = [
"S",
"SIM",
"D",
]
"examples/*" = [
"S",
"D",
]
"__init__.py" = [
"D",
]

[tool.ruff.pydocstyle]
convention = "pep257"

[tool.mypy]
disable_error_code = "import"
show_error_codes = true
exclude = [
"build/lib/",
]
warn_redundant_casts = true
warn_unused_ignores = true
check_untyped_defs = true
no_site_packages = false

[tool.pytest.ini_options]
minversion = "7.1"
asyncio_mode = "strict"

[tool.coverage.paths]
source = [
"src",
"/workspace/src",
"**/lib/python*/site-packages",
]
5 changes: 0 additions & 5 deletions pytest.ini

This file was deleted.

0 comments on commit 6413750

Please sign in to comment.