Skip to content

Commit 30b935b

Browse files
authored
Merge branch 'main' into gallery
2 parents cd069cc + 2b29e48 commit 30b935b

28 files changed

+12748
-437
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ docs/jupyter_execute/
1616
docs/source/api/generated/
1717
docs/source/_static/thumbnails/
1818
# Note: thumbnails are generated during build (see .readthedocs.yaml)
19+
.cursor/

.pre-commit-config.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,16 @@ repos:
2121
- id: end-of-file-fixer
2222
exclude_types: [svg]
2323
- id: check-yaml
24+
- id: check-toml
25+
- id: check-json
2426
- id: check-added-large-files
25-
exclude: &exclude_pattern 'iv_weak_instruments.ipynb'
27+
exclude: &exclude_pattern '(iv_weak_instruments|its_lift_test)\.ipynb'
2628
args: ["--maxkb=1500"]
29+
- id: check-merge-conflict
30+
- id: check-case-conflict
31+
- id: mixed-line-ending
2732
- repo: https://github.com/astral-sh/ruff-pre-commit
28-
rev: v0.14.4
33+
rev: v0.14.7
2934
hooks:
3035
# Run the linter
3136
- id: ruff
@@ -49,9 +54,13 @@ repos:
4954
# Support pyproject.toml configuration
5055
- tomli
5156
- repo: https://github.com/pre-commit/mirrors-mypy
52-
rev: v1.18.2
57+
rev: v1.19.0
5358
hooks:
5459
- id: mypy
5560
args: [--ignore-missing-imports]
5661
files: ^causalpy/
5762
additional_dependencies: [numpy>=1.20, pandas-stubs]
63+
- repo: https://github.com/abravalheri/validate-pyproject
64+
rev: v0.24.1
65+
hooks:
66+
- id: validate-pyproject

AGENTS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ When creating a new example notebook:
5959
- **Custom exceptions**: Use project-specific exceptions from `causalpy.custom_exceptions`: `FormulaException`, `DataException`, `BadIndexException`
6060
- **File organization**: Experiments in `causalpy/experiments/`, PyMC models in `causalpy/pymc_models.py`, scikit-learn models in `causalpy/skl_models.py`
6161

62+
## Code quality checks
63+
64+
- **Before committing**: Always run `pre-commit run --all-files` to ensure all checks pass (linting, formatting, type checking)
65+
- **Quick check**: Run `ruff check causalpy/` for fast linting feedback during development
66+
- **Auto-fix**: Run `ruff check --fix causalpy/` to automatically fix many linting issues
67+
- **Format**: Run `ruff format causalpy/` to format code according to project standards
68+
- **Linting rules**: Project uses strict linting (F, B, UP, C4, SIM, I) to catch bugs and enforce modern Python patterns
69+
- **Note**: Documentation notebooks in `docs/` are excluded from strict linting rules
70+
6271
## Type Checking
6372

6473
- **Tool**: MyPy

causalpy/data/PISA18sampleScale.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,4 @@ PV1READ,Female,ESCS,METASUM,PERFEED,JOYREAD,MASTGOAL,ADAPTIVITY,TEACHINT,SCREADD
9898
1.382758437,0,1.112755087,1.024329216,-1.363017023,0.546695917,-0.300835494,0.488206717,0.990856172,0.19103636,-0.063690149
9999
-0.180166117,0,-0.903784153,1.416120964,-0.789077206,0.3589234,-2.209705037,-1.353064842,-0.668887592,0.689393741,-0.929939088
100100
-0.138452609,0,-1.523831485,-0.171666648,0.021680557,-0.050770988,1.521829065,-0.8111262,-0.039406676,0.66554889,-0.851380406
101-
0.907727459,1,0.115773982,1.024329216,1.478217432,0.461175761,-0.873789642,0.080450276,-0.668887592,-0.265544842,-0.063690149
101+
0.907727459,1,0.115773982,1.024329216,1.478217432,0.461175761,-0.873789642,0.080450276,-0.668887592,-0.265544842,-0.063690149

causalpy/experiments/__init__.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,24 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
"""Quasi-experimental designs for causal inference."""
14+
"""CausalPy experiment module"""
15+
16+
from .diff_in_diff import DifferenceInDifferences
17+
from .instrumental_variable import InstrumentalVariable
18+
from .interrupted_time_series import InterruptedTimeSeries
19+
from .inverse_propensity_weighting import InversePropensityWeighting
20+
from .prepostnegd import PrePostNEGD
21+
from .regression_discontinuity import RegressionDiscontinuity
22+
from .regression_kink import RegressionKink
23+
from .synthetic_control import SyntheticControl
24+
25+
__all__ = [
26+
"DifferenceInDifferences",
27+
"InstrumentalVariable",
28+
"InversePropensityWeighting",
29+
"PrePostNEGD",
30+
"RegressionDiscontinuity",
31+
"RegressionKink",
32+
"SyntheticControl",
33+
"InterruptedTimeSeries",
34+
]

0 commit comments

Comments
 (0)