-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
151 lines (133 loc) · 4.63 KB
/
pyproject.toml
File metadata and controls
151 lines (133 loc) · 4.63 KB
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
[project]
name = "cfd-visualization"
version = "0.1.0"
description = "Visualization tools for CFD simulation output"
requires-python = ">=3.9"
dependencies = [
"numpy",
"matplotlib",
"scipy",
"pandas",
"watchdog",
"packaging",
"plotly",
"tomli>=1.0; python_version < '3.11'",
]
[project.optional-dependencies]
interactive = ["plotly", "dash"]
simulation = ["cfd-python>=0.1.6"]
full = ["plotly", "dash", "cfd-python>=0.1.6"]
[project.scripts]
cfd-viz = "cfd_viz.cli:main"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["cfd_viz"]
[tool.ruff]
# Target Python 3.9 for compatibility (cfd-python requires 3.9+)
target-version = "py39"
# Line length (PEP 8 recommends 79, but 88 is common for modern projects)
line-length = 88
# Exclude common directories
exclude = [
".git",
".venv",
"__pycache__",
"build",
"dist",
"*.egg-info",
"data",
"output",
]
[tool.ruff.lint]
# Enable pycodestyle (E), Pyflakes (F), isort (I), and more
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # Pyflakes (unused imports, undefined names)
"I", # isort (import sorting)
"B", # flake8-bugbear (common bugs)
"C4", # flake8-comprehensions
"UP", # pyupgrade (modern Python syntax)
"SIM", # flake8-simplify (simplify code)
"PTH", # flake8-use-pathlib (prefer pathlib)
"PL", # Pylint (subset of useful checks)
"RUF", # Ruff-specific rules
"NPY", # NumPy-specific rules
"PERF", # Performance anti-patterns
]
# Ignore specific rules
ignore = [
"E501", # line too long (handled by formatter)
"B008", # do not perform function calls in argument defaults
"C408", # unnecessary dict() call - often clearer for API kwargs
"PLR0913", # too many arguments to function call (common in scientific code)
"PLR2004", # magic value comparison (common in numerical code)
"PLR0915", # too many statements - complex visualization functions are expected
"SIM108", # use ternary operator - sometimes less readable
"RUF022", # __all__ not sorted - we prefer logical grouping over alphabetical
"UP035", # deprecated typing imports - needed for Python 3.9 compatibility
"UP006", # use list instead of List - needed for Python 3.9 compatibility
"NPY201", # np.trapz deprecated - will fix when dropping NumPy 1.x support
"NPY002", # legacy np.random - will modernize when needed
"PLC0415", # import not at top level - intentional in tests for export testing
"PTH", # pathlib suggestions - os.path is fine for this project
"PERF401", # list comprehension - explicit loops can be clearer
"PERF403", # dict comprehension - explicit loops can be clearer
"PLR0912", # too many branches - VTK reader and complex parsers need many branches
"PERF203", # try-except in loop - needed for graceful file loading error handling
]
# Allow autofix for all enabled rules
fixable = ["ALL"]
unfixable = []
[tool.ruff.lint.per-file-ignores]
# Allow unused imports in __init__.py (re-exports)
"__init__.py" = ["F401"]
# Examples can have more relaxed rules (unused vars from unpacking, etc.)
"examples/*.py" = ["PLR0915", "PLW0603", "RUF059", "F841"]
# Tests can use assert and have longer functions, unused variables in fixtures
"tests/*.py" = ["S101", "PLR0915", "RUF059", "F841", "RUF043"]
# _cli_impl sets matplotlib backend before importing pyplot
"cfd_viz/_cli_impl.py" = ["E402"]
[tool.ruff.lint.isort]
# Group imports: standard library, third-party, local
known-first-party = ["cfd_viz"]
# Force single line imports for clarity
force-single-line = false
# Combine as imports on same line
combine-as-imports = true
[tool.ruff.lint.pylint]
# Maximum number of arguments for functions
max-args = 10
# Maximum number of local variables
max-locals = 20
# Maximum number of branches
max-branches = 15
[tool.ruff.format]
# Use double quotes for strings
quote-style = "double"
# Indent with spaces
indent-style = "space"
# Unix-style line endings for cross-platform consistency
line-ending = "lf"
[tool.pytest.ini_options]
testpaths = ["tests"]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"integration: marks end-to-end integration tests",
]
filterwarnings = [
"error",
"ignore::DeprecationWarning:matplotlib.*",
"ignore::DeprecationWarning:numpy.*",
"ignore::matplotlib._api.deprecation.MatplotlibDeprecationWarning",
"ignore::pytest.PytestUnraisableExceptionWarning",
]
[dependency-groups]
dev = [
"cfd-python>=0.1.6",
"pre-commit>=4.0.0",
"pytest>=8.4.2",
"ruff>=0.8.0",
]