Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1041 commits
Select commit Hold shift + click to select a range
bb7c2bb
Merge pull request #460 from pymc-labs/sc-api-change
drbenvincent May 31, 2025
49d0a4a
Merge branch 'main' into did-banks
drbenvincent May 31, 2025
a4ca0fe
Update UML Diagrams
github-actions[bot] Jun 2, 2025
77128e1
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Jun 2, 2025
63abff8
fix typo
drbenvincent Jun 6, 2025
29d4c6c
add the divergence pair plot - output collapsed by default
drbenvincent Jun 6, 2025
2db2762
supress FutureWarning
drbenvincent Jun 6, 2025
b064e83
more TWFE information + references
drbenvincent Jun 6, 2025
d27d630
add another reference
drbenvincent Jun 6, 2025
9d1ba04
fix grammatical error
drbenvincent Jun 6, 2025
ccaf174
add another reference
drbenvincent Jun 6, 2025
1a0b145
Merge pull request #485 from pymc-labs/pre-commit-ci-update-config
drbenvincent Jun 6, 2025
e14d1ac
Merge pull request #484 from pymc-labs/update-uml-diagrams
drbenvincent Jun 6, 2025
9aeddb5
delete docs/Makefile
drbenvincent Jun 6, 2025
f96447d
Merge branch 'main' into pr/483
drbenvincent Jun 6, 2025
174d145
Merge pull request #483 from Sohaibameer204/improve-docs-makefile
drbenvincent Jun 6, 2025
a626c1e
Merge pull request #482 from pymc-labs/did-banks
ostojanovic Jun 6, 2025
5da2174
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Jun 9, 2025
23044f0
add fixture
williambdean Jun 16, 2025
09be0a7
save ~10s
williambdean Jun 16, 2025
eb4c4a2
save ~40s
williambdean Jun 16, 2025
5dcb7c9
remove the default adopts
williambdean Jun 16, 2025
6c45f79
mock for doctest
williambdean Jun 16, 2025
1c3cb92
point to the config file
williambdean Jun 16, 2025
9250f3d
skip the failing one
williambdean Jun 16, 2025
491adc1
Merge pull request #487 from pymc-labs/pre-commit-ci-update-config
drbenvincent Jun 20, 2025
c48dd97
resolve conflicts with main
drbenvincent Jun 20, 2025
f4da3fb
fix mistake in ITS tests - should still be InterruptedTimeSeries clas…
drbenvincent Jun 20, 2025
714c48b
[pre-commit.ci] pre-commit autoupdate (#492)
pre-commit-ci[bot] Jun 26, 2025
7655206
Exclude causalpy/tests from code coverage
drbenvincent Jun 28, 2025
59c5b6e
initial commit - utilising vibe coding
drbenvincent Jun 28, 2025
26691ec
update multi cell geolift notebook with new functionality/API
drbenvincent Jun 28, 2025
4fa1650
add test that the r2 scores differ across treated units
drbenvincent Jun 28, 2025
7b473af
simplify plot code
drbenvincent Jun 28, 2025
be01357
revert to simpler plot titles
drbenvincent Jun 28, 2025
47e0a2d
rename primary_unit_name -> treated_unit + revert to no "Unit" title
drbenvincent Jun 28, 2025
ee8a92b
revert change in causal impact shaded region colour
drbenvincent Jun 28, 2025
b79743f
code simplifications by always having a treated_units dimension
drbenvincent Jun 28, 2025
aa9920a
code simplification relating to _get_score_title
drbenvincent Jun 28, 2025
ebddbb5
another code simplification - related to scoring
drbenvincent Jun 28, 2025
eac1ef3
code simplification in _ols_plot
drbenvincent Jun 28, 2025
1a5f9bd
code simplification related to PyMCModel._data_setter
drbenvincent Jun 28, 2025
e67a28c
add sphinx-togglebutton for a collapsible admonition + other updates …
drbenvincent Jun 29, 2025
d0fc0d3
update uml diagrams
drbenvincent Jun 29, 2025
b6f5ca8
PyMCModel.score always to get xr.DataArray arguments
drbenvincent Jun 29, 2025
8badc05
simplification to PyMC.print_coefficients
drbenvincent Jun 29, 2025
4a78a50
simplification of WeightedSumFitter.build_model
drbenvincent Jun 29, 2025
f1849b1
clean up PyMCModel.predict + PyMCModel._data_setter
drbenvincent Jun 29, 2025
a55f97d
remove a numerical index in favour of a named dimension
drbenvincent Jun 29, 2025
6341e53
make code comment more specific
drbenvincent Jun 29, 2025
2befccb
consolidate tests, fix doctest
drbenvincent Jun 29, 2025
990104d
point to the conftest file in make command
williambdean Jun 29, 2025
632c457
Merge pull request #493 from pymc-labs/code-cov
drbenvincent Jun 29, 2025
c3b6423
Merge branch 'main' into mock-sample
williambdean Jun 29, 2025
78be544
Merge branch 'main' into multi-cell-geolift
drbenvincent Jun 29, 2025
37e8de7
set fixture scope to module
drbenvincent Jun 30, 2025
4911fed
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Jun 30, 2025
d0c520f
towards a more unified scoring (r2) approach
drbenvincent Jun 30, 2025
3ee430e
more unification with score (r2) in terms of unified naming: unit_{n}_r2
drbenvincent Jun 30, 2025
adf04f9
refactor PyMCModel.score
drbenvincent Jun 30, 2025
25608ef
the grand simplification
drbenvincent Jun 30, 2025
2fba338
tweak docstring
drbenvincent Jun 30, 2025
8b26d42
Merge pull request #497 from pymc-labs/pre-commit-ci-update-config
drbenvincent Jul 3, 2025
fdce5b0
Merge pull request #489 from williambdean/mock-sample
drbenvincent Jul 5, 2025
4e63dfa
Merge branch 'main' into multi-cell-geolift
drbenvincent Jul 5, 2025
04ace83
update class diagram
drbenvincent Jul 5, 2025
192327d
re-run relevant notebooks
drbenvincent Jul 5, 2025
2243004
add new data set
NathanielF Jul 6, 2025
b4ee4f1
adding latent prop_score notebook
NathanielF Jul 6, 2025
96098cb
using ps in outcome model
NathanielF Jul 7, 2025
8200202
update interrupted time series notebook
drbenvincent Jul 7, 2025
123331f
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Jul 7, 2025
a834d84
adding spline function on the propensity score
NathanielF Jul 8, 2025
71b3741
adding centred and non-centred options
NathanielF Jul 8, 2025
acd8112
tidying
NathanielF Jul 8, 2025
5367e1a
Merge pull request #502 from pymc-labs/pre-commit-ci-update-config
drbenvincent Jul 9, 2025
e094981
proving feedback issue and corrective
NathanielF Jul 9, 2025
ad4e6c3
update with write up
NathanielF Jul 9, 2025
0fd40cc
tidying spellings
NathanielF Jul 9, 2025
e9df0d5
improving the simulation study
NathanielF Jul 10, 2025
a18f83b
full run through
NathanielF Jul 10, 2025
8ab06ac
adding plots of prop score distributions
NathanielF Jul 11, 2025
d2035f8
adding some tests and a conclusion
NathanielF Jul 11, 2025
6aea139
adding video resource and notebook to how-to
NathanielF Jul 11, 2025
ec8173f
adding some more test coverage
NathanielF Jul 11, 2025
6f3aa02
fixing spelling error
NathanielF Jul 11, 2025
127698a
adjusting for some Juan's comments
NathanielF Jul 12, 2025
e88e4c0
fixing typos
NathanielF Jul 12, 2025
b48b82c
adding datasets
NathanielF Jul 12, 2025
0c806b8
remove beta_ps interaction
NathanielF Jul 12, 2025
98cca2f
fix observed keyword for student liklihood
NathanielF Jul 13, 2025
855b499
demonstrate the usefulness of spline component
NathanielF Jul 13, 2025
6160a3f
update colour scheme on graphs
NathanielF Jul 13, 2025
2f5eada
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Jul 14, 2025
185a03e
Merge pull request #503 from pymc-labs/pre-commit-ci-update-config
drbenvincent Jul 15, 2025
8579a14
less confusing variable names
drbenvincent Jul 16, 2025
3101cdc
improve type hints
drbenvincent Jul 16, 2025
b213b0f
combined=True in az.plot_forest in brexit synthetic control example
drbenvincent Jul 16, 2025
5998680
Merge branch 'main' into its-notebook-clarification
drbenvincent Jul 16, 2025
0449370
Merge pull request #494 from pymc-labs/multi-cell-geolift
drbenvincent Jul 16, 2025
0288dc4
Merge branch 'main' into its-notebook-clarification
drbenvincent Jul 16, 2025
a4e0a95
fix typo
drbenvincent Jul 16, 2025
04e31df
flesh out more detail about causal impact in the interrupted time ser…
drbenvincent Jul 17, 2025
60bab33
streamline the text and fix some grammatical issues
drbenvincent Jul 18, 2025
b63860d
Merge pull request #504 from pymc-labs/its-causal-impact-details
drbenvincent Jul 18, 2025
2644412
Merge branch 'main' into its-notebook-clarification
drbenvincent Jul 18, 2025
3ade07c
manually resolve notebook conflicts 🤷🏻‍♂️
drbenvincent Jul 18, 2025
ac22b5c
elaborate on the mean causal impact, including adding an equation
drbenvincent Jul 18, 2025
a58f671
update with ben's comments
NathanielF Jul 18, 2025
2970854
add new data set
NathanielF Jul 6, 2025
e6d9b30
Merge branch 'main' into propensity_score_latent
NathanielF Jul 18, 2025
e6f6a53
add reference
NathanielF Jul 19, 2025
2da3007
add simple regression to highlight effect of prop score,
NathanielF Jul 19, 2025
e290244
fix issue with N not being used
drbenvincent Jul 19, 2025
67d550d
Add explanation about np.ones
drbenvincent Jul 19, 2025
8f2f136
"business decisions" -> "decisions"
drbenvincent Jul 19, 2025
6566232
Merge pull request #501 from pymc-labs/its-notebook-clarification
drbenvincent Jul 19, 2025
548d723
allow priors on propensity score parameters
NathanielF Jul 19, 2025
e933420
Handle integer treated variable in RegressionDiscontinuity
drbenvincent Jul 19, 2025
05fccdd
remove redundant alpha parameter in model class
NathanielF Jul 19, 2025
ae451cd
add winsorisation option and better priors for nhefs
NathanielF Jul 19, 2025
4d79f45
Update UML Diagrams
github-actions[bot] Jul 21, 2025
1bfa065
Merge pull request #508 from pymc-labs/update-uml-diagrams
drbenvincent Jul 21, 2025
50df840
version bump
drbenvincent Jul 24, 2025
54a4b57
Merge pull request #510 from pymc-labs/version-bump-0.5.0
drbenvincent Jul 24, 2025
318dd6c
[pre-commit.ci] pre-commit autoupdate (#509)
pre-commit-ci[bot] Jul 24, 2025
7fbe255
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Jul 28, 2025
0aa7942
Adding BSTS changes and notebook updates
cetagostini Jul 28, 2025
7c71519
Resolve merge conflicts: fix __init__.py imports and remove doctest-m…
cetagostini Jul 28, 2025
af4864a
Merge main into cetagostini/adding_bsts_to_causalpy
cetagostini Jul 28, 2025
3acc970
Add notebook copy file
cetagostini Jul 28, 2025
256d30c
Remove leftover notebook copy file
cetagostini Jul 28, 2025
aab6310
Update notebook execution outputs
cetagostini Jul 28, 2025
31ee9b9
Making its work better
cetagostini Jul 28, 2025
13c0a62
Delete the dot model.
cetagostini Jul 28, 2025
229b4ec
Merge pull request #512 from pymc-labs/pre-commit-ci-update-config
drbenvincent Jul 29, 2025
ae81faa
address ben's final comments
NathanielF Jul 29, 2025
d4ba5be
Merge pull request #500 from NathanielF/propensity_score_latent
NathanielF Jul 29, 2025
3d3f482
Merge pull request #506 from pymc-labs/regression-discontinuity-treat…
drbenvincent Jul 29, 2025
09adfd7
Merge pull request #505 from pymc-labs/gen-time-series-data
drbenvincent Jul 29, 2025
6fd62ce
Merge branch 'main' into cetagostini/adding_bsts_to_causalpy
drbenvincent Jul 29, 2025
7ff87ee
update quasi dag for pre/post NEGD
drbenvincent Aug 1, 2025
2d6944e
Multiple refinements
drbenvincent Aug 2, 2025
1908b7c
remove redundant stuff
drbenvincent Aug 2, 2025
7313813
callout box for why tau is the ATE
drbenvincent Aug 4, 2025
cfee6f1
correct the discussion about backdoor path 3 and U_1
drbenvincent Aug 4, 2025
f7bde1e
add the do operator to make the intervention more clear
drbenvincent Aug 4, 2025
090772b
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Aug 4, 2025
9f5c8a4
update DAG formatting + sentence on conditional ignorability
drbenvincent Aug 5, 2025
6d2e5a7
fix typo
drbenvincent Aug 5, 2025
07e1119
Merge pull request #517 from pymc-labs/ancova
drbenvincent Aug 5, 2025
2016ff8
Merge pull request #518 from pymc-labs/pre-commit-ci-update-config
drbenvincent Aug 5, 2025
163475e
Requested changes
cetagostini Aug 11, 2025
947f02a
moving to drafts
cetagostini Aug 11, 2025
aa2ff9f
Small push
cetagostini Aug 11, 2025
d83664f
quick changes
cetagostini Aug 11, 2025
e8cf6e9
Changing
cetagostini Aug 11, 2025
a2e5e40
Correcting typo
cetagostini Aug 11, 2025
d7fcb43
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Aug 25, 2025
20f498a
Merge pull request #520 from pymc-labs/pre-commit-ci-update-config
drbenvincent Aug 28, 2025
e999480
Update UML Diagrams
github-actions[bot] Aug 28, 2025
e6e0037
Merge pull request #523 from pymc-labs/update-uml-diagrams
drbenvincent Aug 29, 2025
23e0f3e
Improve clarity of TWFE explanation (#522)
mercury0100 Aug 29, 2025
91ecda2
[pre-commit.ci] pre-commit autoupdate (#525)
pre-commit-ci[bot] Sep 27, 2025
b264193
remove spaces from previous code-block (#527)
williambdean Sep 29, 2025
77f8d59
drop python 3.10, add 3.13 (#529)
drbenvincent Sep 29, 2025
540893b
Support for custom priors via Prior class (#488)
williambdean Oct 3, 2025
673e805
[pre-commit.ci] pre-commit autoupdate (#530)
pre-commit-ci[bot] Oct 3, 2025
cdb4986
Merge branch 'main' into cetagostini/adding_bsts_to_causalpy
cetagostini Oct 3, 2025
89c7191
Changes by Nathaniel
cetagostini Oct 3, 2025
51689b8
[pre-commit.ci] pre-commit autoupdate (#531)
pre-commit-ci[bot] Oct 7, 2025
cbffe8e
attempt to get intersphinx mapping working with pymc-extras
drbenvincent Oct 11, 2025
b5ec091
run `make uml`
drbenvincent Oct 11, 2025
d78c0d6
[pre-commit.ci] pre-commit autoupdate (#535)
pre-commit-ci[bot] Oct 14, 2025
edb7f8d
[pre-commit.ci] pre-commit autoupdate (#536)
pre-commit-ci[bot] Oct 21, 2025
a9ccbfb
adding knowledgebase on SCM
NathanielF Oct 23, 2025
6c620a8
tidying spell check
NathanielF Oct 23, 2025
1d79fee
improve binary modelling with BART
NathanielF Oct 23, 2025
72c8104
update with CATE RUN
NathanielF Oct 24, 2025
6da45fd
add visual of probabilistic causal inference
NathanielF Oct 24, 2025
b01c6a3
update cate and po section
NathanielF Oct 25, 2025
c180054
fixing typos
NathanielF Oct 25, 2025
e359210
add PO diagram
NathanielF Oct 25, 2025
8999d91
added empirical example
NathanielF Oct 26, 2025
e682822
fix typo
NathanielF Oct 26, 2025
a6ddda9
Fix calculation/plotting mistake to now focus on posterior expectatio…
drbenvincent Oct 27, 2025
2d06be5
Fix bug in `SyntheticControl.get_plot_data` (#540)
drbenvincent Oct 27, 2025
9a88b01
Don't change matplotlib style on import of causalpy + misc dev fixes …
drbenvincent Oct 27, 2025
762137b
add fish tank analogy
NathanielF Oct 27, 2025
4807bec
Merge branch 'main' into cate_example
NathanielF Oct 27, 2025
4531097
fix typo
NathanielF Oct 27, 2025
0628b91
tidying text
NathanielF Oct 28, 2025
65db0b4
further tidying
NathanielF Oct 28, 2025
1d69dee
[pre-commit.ci] pre-commit autoupdate (#541)
pre-commit-ci[bot] Oct 28, 2025
9b27f64
added conclusion
NathanielF Oct 28, 2025
d92b135
Refactored scikit-learn flavour of `DifferenceInDifferences` and allo…
roesta07 Oct 28, 2025
34e2fe3
More sign posting
NathanielF Oct 28, 2025
8787868
update references and write up
NathanielF Oct 29, 2025
d5016b7
add CTA to the end.
NathanielF Oct 29, 2025
5cc9366
add bayes factor plot
NathanielF Oct 30, 2025
79beb30
hide table inputs for param comparison
NathanielF Oct 30, 2025
d941b77
tightening the introduction
NathanielF Oct 30, 2025
828ba2e
feat(Makefile): Add self-documenting commands and re-organise (#543)
louismagowan Oct 30, 2025
cbaba03
tightening
NathanielF Oct 30, 2025
373f011
tidying
NathanielF Oct 31, 2025
22753d3
fix typo
NathanielF Oct 31, 2025
b406d53
small fix
NathanielF Oct 31, 2025
eb05301
tightening the conclusion with advice
NathanielF Nov 1, 2025
757d150
Add module docstring for experiments module (#546)
louismagowan Nov 3, 2025
81eb020
[pre-commit.ci] pre-commit autoupdate (#549)
pre-commit-ci[bot] Nov 3, 2025
f620e25
tighten writing and add spike and slab model for nhefs
NathanielF Nov 7, 2025
62c27ed
tightening intro
NathanielF Nov 8, 2025
1f4f695
adding vs module
NathanielF Nov 10, 2025
cc4accb
[pre-commit.ci] pre-commit autoupdate (#551)
pre-commit-ci[bot] Nov 10, 2025
1b967b9
break up joint model function
NathanielF Nov 10, 2025
4abb697
Add `AGENTS.md` file (#552)
drbenvincent Nov 12, 2025
bc2fbae
Add Type Hints to `simulate_data.py` (#544)
louismagowan Nov 12, 2025
42bfcda
Add MyPy Checks (#556)
juanitorduz Nov 12, 2025
7dea992
Add reporting layer (#554)
drbenvincent Nov 12, 2025
9de06b2
small fix for Ben
NathanielF Nov 12, 2025
921c9f7
Merge pull request #537 from NathanielF/cate_example
NathanielF Nov 12, 2025
860c1bc
Add ITS lift testing notebook for MMM calibration (#547)
drbenvincent Nov 14, 2025
114d037
Add example use of custom priors to the notebook docs (#533)
drbenvincent Nov 14, 2025
efde473
bump version to 0.6.0 (#561)
drbenvincent Nov 14, 2025
f14c72d
Merge main into cetagostini/adding_bsts_to_causalpy
cetagostini Nov 18, 2025
0d875f8
Fix: Initialize second_model properly in StateSpaceTimeSeries
cetagostini Nov 18, 2025
c7d4b67
dev notebook
cetagostini Nov 18, 2025
0b4764d
[pre-commit.ci] pre-commit autoupdate (#566)
pre-commit-ci[bot] Nov 19, 2025
2a01933
Merge branch 'main' into vs_module
NathanielF Nov 19, 2025
db1e81d
adding demo notebook
NathanielF Nov 20, 2025
db0522e
trying to fix doctests
NathanielF Nov 20, 2025
1670af4
adding fix
NathanielF Nov 20, 2025
83061e4
another fix
NathanielF Nov 20, 2025
05dc20d
update fix
NathanielF Nov 20, 2025
73e6a8d
adding tests
NathanielF Nov 20, 2025
8d6251f
update adding more tests
NathanielF Nov 21, 2025
4577106
add normal test vs_prior
NathanielF Nov 21, 2025
91b2874
Merge branch 'main' into cetagostini/adding_bsts_to_causalpy
drbenvincent Nov 21, 2025
59c58ea
get new models to issue warnings that they are experimental
drbenvincent Nov 21, 2025
abdbf6b
create markdown file of issues to resolve given this initial BSTS imp…
drbenvincent Nov 21, 2025
1fc193b
Merge pull request #473 from pymc-labs/cetagostini/adding_bsts_to_cau…
cetagostini Nov 21, 2025
fd1bfb7
improving test coverage
NathanielF Nov 21, 2025
7375aa5
updating notebook
NathanielF Nov 21, 2025
896ee57
update index
NathanielF Nov 21, 2025
1bb79d3
Merge branch 'main' into vs_module
NathanielF Nov 21, 2025
068c922
update spelling
NathanielF Nov 21, 2025
13b320e
add binary treatment case to IV model
NathanielF Nov 22, 2025
6210116
adding more write up
NathanielF Nov 26, 2025
bf5b404
update heading
NathanielF Nov 26, 2025
b16ef30
hide cells
NathanielF Nov 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 16 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,34 @@ on:
branches: [main]

jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Run lint
uses: pre-commit/[email protected]

test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Update pip and setuptools
run: pip install --upgrade pip setuptools
- name: Setup environment
run: pip install -e .[test]
- name: Run doctests
run: pytest --doctest-modules --ignore=causalpy/tests/ causalpy/ --config-file=causalpy/tests/conftest.py
- name: Run extra tests
run: pytest docs/source/.codespell/test_notebook_to_markdown.py
- name: Run tests
run: pytest --cov-report=xml --no-cov-on-fail
- name: Check codespell for notebooks
run: |
pip install -e .[test]
pytest --cov-report=xml --no-cov-on-fail
python ./docs/source/.codespell/notebook_to_markdown.py --tempdir tmp_markdown
codespell
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # use token for more robust uploads
name: ${{ matrix.python-version }}
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/label-precommit-prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Label Pre-Commit PRs

on:
pull_request:
types: [opened, synchronize]

jobs:
label:
if: github.actor == 'pre-commit-ci[bot]'
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Add "no releasenotes" label
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: no releasenotes
40 changes: 22 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: PyPI release

on:
workflow_dispatch:
pull_request:
branches: [main]
push:
Expand All @@ -12,57 +14,59 @@ jobs:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.11
- name: Build the sdist and the wheel
run: |
pip install build
python -m build
ls dist # List the contents of the dist directory
- name: Check the sdist installs and imports
run: |
mkdir -p test-sdist
cd test-sdist
python -m venv venv-sdist
venv-sdist/bin/python -m pip install ../dist/CausalPy*.tar.gz
venv-sdist/bin/python -m pip install ../dist/causalpy*.tar.gz
echo "Checking import and version number (on release)"
venv-sdist/bin/python -c "import causalpy; assert causalpy.__version__ == '${{ github.ref_name }}' if '${{ github.ref_type }}' == 'tag' else causalpy.__version__; print(causalpy.__version__)"
venv-sdist/bin/python -c "import causalpy; assert causalpy.__version__ == '${{ github.ref_name }}' if '${{ github.ref_type }}' == 'tag' else causalpy.__version__; print(causalpy.__version__)"
cd ..
- name: Check the bdist installs and imports
run: |
mkdir -p test-bdist
cd test-bdist
python -m venv venv-bdist
venv-bdist/bin/python -m pip install ../dist/CausalPy*.whl
venv-bdist/bin/python -m pip install ../dist/causalpy*.whl
echo "Checking import and version number (on release)"
venv-bdist/bin/python -c "import causalpy; assert causalpy.__version__ == '${{ github.ref_name }}' if '${{ github.ref_type }}' == 'tag' else causalpy.__version__; print(causalpy.__version__)"
venv-bdist/bin/python -c "import causalpy; assert causalpy.__version__ == '${{ github.ref_name }}' if '${{ github.ref_type }}' == 'tag' else causalpy.__version__; print(causalpy.__version__)"
cd ..
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: artifact
path: dist/*

test:
name: Upload to Test PyPI
permissions:
id-token: write
needs: [build]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
skip_existing: true
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.11
- name: Test pip install from test.pypi
run: |
# Give time to test.pypi to update its index. If we don't wait,
Expand All @@ -71,19 +75,19 @@ jobs:
python -m venv venv-test-pypi
venv-test-pypi/bin/python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple causalpy
echo "Checking import and version number"
venv-test-pypi/bin/python -c "import causalpy; assert causalpy.__version__ == '${{ github.ref_name }}'"
venv-test-pypi/bin/python -c "import causalpy; assert causalpy.__version__ == '${{ github.ref_name }}'"

publish:
environment: release
permissions:
id-token: write
name: Upload release to PyPI
needs: [build, test]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
16 changes: 16 additions & 0 deletions .github/workflows/rtd-link-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Read the Docs Pull Request Preview
on:
pull_request_target:
types:
- opened

permissions:
pull-requests: write

jobs:
documentation-links:
runs-on: ubuntu-latest
steps:
- uses: readthedocs/actions/preview@v1
with:
project-slug: "causalpy"
73 changes: 73 additions & 0 deletions .github/workflows/uml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Update the UML Diagrams
on:
workflow_dispatch:
schedule:
- cron: '0 12 * * 1'

jobs:
build:
runs-on: ubuntu-latest
permissions: write-all
steps:

- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install 'causalpy[docs]'
sudo apt-get update && sudo apt-get install -y graphviz

- name: Install pylint explicitly
run: python -m pip install pylint

- name: Verify pylint and pyreverse
run: |
python -m pip show pylint
which pyreverse
pyreverse --version

- name: Configure Git Identity
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'

- name: Update the UML Diagrams
run: |
make uml

- name: Detect UML changes
id: changes
run: |
git add docs/source/_static/*.png
if git diff --staged --exit-code; then
echo "No changes to commit"
echo "changes_exist=false" >> $GITHUB_OUTPUT
else
echo "changes_exist=true" >> $GITHUB_OUTPUT
fi

- name: Create PR for changes
if: steps.changes.outputs.changes_exist == 'true'
run: |
git checkout -b update-uml-diagrams
git commit -m "Update UML Diagrams"
git push -u origin update-uml-diagrams
gh pr create \
--base main \
--title "Update UML Diagrams" \
--body "This PR updates the UML diagrams
This PR was created automatically by the [UML workflow](https://github.com/pymc-labs/CausalPy/blob/main/.github/workflows/uml.yml).
See the logs [here](https://github.com/pymc-labs/CausalPy/actions/workflows/uml.yml) for more details." \
--label "no releasenotes" \
--reviewer drbenvincent
env:
GH_TOKEN: ${{ github.token }}
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ _build
*.egg-info
build/
dist/
docs/_build/
*.vscode
.coverage
*.jupyterlab-workspace

# Sphinx documentation
docs/build/
docs/jupyter_execute/
docs/source/api/generated/
93 changes: 54 additions & 39 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,42 +1,57 @@
ci:
autofix_prs: false

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
exclude_types: [svg]
- id: end-of-file-fixer
exclude_types: [svg]
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: [--profile, black]
types: [python]
- repo: https://github.com/ambv/black
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
hooks:
- id: nbqa-black
# additional_dependencies: [jupytext] # optional, only if you're using Jupytext
- id: nbqa-pyupgrade
args: ["--py37-plus"]
- id: nbqa-isort
args: ["--float-to-top"]
- repo: https://github.com/econchick/interrogate
rev: 1.5.0
hooks:
- id: interrogate
# needed to make excludes in pyproject.toml work
# see here https://github.com/econchick/interrogate/issues/60#issuecomment-735436566
pass_filenames: false
- repo: https://github.com/lucianopaz/head_of_apache
rev: "0.1.1"
hooks:
- id: head_of_apache
args:
- --author=The PyMC Labs Developers
- --exclude=docs/
- --exclude=scripts/
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: debug-statements
- id: trailing-whitespace
exclude_types: [svg]
- id: end-of-file-fixer
exclude_types: [svg]
- id: check-yaml
- id: check-added-large-files
exclude: &exclude_pattern '(iv_weak_instruments|its_lift_test)\.ipynb'
args: ["--maxkb=1500"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.5
hooks:
# Run the linter
- id: ruff
types_or: [ python, pyi, jupyter ]
args: [ --fix ]
# Run the formatter
- id: ruff-format
types_or: [ python, pyi, jupyter ]
- repo: https://github.com/econchick/interrogate
rev: 1.7.0
hooks:
- id: interrogate
# needed to make excludes in pyproject.toml work
# see here https://github.com/econchick/interrogate/issues/60#issuecomment-735436566
pass_filenames: false
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
additional_dependencies:
# Support pyproject.toml configuration
- tomli
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.18.2
hooks:
- id: mypy
args: [--ignore-missing-imports]
files: ^causalpy/
additional_dependencies: [numpy>=1.20, pandas-stubs]
4 changes: 2 additions & 2 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
os: ubuntu-lts-latest
tools:
python: "3.10"
python: "3.11"
# You can also specify other tool versions:
# nodejs: "16"
# rust: "1.55"
Expand Down
Loading