-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathpyproject.toml
More file actions
182 lines (170 loc) · 6.22 KB
/
Copy pathpyproject.toml
File metadata and controls
182 lines (170 loc) · 6.22 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
[build-system]
requires = ["maturin>=1.4,<2.0"]
build-backend = "maturin"
[project]
name = "diff-diff"
version = "3.7.0"
description = "Difference-in-Differences causal inference with sklearn-like API. Callaway-Sant'Anna, Synthetic DiD, Honest DiD, event studies, parallel trends."
readme = "README.md"
license = "MIT"
requires-python = ">=3.9,<3.15"
authors = [
{name = "diff-diff contributors"}
]
keywords = [
"causal-inference",
"difference-in-differences",
"econometrics",
"statistics",
"treatment-effects",
"event-study",
"staggered-adoption",
"parallel-trends",
"synthetic-control",
"panel-data",
"did",
"twfe",
"callaway-santanna",
"honest-did",
"sensitivity-analysis",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"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",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Scientific/Engineering",
]
dependencies = [
"numpy>=1.20.0",
"pandas>=1.3.0",
# scipy>=1.10 required for scipy.stats.multivariate_normal.cdf(..., lower_limit=...)
# — used by diff_diff.pretrends._compute_nis_acceptance_prob for the
# rectangular box probability in Roth (2022) NIS pretest power. The
# lower_limit parameter was added in scipy 1.10 (release notes
# https://docs.scipy.org/doc/scipy/release/1.10.0-notes.html).
"scipy>=1.10",
]
[project.optional-dependencies]
dev = [
"pytest>=7.0",
"pytest-xdist>=3.0",
"pytest-cov>=4.0",
# Lint/format/type tools are pinned exactly so local results match the
# Lint CI workflow (.github/workflows/lint.yml) — update both together.
# NOTE: black/mypy require Python >= 3.10 (dev tooling only; the library
# floor stays 3.9).
"black==26.3.1",
"ruff==0.15.13",
"mypy==2.1.0",
"maturin>=1.4,<2.0",
"matplotlib>=3.5",
"nbmake>=1.5",
"plotly>=5.0",
]
plotly = [
"plotly>=5.0",
]
docs = [
"sphinx>=6.0",
"pydata-sphinx-theme>=0.16.1",
"sphinxext-opengraph>=0.9",
"sphinx-sitemap>=2.5",
"nbsphinx>=0.9",
"myst-parser>=2.0",
"matplotlib>=3.5",
# ipython provides the 'ipython3' Pygments lexer used by nbsphinx for
# notebook code cells; without it Sphinx emits highlighting_failure
# warnings on every notebook.
"ipython>=8.0",
]
[project.urls]
Homepage = "https://github.com/igerber/diff-diff"
Documentation = "https://diff-diff.readthedocs.io"
Repository = "https://github.com/igerber/diff-diff"
Issues = "https://github.com/igerber/diff-diff/issues"
"Practitioner Guide" = "https://diff-diff.readthedocs.io/en/stable/llms-practitioner.txt"
[tool.maturin]
# Build the Rust extension module
features = ["extension-module"]
# Python source is in the root directory
python-source = "."
# Module name for the compiled extension
module-name = "diff_diff._rust_backend"
# Path to Rust Cargo.toml
manifest-path = "rust/Cargo.toml"
# Include Python packages
python-packages = ["diff_diff"]
# Bundle LLM guide files (auto-inclusion varies across maturin 1.4-2.0; pin explicitly).
# Bare-string glob form includes in both sdist and wheel.
include = ["diff_diff/guides/*.txt", "LICENSE"]
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = "test_*.py"
# Exclude slow tests by default; use `pytest -m ''` to run all tests
addopts = "-v --tb=short -m 'not slow'"
markers = [
"slow: marks tests as slow (run `pytest -m 'not slow'` to exclude, or `pytest -m slow` to run only slow tests)",
"realdata: marks tests that validate against real survey datasets (API, NHANES, RECS)",
]
[tool.black]
line-length = 100
target-version = ["py39"]
[tool.ruff]
line-length = 100
target-version = "py39"
[tool.ruff.lint]
select = ["E", "F", "I", "W"]
ignore = ["E501"]
[tool.ruff.lint.per-file-ignores]
# Package __init__ deliberately re-exports backend symbols (implicit re-export
# surface; mirrors mypy implicit_reexport = true).
"diff_diff/__init__.py" = ["F401"]
# The trop modules configure the module logger before intra-package imports on
# purpose; import order is load-bearing.
"diff_diff/trop.py" = ["E402"]
"diff_diff/trop_global.py" = ["E402"]
"diff_diff/trop_local.py" = ["E402"]
# Rambachan-Roth / FLCI math notation uses `l` for the linear-combination vector.
"diff_diff/honest_did.py" = ["E741"]
# conftest sets sys.path and MPLBACKEND before imports (order-sensitive).
"tests/conftest.py" = ["E402"]
# CdH event-study horizon notation `l` is quoted in the tutorial narrative.
"tests/test_t19_marketing_pulse_drift.py" = ["E741"]
[tool.mypy]
python_version = "3.9"
warn_return_any = false
warn_unused_configs = true
ignore_missing_imports = true
# Disable strict Optional checking since we use Optional types extensively
strict_optional = true
# Allow implicit re-exports for public API
implicit_reexport = true
# Disable errors for numpy type compatibility issues
disable_error_code = ["arg-type", "return-value", "var-annotated", "assignment"]
# Stale-ignore hygiene: versions are pinned (dev extra + lint.yml), so
# unused-ignore warnings can't churn with tool upgrades.
warn_unused_ignores = true
# Third-party plotting stubs: matplotlib ships py.typed but is not installed
# in the typecheck CI job (and plotly has partial stubs). Skip both so local
# and CI runs see identical Any surfaces regardless of what is installed.
[[tool.mypy.overrides]]
module = ["matplotlib.*", "plotly.*"]
follow_imports = "skip"
# prep_dgp builds seeded synthetic panels with Optional covariate arrays that
# are constructed and consumed under the same `add_covariates` flag. The
# None-vs-array shape is load-bearing for the seeded RNG stream (drawing
# unconditionally would shift every downstream draw), so per-site narrowing
# is not worth the regression risk in a test-data generator. Tightening is
# tracked in TODO.md (Testing / docs).
[[tool.mypy.overrides]]
module = ["diff_diff.prep_dgp"]
disable_error_code = ["index"]