Skip to content

Commit 651d5bb

Browse files
authored
chore: improve pyproject.toml readability (#590)
- Add section dividers - Consolidate MyPy config - Clean up unused Ruff comments Signed-off-by: Alex Bozarth <ajbozart@us.ibm.com>
1 parent af25037 commit 651d5bb

1 file changed

Lines changed: 52 additions & 36 deletions

File tree

pyproject.toml

Lines changed: 52 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ granite_common_retriever = [
141141
"elasticsearch>=8.0.0,<9.0.0"
142142
]
143143

144+
# -----------------------------
145+
# Ruff - Linting and Formatting
146+
# -----------------------------
147+
144148
[tool.ruff]
145149
target-version = "py310"
146150
respect-gitignore = true
@@ -150,41 +154,33 @@ skip-magic-trailing-comma = true
150154

151155
[tool.ruff.lint]
152156
select = [
153-
# "B", # flake8-bugbear
154-
"C", # flake8-comprehensions
155-
"C9", # mccabe
156-
"D", # flake8-docstrings
157-
"E", # pycodestyle errors (default)
158-
"F", # pyflakes (default)
159-
"I", # isort
160-
"PD", # pandas-vet
161-
"PIE", # pie
162-
# "PTH", # pathlib
163-
"Q", # flake8-quotes
164-
# "RET", # return
165-
"RUF", # Enable all ruff-specific checks
166-
# "SIM", # simplify
167-
"S307", # eval
157+
"C", # flake8-comprehensions
158+
"C9", # mccabe
159+
"D", # flake8-docstrings
160+
"E", # pycodestyle errors (default)
161+
"F", # pyflakes (default)
162+
"I", # isort
163+
"PD", # pandas-vet
164+
"PIE", # pie
165+
"Q", # flake8-quotes
166+
"RUF", # Enable all ruff-specific checks
167+
"S307", # eval
168+
"W", # pycodestyle warnings
169+
"ASYNC", # async
170+
"UP", # pyupgrade
168171
# "T20", # (disallow print statements) keep debugging statements out of the codebase
169-
"W", # pycodestyle warnings
170-
"ASYNC", # async
171-
"UP", # pyupgrade
172172
]
173173

174174
ignore = [
175-
"RUF001", # ambiguous unicode characters (these occur in examples).
176-
"C408", # Unnecessary `dict()` call (rewrite as a literal)
177-
"E501", # Line too long, handled by ruff formatter
178-
# "D107", # "Missing docstring in __init__",
179-
"F401", # imported but unused; consider using `importlib.util.find_spec` to test for "
180-
"F811", # "redefinition of the same function"
181-
"PL", # Pylint
182-
"RUF012", # Mutable Class Attributes
183-
# "UP006", # List vs list, etc
184-
# "UP007", # Option and Union
185-
# "UP035", # `typing.Set` is deprecated, use `set` instead"
186-
"PD901", # Generic variable name 'df' for DataFrames (deprecated rule, but needed while PD is enabled)
187-
"C901", # Complexity warnings
175+
"RUF001", # ambiguous unicode characters (these occur in examples)
176+
"C408", # Unnecessary `dict()` call (rewrite as a literal)
177+
"E501", # Line too long, handled by ruff formatter
178+
"F401", # imported but unused; consider using `importlib.util.find_spec` to test for
179+
"F811", # redefinition of the same function
180+
"PL", # Pylint
181+
"RUF012", # Mutable Class Attributes
182+
"PD901", # Generic variable name 'df' for DataFrames (deprecated rule, but needed while PD is enabled)
183+
"C901", # Complexity warnings
188184
]
189185

190186
[tool.ruff.lint.pydocstyle]
@@ -208,6 +204,16 @@ split-on-trailing-comma = false
208204
"cli/**/*.py" = ["D"]
209205
"tooling/**/*.py" = ["D"]
210206

207+
# -----------------------------
208+
# MyPy - Type Checking
209+
# -----------------------------
210+
211+
[tool.mypy]
212+
install_types = true
213+
non_interactive = true
214+
disable_error_code = ["empty-body", "import-untyped"]
215+
python_version = "3.10"
216+
211217
[[tool.mypy.overrides]]
212218
# Keep import-not-found suppressed for optional dependencies
213219
module = "docs.*"
@@ -222,18 +228,20 @@ disable_error_code = [
222228
"import-not-found",
223229
]
224230

231+
# -----------------------------
232+
# Codespell - Spell Checking
233+
# -----------------------------
234+
225235
[tool.codespell]
226236
ignore-words-list = 'mellea,hashi,noo,Asai,asai,nd,mot,rouge,Rouge,Strat,Wight'
227237
check-filenames = true
228238
check-hidden = false
229239
regex = "(?<![a-z])[a-z'`]+|[A-Z][a-z'`]*|[a-z]+'[a-z]*|[a-z]+(?=[_-])|[a-z]+(?=[A-Z])|\\d+"
230240
skip = 'requirements.txt,uv.lock,CHANGELOG.md'
231241

232-
[tool.mypy]
233-
install_types = true
234-
non_interactive = true
235-
disable_error_code = ["empty-body", "import-untyped"]
236-
python_version = "3.10"
242+
# -----------------------------
243+
# Pytest - Testing Framework
244+
# -----------------------------
237245

238246
[tool.pytest.ini_options]
239247
testpaths = ["test", "docs"] # Run test/ first (fail fast), then docs/
@@ -285,6 +293,10 @@ filterwarnings = [
285293
"default:.*Watsonx Backend is deprecated.*:DeprecationWarning",
286294
]
287295

296+
# -----------------------------
297+
# Coverage - Code Coverage
298+
# -----------------------------
299+
288300
[tool.coverage.run]
289301
branch = true # Measure branch coverage, not just line coverage
290302
source = ["mellea", "cli"]
@@ -312,6 +324,10 @@ exclude_lines = [
312324
[tool.coverage.html]
313325
directory = "htmlcov"
314326

327+
# -----------------------------
328+
# Semantic Release - Versioning
329+
# -----------------------------
330+
315331
[tool.semantic_release]
316332
# for default values check:
317333
# https://github.com/python-semantic-release/python-semantic-release/blob/v7.32.2/semantic_release/defaults.cfg

0 commit comments

Comments
 (0)