Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
548 lines (520 loc) · 16.8 KB
/
Copy pathpyproject.toml
File metadata and controls
548 lines (520 loc) · 16.8 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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
[build-system]
build-backend = 'mesonpy'
requires = [
'meson-python',
"cython>=3.0.13,<4", # Sync with CYTHON_MIN_VER in setup
"numpy>=2.0.0,<3",
"scipy>=1.13,<2",
"setuptools_scm>=9.2.0,<10",
]
[project]
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Programming Language :: Cython",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Operating System :: OS Independent",
"Intended Audience :: End Users/Desktop",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Natural Language :: English",
"Topic :: Office/Business :: Financial",
"Topic :: Scientific/Engineering",
]
description = "Statistical computations and models for Python"
dynamic = ["version"]
keywords = [
"statistics",
"econometrics",
"time series",
"regression",
"anova",
"statistical tests",
"linear models",
"generalized linear models",
"discrete choice models",
"robust linear models",
"mixed linear models",
"time series analysis",
"state space models",
"vector autoregression",
"volatility modeling",
"unit root tests",
"cointegration tests",
"nonparametric methods",
"multivariate statistics"
]
license = "BSD-3-Clause"
license-files = [ "LICENSE.txt" ]
maintainers = [
{ name = "statsmodels Developers", email = "pystatsmodels@googlegroups.com" },
]
name = "statsmodels"
dependencies = [
"numpy>=1.23.5,<3", # released March 2022
"scipy>=1.8,!=1.9.2", # released Feb 2022, 1.9.2 blocked due to bug
"pandas>=1.4,!=2.1.0", # released Feb 2022, 2.1.0 blocked due to bug
"patsy>=0.5.6", # released December 2023
"packaging>=21.3", # released Nov 2021
"formulaic>=1.1.0", # released December 2024
]
readme = "README.md"
requires-python = ">=3.10"
[project.optional-dependencies]
test = [
# test
"pytest>=8.4.1,<10",
"pytest-randomly",
"pytest-run-parallel",
"pytest-xdist",
"pytest-cov",
"coverage[toml]",
"meson",
'ninja; sys_platform != "emscripten"',
]
doc = [
# Requirements for doc build, in addition to requirements.txt
"sphinx",
# Avoid warnings which break Sphinx by pinning pandas
"pandas>=2.2.2,!=2.1.0",
"pydata-sphinx-theme",
"jupyter",
"notebook",
"nbsphinx",
"nbconvert",
"pyyaml",
"pandas-datareader",
"simplegeneric",
"seaborn",
"numpydoc",
# "theano-pymc; os_name != 'nt'", # disabled because it is not compatible with move recent Python version
"pymc; os_name != 'nt'",
"arviz; os_name != 'nt'",
"jinja2",
"pickleshare",
"pytest>=8.4.1,<10",
]
dev = [
# build
"cython>=3.0.10,<4",
"setuptools_scm~=9.0",
"meson-python>=0.18.0",
"meson",
"ninja",
# run
"matplotlib>=3",
"colorama",
"joblib",
# Remove due to failures on azure CI
# cvxopt; os_name != "win32"
# Pin on Win32
"pywinpty; os_name == 'nt'",
# code quality
"ruff",
]
polars = [
# Polars support
"polars>=1.0.0",
]
[project.urls]
homepage = "https://www.statsmodels.org"
documentation = "https://www.statsmodels.org/stable/index.html"
repository = "https://github.com/statsmodels/statsmodels"
changelog = "https://bashtage.github.io/arch/changes.html"
bugtracker = "https://github.com/statsmodels/statsmodels/issues"
[tool.meson-python.args]
setup = ['--vsenv']
[tool.ruff]
line-length = 88
fix = false
# Matches requires-python (>=3.10) and [tool.black]'s target-version below;
# also affects which pyupgrade (UP) rules apply.
target-version = "py310"
# archive/ is explicitly documented (archive/README) as deprecated, no
# longer maintained legacy code; excluded so it's not linted as if it
# were part of the active codebase.
extend-exclude = ["archive", "examples/python"]
[tool.ruff.lint]
typing-modules = ["statsmodels.compat.python", "compat.python"]
select = [
# pyflakes
"F",
# pycodestyle
"E", "W",
# flake8-2020
"YTT",
# flake8-bugbear
"B",
# flake8-quotes
"Q",
# flake8-debugger
"T10",
# flake8-gettext
"INT",
# pylint
"PL",
# flake8-pytest-style
"PT",
# misc lints
"PIE",
# flake8-pyi
"PYI",
# tidy imports
"TID",
# implicit string concatenation
"ISC",
# flake8-type-checking
"TC",
# comprehensions
"C4",
# pygrep-hooks
"PGH",
# Ruff-specific rules
"RUF",
# Perflint
"PERF",
# flynt
"FLY",
# flake8-future-annotations
"FA",
# flake8-import-conventions
"ICN",
# flake8-slots
"SLOT",
# flake8-raise
"RSE",
# flake8-async
"ASYNC",
# flake8-executable
"EXE",
# flake8-logging-format
"G",
# flake8-logging
"LOG",
# refurb
"FURB",
# flake8-bandit
"S",
# isort
"I",
# pyupgrade
"UP",
# flake8-builtins
"A",
# flake8-airflow (this project has no Airflow usage, so this and the
# frameworks below are all currently clean; enabled for completeness)
"AIR",
# flake8-commas: only COM812/COM819 fail (already in the never-enable
# list above), COM818 is otherwise clean
"COM",
# flake8-django (no Django usage, currently clean)
"DJ",
# flake8-datetimez
"DTZ",
# flake8-fastapi (no FastAPI usage, currently clean)
"FAST",
# pandas-vet
"PD",
# flake8-use-pathlib: os.path is used throughout, but fewer than half
# the rule's codes actually fire here, so the category is selected with
# the failing codes carved out below (see ignore list) rather than
# listing the larger set of passing codes individually. A full
# os.path -> pathlib migration is a bigger undertaking than a config
# change.
"PTH",
# pep8-naming: most of "N" fails on scientific/statistical variable
# naming conventions (e.g. X, Y, N806 alone is 2000+ hits), so only the
# individually-clean rules are selected rather than the whole category.
"N804", "N811", "N813", "N817",
# flake8-simplify: most of "SIM" still has real hits, so only the
# individually-clean rules are selected rather than the whole category.
"SIM107", "SIM109", "SIM110", "SIM112", "SIM116", "SIM202", "SIM208",
"SIM220", "SIM221", "SIM222", "SIM223", "SIM911",
# tryceratops: TRY003 alone (no vanilla-args messages in raise) is
# 1300+ hits, so only the individually-clean rules are selected rather
# than the whole category.
"TRY400", "TRY401",
# flake8-use-pathlib
"PTH",
"RET501",
"RET502",
"RET507",
"RET508",
]
# pydocstyle ("D") is intentionally NOT selected above. This project already
# validates numpydoc docstring structure via tools/validate_docstrings.py
# (built on the numpydoc package), which understands our numpydoc convention
# far more precisely than ruff's generic pydocstyle checks do - even with
# `[tool.ruff.lint.pydocstyle] convention = "numpy"` set, D still produces
# tens of thousands of violations and disagrees with the dedicated
# validator in places. Do not add "D" to select.
ignore = [
# Required to allow black formatting
# Whitespace before ':' (Needed for black)
"E203",
# Line too long (### > 88 characters) (Needed for black)
"E501",
# Multiple statements on one line (colon) (E701)
"E701",
### Never enable: these conflict with the black/ruff-format formatter.
# ISC001 is deliberately NOT in this list: we keep ISC001 enabled and fix
# the occasional real violation by hand instead of suppressing it.
"COM812", # missing-trailing-comma: black decides this, not us
"COM819", # prohibited-trailing-comma: black decides this, not us
"Q003", # avoidable-escaped-quote
### Intentionally disabled
# Counts below are from `ruff check . --select ALL`
# (this project's conformance scope), refreshed 2026-07-27.
# Too many arguments to function call
"PLR0913", # 645
# Too many returns
"PLR0911", # 12
# Too many branches
"PLR0912", # 221
# Too many statements
"PLR0915", # 221
# Too many positional arguments
"PLR0917", # 617
# Redefined loop name
"PLW2901", # 49
# incorrect-dict-iterator, flags valid Series.items usage
"PERF102", # 5
# try-except-in-loop, becomes useless in Python 3.11
"PERF203", # 9
# pytest-parametrize-names-wrong-type
"PT006", # 36
# pytest-raises-with-multiple-statements
"PT012", # 15
# Docstring contains ambiguous letter
"RUF002", # Do Not Enable
# Magic number
"PLR2004", # 717
# import-outside-toplevel
"PLC0415", # 853
### TODO: Enable gradually
# Too many uses of dict(...) instread of {...}
# Would be good enforce eventually
"C408", # 324
# Too many places without match= in pytest raises
# Would be goot enforce eventually
"PT011", # 519
"RUF059", # 342
"PERF401", # 30
# collection-literal-concatenation
"RUF005", # 138
# mutable-class-default
"RUF012", # 177
# repeated-equality-comparison
"PLR1714", # 27
### New 2026-07-27 when enabling ASYNC, EXE, G, LOG, FURB, S, full ICN
# assert is used pervasively outside of tests in this codebase (input
# validation, invariant checks); not adopting flake8-bandit's blanket
# objection to it
"S101", # 1669
# try/except/pass: mostly deliberate best-effort cleanup code
"S110", # 5
# pickle usage: needed for model persistence, a documented feature
"S301", # 11
# eval usage in a handful of expression-parsing helpers
"S307", # 3
# urlopen used only for fetching public, hardcoded dataset URLs
"S310", # 2
# subprocess with shell=True / without shell=True check: used in a couple
# of dev/CI helper scripts, not on untrusted input
"S602", # 2
"S603", # 2
### New 2026-07-27 when enabling A, DTZ, PD, PTH
# Variable/argument/import shadows a builtin name (e.g. `id`, `type`,
# `filter`); common in this codebase's mathematical notation and not
# worth a rename sweep
"A001", # 35
"A002", # 10
"A004", # 2
# datetime()/datetime.now() without tzinfo; this project works with
# naive timestamps throughout (dataset dates, log timestamps) and does
# not need timezone-aware datetimes
"DTZ001", # 82
"DTZ005", # 4
# inplace=True is used deliberately in a number of places
"PD002", # 10
# .pivot()/.unstack() and .stack() instead of .pivot_table()/.melt():
# deliberate choices, not accidental API misuse
"PD010", # 25
"PD013", # 13
# .values instead of .to_numpy(): a pervasive, long-standing idiom
# throughout this codebase, not worth a mechanical rewrite
"PD011", # 308
# os.path used throughout instead of pathlib; a real modernization
# opportunity, but a bigger migration than a quick fix
"PTH100", # 107
"PTH103", # 4
"PTH106", # 1
"PTH107", # 6
"PTH110", # 13
"PTH111", # 1
"PTH112", # 1
"PTH113", # 1
"PTH118", # 237
"PTH119", # 1
"PTH120", # 123
"PTH122", # 4
"PTH123", # 89
"PTH204", # 4
"PTH207", # 6
"PTH208", # 3
]
[tool.ruff.lint.flake8-quotes]
multiline-quotes = "double"
[tool.ruff.lint.isort]
# Mirrors original [tool.isort] below as closely as ruff's isort implementation
# allows.
combine-as-imports = true
force-sort-within-sections = true
known-first-party = ["statsmodels"]
known-third-party = ["Cython", "cython", "numpy", "matplotlib", "pandas", "patsy", "pytest", "cvxopt"]
section-order = ["future", "compat", "standard-library", "third-party", "first-party", "local-folder"]
split-on-trailing-comma = true
[tool.ruff.lint.isort.sections]
# Mirrors known_compat from [tool.isort].
compat = ["statsmodels.compat", "setuptools"]
[tool.ruff.lint.per-file-ignores]
# relative imports allowed for asv_bench
"statsmodels/__init__.py" = ["PT028"]
"statsmodels/tsa/vector_ar/var_model.py" = ["PT028"]
"statsmodels/stats/rates.py" = ["PT028"]
"statsmodels/stats/proportion.py" = ["PT028"]
"statsmodels/stats/oneway.py" = ["PT028"]
"statsmodels/stats/multivariate.py" = ["PT028"]
"statsmodels/stats/diagnostic_gen.py" = ["PT028"]
"statsmodels/discrete/_diagnostics_count.py" = ["PT028"]
"statsmodels/examples/tests/test_notebooks.py" = ["F401"]
# Example scripts/notebooks are left as-is (not converted to pathlib).
"**/examples/**" = ["PTH"]
[tool.pytest.ini_options]
minversion = "8.4.1"
addopts = "--strict --durations=30 --junitxml=test-data.xml --randomly-dont-reset-seed"
testpaths = "statsmodels"
xfail_strict = true
empty_parameter_set_mark = "fail_at_collect"
filterwarnings = [
"ignore:`formatargspec`:DeprecationWarning:statsmodels",
"ignore:Using or importing:DeprecationWarning",
"ignore:Session._key_changed is deprecated:DeprecationWarning",
"error:Support for multi-dimensional:DeprecationWarning",
"error:Mutating unit root tests is deprecated:FutureWarning",
"error:Lag selection has changed:DeprecationWarning",
"error:More than 20 figures have been opened:RuntimeWarning:",
"error:Inequality constraints incompatible::",
"error:Parameters are not consistent with a::",
"ignore:The --strict option is deprecated:pytest.PytestDeprecationWarning",
"error:The default for reindex:FutureWarning:",
"error:Values in x were outside bounds:RuntimeWarning:",
"error:The random_state property is deprecated:FutureWarning",
"error:random_state is deprecated:FutureWarning",
"error:seed is deprecated:FutureWarning",
"error:get_state is deprecated:FutureWarning",
"error:Conversion of an array with ndim:DeprecationWarning:",
"error:the matrix subclass is not the recommended::",
"error:The Dataframe Interchange Protocol::",
"error:Setting the shape:DeprecationWarning:",
"error:After 0.17 or January 2028:FutureWarning:",
"error:A future version of pandas:",
"error:The inplace keyword in::",
"error:Keyword arguments have been passed:FutureWarning:",
"error:After statsmodels 0.15 is released:FutureWarning:",
"error:Passing `None` as the seed currently:FutureWarning:",
"error:the 'random_state' keyword is deprecated:FutureWarning:",
"error:the 'seed' keyword is deprecated:FutureWarning:",
"error:the 'center' keyword is deprecated:FutureWarning:",
"error:Unpacking:FutureWarning:",
"error:The test statistic is outside:statsmodels.tools.sm_exceptions.InterpolationWarning:",
"error:The design matrix is:statsmodels.tools.sm_exceptions.SingularMatrixWarning:",
"error:Fast medcouple algorithm:UserWarning:",
"error:medcouple is undefined:UserWarning:",
"error:Provided `endog` series:UserWarning:",
"error:.*is deprecated as of SciPy 2.*:",
# Strict checks disabled
# "error:overflow encountered in square:RuntimeWarning",
# "error:invalid value encountered in cos:RuntimeWarning",
# "error:divide by zero encountered in double_scalars:RuntimeWarning",
# "error:invalid value encountered in log:RuntimeWarning",
# "error:invalid value encountered in sqrt:RuntimeWarning:",
# "error:overflow encountered in double_scalars:RuntimeWarning:",
# "error:overflow encountered in multiply:RuntimeWarning:",
]
junit_family = "xunit2"
markers = [
"example: mark a test that runs example code",
"matplotlib: mark a test that requires matplotlib",
"slow: mark a test as slow",
"smoke: mark a test as a smoke test",
"high_memory: mark a test as a high memory utilization test",
"low_precision: mark a test as low precision",
"todo: mark a test as incomplete",
"polars: mark a test that requires polars",
"singleton_randomstate: mark a test as changing the singleton RandomState",
"joblib: mark a test as using joblib for parallel computation",
]
[tool.ruff.format]
quote-style = "double"
[tool.coverage.run]
source = ["statsmodels"]
branch = true
plugins = ["Cython.Coverage"]
omit = [
# print_version is untestable
"*/print_version.py",
# skip compatibility code
"*/compat/*",
# Unused file
"*/results/gee_generate_tests.py",
# Results for tests
"*/tests/results/*",
# Simulation checks
"*/tests/*_simulation_check.py",
# Misc non-test files in test directories
"*/tests/_*",
"*/tests/e*",
"*/tests/c*",
"*/tests/d*",
"*/tests/g*",
"*/tests/m*",
"*/tests/p*",
"*/tests/r*",
"*/tests/s*",
"*/_version.py",
"*/_pss_critical_values/*",
]
[tool.coverage.report]
show_missing = true
ignore_errors = false
# Regexes for lines to exclude from consideration
exclude_also = [
# Have to re-enable the standard pragma
"pragma: no cover",
# Do not complain about missing debug-only code:
"def __repr__",
"if self\\.debug",
"if pdf_output:",
# Do not complain if tests do not hit defensive assertion code:
"raise AssertionError",
"raise NotImplementedError",
"except NotImplementedError",
"except ImportError",
"except (HTTPError, URLError, SSLError, timeout)",
"except IGNORED_EXCEPTIONS",
# Ignore pass
"pass",
# Do not complain if non-runnable code is not run:
"if 0:",
"if __name__ == .__main__.:",
]
[tool.coverage.html]
directory = "coverage_html_report"
[tool.black]
line-length = 88
target-version = ["py310"]