Skip to content

Commit

Permalink
centralize config to pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
addyess committed Jan 13, 2025
1 parent f28beef commit 6030ed9
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 19 deletions.
11 changes: 0 additions & 11 deletions mypy.ini

This file was deleted.

82 changes: 82 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[lint]
ignore = ["E501", "D107"]
extend-ignore = [
"D203",
"D204",
"D213",
"D215",
"D400",
"D404",
"D406",
"D407",
"D408",
"D409",
"D413",
]
per-file-ignores = {"tests/*" = ["D100","D101","D102","D103","D104"]}

[lint.mccabe]
max-complexity = 10



# Testing tools configuration
[tool.coverage.run]
branch = true

# Formatting tools configuration
[tool.black]
line-length = 99
target-version = ["py38"]

[tool.coverage.report]
show_missing = true


[tool.isort]
line_length=99
multi_line_output=3
include_trailing_comma = true
use_parentheses = true

[tool.mypy]
warn_unused_ignores = true
warn_unused_configs = true
warn_unreachable = true
disallow_untyped_defs = true
# Due to python 3.5 support we can't enforce variable type annotations
disable_error_code = "var-annotated"

[[tool.mypy.overrides]]
module = "charms.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "lightkube.*"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "ops.*"
ignore_missing_imports = true

[tool.pytest.ini_options]
minversion = "6.0"

# Linting tools configuration
[tool.ruff]
# line-length = 99
# select = ["E", "W", "F", "C", "N", "D", "I001"]
extend-exclude = ["__pycache__", "*.egg_info"]

[tool.codespell]
skip = "build,lib,venv,icon.svg,.tox,.git,.mypy_cache,.ruff_cache,.coverage"

[tool.pyright]
extraPaths = ["./lib"]

[project]
name = "ceph-csi"
dynamic = ["version"]
dependencies = [
"tox-uv"
]
2 changes: 1 addition & 1 deletion src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def check_kube_config(self) -> None:
def check_namespace(self) -> None:
self.unit.status = ops.MaintenanceStatus("Evaluating namespace")
try:
self._client.get(Namespace, name=self.stored.namespace) # type: ignore
self._client.get(Namespace, name=self.stored.namespace)
except ApiError as e:
if "not found" in str(e.status.message):
status.add(ops.BlockedStatus(f"Missing namespace '{self.stored.namespace}'"))
Expand Down
8 changes: 1 addition & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ commands =
uvx ruff check {[vars]all_path}
uvx isort --check-only --diff {[vars]all_path}
uvx black -l 99 --check --diff {[vars]all_path}
uv run mypy --namespace-packages {[vars]src_path}
uvx mypy --namespace-packages {[vars]src_path}

[testenv:unit]
basepython = python3
Expand Down Expand Up @@ -65,12 +65,6 @@ commands =
python {toxinidir}/upstream/update.py {posargs}


[isort]
line_length=99
multi_line_output=3
include_trailing_comma=True
use_parentheses=True

[coverage:report]
exclude_lines =
pragma: no cover
Expand Down

0 comments on commit 6030ed9

Please sign in to comment.