-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathpyproject.toml
More file actions
292 lines (251 loc) · 9.27 KB
/
pyproject.toml
File metadata and controls
292 lines (251 loc) · 9.27 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"
[project]
name = "firecrown"
authors = [
{ name = "DESCs Firecrown Developers" },
]
description = "DESC Cosmology Likelihood Framework"
requires-python = ">=3.11"
license-files = ["LICENSE"]
dependencies = [
"astropy",
"cobaya",
"cosmosis",
"lsstdesc-crow",
"fitsio",
"numcosmo_py",
"numpy",
"pandas",
"pyccl",
"pydantic",
"pyyaml",
"rich",
"sacc",
"scipy",
"typer",
]
dynamic = ["version", "readme"]
[tool.setuptools_scm]
version_scheme = "guess-next-dev"
local_scheme = "dirty-tag"
tag_regex = "^(?:v)?(?P<version>[0-9]+\\.[0-9]+\\.[0-9]+(a[0-9]+)?)$"
[tool.setuptools_scm.scm.git]
describe_command = [
"git", "describe", "--dirty", "--tags", "--long", "--abbrev=40", "--match",
"v*"
]
[tool.setuptools.dynamic]
readme = { file = "README.md", content-type = "text/markdown" }
[project.urls]
Homepage = "https://github.com/LSSTDESC/firecrown"
[tool.setuptools.packages.find]
include = ["firecrown*"]
exclude = ["examples*", "tests*", "tutorial*", "docs*"]
[project.scripts]
firecrown = "firecrown.app:app"
firecrown-link-checker = "firecrown.fctools.link_checker:app"
# Coverage configuration
[tool.coverage.run]
branch = true
parallel = true
concurrency = ["multiprocessing"]
source = ["firecrown"]
[tool.coverage.report]
exclude_also = [
# Don't complain about unreachable code
'^ +assert_never\(.*?\)$',
'^ +case _ as unreachable.*:$',
]
# Ruff configuration - replaces flake8 and pylint (black still used for formatting)
[tool.ruff]
line-length = 88
target-version = "py311"
[tool.ruff.lint]
# Enable rules equivalent to flake8 + pylint + additional useful rules
select = [
# Pycodestyle (replaces flake8 E/W)
"E", # pycodestyle errors
"W", # pycodestyle warnings
# Pyflakes (replaces flake8 F)
"F", # Pyflakes
# mccabe (replaces flake8 complexity)
"C90", # mccabe complexity
# isort (import sorting)
"I", # isort
# pydocstyle (docstring checks, replaces some pylint docstring rules)
"D", # pydocstyle
# pyupgrade (modernize Python code)
"UP", # pyupgrade
# pylint-like rules
"PL", # Pylint
# Additional useful rules
"B", # flake8-bugbear (bug and design problems)
"A", # flake8-builtins (builtin shadowing)
"C4", # flake8-comprehensions
"DTZ", # flake8-datetimez
"T10", # flake8-debugger
"DJ", # flake8-django
"EM", # flake8-errmsg
"EXE", # flake8-executable
"FA", # flake8-future-annotations
"ICN", # flake8-import-conventions
"G", # flake8-logging-format
"INP", # flake8-no-pep420
"PIE", # flake8-pie
"T20", # flake8-print
"PYI", # flake8-pyi
"PT", # flake8-pytest-style
"RSE", # flake8-raise
"RET", # flake8-return
"SLF", # flake8-self
"SLOT", # flake8-slots
"SIM", # flake8-simplify
"TID", # flake8-tidy-imports
"TCH", # flake8-type-checking
"INT", # flake8-gettext
"ARG", # flake8-unused-arguments
"PTH", # flake8-use-pathlib
"TD", # flake8-todos
"FIX", # flake8-fixme
"ERA", # eradicate (commented-out code)
"PD", # pandas-vet
"PGH", # pygrep-hooks
"NPY", # NumPy-specific rules
"RUF", # Ruff-specific rules
]
# Ignore rules to match existing flake8/pylint configuration
ignore = [
# Docstring rules that flake8 ignores
"D107", # Missing docstring in __init__ (matches flake8 ignore)
"D401", # First line should be imperative (matches flake8 ignore)
"D402", # First line should not be signature (matches flake8 ignore)
# Additional common ignores for scientific code
"PLR0913", # Too many arguments (scientific functions often need many params)
"PLR0915", # Too many statements (complex scientific calculations)
"PLR2004", # Magic value (scientific constants are common)
"C901", # Too complex (use max-complexity setting instead)
# Import rules that may be too strict for scientific packages
"F403", # Star imports (common in scientific packages)
"F405", # Name may be undefined from star imports
# Rules that may conflict with black formatting or are too strict
"COM812", # Trailing comma missing (conflicts with black)
"COM819", # Trailing comma prohibited (conflicts with black)
"ISC001", # Implicitly concatenated string literals (can conflict with formatter)
"Q000", # Double quotes found but single quotes preferred
"Q001", # Single quotes found but double quotes preferred
"Q002", # Docstring should use double quotes
"Q003", # Docstring should use single quotes
]
# Set complexity limit to match pylint
mccabe.max-complexity = 10
[tool.ruff.lint.per-file-ignores]
# Test files don't need docstrings and can be more flexible
"tests/**/*.py" = [
"D100", # Missing docstring in public module
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D200", # One-line docstring should fit on one line
"D202", # No blank lines allowed after function docstring
"D205", # 1 blank line required between summary and description
"D209", # Multi-line docstring closing quotes should be on separate line
"D212", # Multi-line docstring summary should start at the first line
"D213", # Multi-line docstring summary should start at the second line
"D400", # First line should end with a period
"PLR2004", # Magic values OK in tests
"S101", # Use of assert OK in tests
"ARG001", # Unused function arguments OK in tests/fixtures
"PLR0913", # Too many arguments OK in test functions
]
# Examples can have less strict rules
"examples/**/*.py" = [
"D100", "D102", "D103", "D104", # Docstring requirements relaxed
"PLR0913", # Too many arguments
"PLR0915", # Too many statements
"E501", # Line too long (matches existing per-file ignore)
"T201", # Print statements OK in examples
"PLR2004", # Magic values OK in examples
"INP001", # Implicit namespace packages OK
]
# Allow specific patterns in different directories
"pylint_plugins/**/*.py" = [
"PLR0913", # Many arguments OK for plugins
]
# Command-line utilities in fctools legitimately use print() for user output
"firecrown/fctools/**/*.py" = [
"T201", # Print statements OK in CLI tools (coverage_summary, print_code, etc.)
]
[tool.ruff.lint.pydocstyle]
# Use Google docstring convention (common in scientific Python)
convention = "google"
[tool.ruff.lint.isort]
# Group imports properly for scientific packages
known-first-party = ["firecrown"]
known-third-party = ["numpy", "scipy", "pandas", "matplotlib", "astropy", "pyccl", "sacc", "cosmosis", "cobaya"]
# Black configuration - keep existing formatting tool
[tool.black]
line-length = 88
target-version = ['py311']
extend-exclude = 'examples/srd_sn/sndata'
# Pyright configuration - runs alongside mypy without conflicts
[tool.pyright]
# Include all main source directories
include = ["firecrown", "tests", "examples"]
# Exclude common non-source directories
exclude = [
"**/node_modules",
"**/__pycache__",
"**/.pytest_cache",
"**/build",
"**/dist",
"docs/_build",
".git"
]
# Python version (should match your target)
pythonVersion = "3.11"
# Type checking configuration
typeCheckingMode = "off" # Can be "off", "basic", or "strict"
# Enable useful warnings
reportMissingImports = true
reportMissingTypeStubs = false # Don't warn about missing stubs for third-party packages
reportUnusedImport = true
reportUnusedClass = true
reportUnusedFunction = true
reportUnusedVariable = true
reportDuplicateImport = true
# Scientific computing specific settings
reportMissingParameterType = false # NumPy/SciPy often have complex signatures
reportUnknownParameterType = false # Allow flexibility with scientific libraries
reportUnknownMemberType = false # NumPy arrays have dynamic typing
# Allow flexibility for scientific computing patterns
reportGeneralTypeIssues = false
reportOptionalMemberAccess = true
reportOptionalSubscript = true
reportPrivateImportUsage = false # Scientific packages often use private imports
# Disable false positives common in scientific computing
reportOperatorIssue = false # PyCC/CCL Pk2D objects support operators despite type annotations
reportUnknownArgumentType = false # Scientific libraries often have dynamic argument types
reportUnknownVariableType = false # NumPy/SciPy operations create dynamic types
# Performance - don't analyze every possible path
reportUnnecessaryIsInstance = false
reportUnnecessaryCast = false
# Mypy configuration
[tool.mypy]
ignore_missing_imports = true
check_untyped_defs = true
exclude = "build|docs|.venv|venv|examples/srd_sn/sndata"
warn_unused_configs = true
warn_redundant_casts = true
warn_unused_ignores = true
no_implicit_optional = true
strict_equality = true
extra_checks = true
disallow_subclassing_any = true
disallow_untyped_decorators = true
explicit_package_bases = true
# disallow_any_generics = true
[[tool.mypy.overrides]]
module = "firecrown.connector.cobaya.*"
disallow_subclassing_any = false