Skip to content

Commit b3c392a

Browse files
authored
Add pyright dependency and configure ruff linting
Added 'pyright' to the optional development dependencies and configured 'ruff' linting options.
1 parent 1422d94 commit b3c392a

1 file changed

Lines changed: 113 additions & 0 deletions

File tree

pyproject.toml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ classifiers = [
2929
dev = [
3030
"pre-commit",
3131
"setuptools-scm",
32+
"pyright",
3233
]
3334
test = [
3435
"pytest-runner",
@@ -68,3 +69,115 @@ Issues = "https://github.com/palewire/your-respository/issues/"
6869
# packages = ["your_package_module"]
6970

7071
[tool.setuptools_scm]
72+
73+
[tool.ruff.lint]
74+
select = [
75+
"E", # pycodestyle
76+
"F", # pyflakes
77+
"B", # flake8-bugbear
78+
"W", # pycodestyle warnings
79+
"I", # isort - import sorting
80+
"UP", # pyupgrade - modern Python idioms
81+
"N", # pep8-naming - naming conventions
82+
"ANN", # flake8-annotations - type annotations
83+
"YTT", # flake8-2020 - sys.version_info checks
84+
"S", # flake8-bandit - security issues
85+
"BLE", # flake8-blind-except - blind except statements
86+
"FA", # flake8-future-annotations - future annotations
87+
"ICN", # flake8-import-conventions - import conventions
88+
"PIE", # flake8-pie - misc lints
89+
"Q", # flake8-quotes - quote consistency
90+
"RSE", # flake8-raise - raise statement improvements
91+
"RET", # flake8-return - return statement improvements
92+
"SLOT", # flake8-slots - __slots__ usage
93+
"SIM", # flake8-simplify - code simplification
94+
"TID", # flake8-tidy-imports - tidy imports
95+
"PTH", # flake8-use-pathlib - pathlib usage
96+
"FLY", # flynt - f-string conversion
97+
"PERF", # perflint - performance improvements
98+
"RUF", # ruff-specific rules
99+
]
100+
ignore = [
101+
"E501", # Line length
102+
"F403", # Star imports
103+
"UP046", # Generic class `Loader` uses `Generic` subclass instead of type parameters
104+
"S101", # Allow assert
105+
"SIM103", # Allow for True/False returns after a test
106+
"SIM108", # Don't force ternary expressions
107+
"SIM117", # Allow for nested with statements
108+
"PERF401", # For for appending to a list
109+
"RUF001", # Allow for curly quotes
110+
"RUF005", # Allow for adding lists
111+
]
112+
113+
[tool.ruff.lint.per-file-ignores]
114+
"tests/*" = [
115+
"PLR2004",
116+
"ANN", # Annotations
117+
"S105", # Possible hardcoded password
118+
"S108", # Temp directory
119+
]
120+
121+
[tool.ruff.format]
122+
docstring-code-format = true
123+
124+
[tool.pytest.ini_options]
125+
addopts = "--strict-markers --cov=reuters_data_wire --cov-branch --cov-report=term-missing:skip-covered --cov-context=test --cov-fail-under=70 -n auto --timeout=60"
126+
testpaths = ["tests"]
127+
python_files = "test_*.py"
128+
markers = [
129+
"unit: Unit tests",
130+
"component: Component tests",
131+
"integration: Integration tests",
132+
"e2e: End-to-end tests",
133+
]
134+
filterwarnings = [
135+
"ignore::DeprecationWarning:pandas.*",
136+
"ignore::FutureWarning:numpy.*",
137+
"ignore::DeprecationWarning:dateutil.*",
138+
]
139+
140+
[tool.coverage.run]
141+
# source = ["your_package_module"]
142+
relative_files = true
143+
omit = ["*/__pycache__/*"]
144+
145+
[tool.pyright]
146+
# pythonVersion = "3.12"
147+
venvPath = "."
148+
venv = ".venv"
149+
# include = ["your_package_name"]
150+
exclude = [
151+
"tests",
152+
"build",
153+
".venv",
154+
"_notebooks",
155+
"**/__pycache__",
156+
]
157+
158+
# Type checking mode - "off", "basic", "standard", or "strict"
159+
typeCheckingMode = "standard"
160+
161+
# Disabled for pandas-stubs type inference issues (DataFrame/Series/ndarray ambiguity)
162+
reportMissingTypeStubs = false
163+
reportUnknownMemberType = false
164+
reportUnknownArgumentType = false
165+
reportUnknownVariableType = false
166+
reportUnknownParameterType = false
167+
reportAttributeAccessIssue = false # ndarray missing .iloc, .dt, .str, .groupby
168+
reportArgumentType = false # DataFrame vs Series parameter mismatches
169+
reportReturnType = false # DataFrame vs Series return mismatches
170+
reportCallIssue = false # No overloads for rename, concat, sort_values
171+
reportAssignmentType = false # DataFrame vs Series assignment mismatches
172+
173+
# High-value type safety checks (kept enabled)
174+
reportMissingImports = true
175+
reportGeneralTypeIssues = true
176+
reportPossiblyUnboundVariable = true
177+
reportIncompatibleMethodOverride = true
178+
reportOptionalMemberAccess = true
179+
reportOptionalCall = true
180+
reportUnhashable = true
181+
182+
# Disabled because .configure() class factory pattern requires subclasses to narrow types
183+
reportIncompatibleVariableOverride = false

0 commit comments

Comments
 (0)