Skip to content

Commit 56a2ddd

Browse files
authored
Merge branch 'main' into basic_ci
2 parents 141caa9 + a932fbe commit 56a2ddd

24 files changed

+3643
-850
lines changed

CONTRIBUTING.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,34 @@ If there are autodoc issues/errors in remote builds of the docs, we need to add
7272

7373
## New releases [work in progress]
7474

75+
### Test release to `test.pypi.org` (manual)
76+
7577
1. Bump the release version in `causalpy/version.py`. This is automatically read by `setup.py` and `docs/config.py`.
76-
2. Update on pypi.org. In the root directory:
77-
- `python setup.py sdist`
78-
- update to pypi.org with `twine upload dist/*`
78+
2. Build locally and upload to test.pypi.org. _Note that this requires username and password for test.pypi.org_. In the root directory type the following:
79+
```bash
80+
rm -rf dist
81+
python setup.py sdist
82+
twine upload --repository testpypi dist/*
83+
```
84+
3. At this point the updated build is available on test.pypi.org. We can test that this is working as expected by installing (into a test environment) from test.pypi.org with
85+
86+
```bash
87+
conda create -n causalpy-test python
88+
conda activate causalpy-test
89+
python3 -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ causalpy
90+
```
91+
92+
4. Now load a python or ipython session and follow the quickstart instructions to confirm things work.
93+
94+
### Actual release to `pypi.org` (manual)
95+
96+
1. Bump the release version (if not done in the previous step) in `causalpy/version.py`. This is automatically read by `setup.py` and `docs/config.py`.
97+
2. Build locally and upload to pypi.org. In the root directory:
98+
```bash
99+
rm -rf dist
100+
python setup.py sdist
101+
twine upload dist/*
102+
```
79103
3. Readthedocs:
80104
- Docs should be built remotely every time there is a pull request
81105
- See here https://docs.readthedocs.io/en/stable/tutorial/#versioning-documentation for versioning the docs

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,23 @@ pip install git+https://github.com/pymc-labs/CausalPy.git
3737
## Quickstart
3838

3939
```python
40-
from causalpy.pymc_experiments import RegressionDiscontinuity
41-
from causalpy.pymc_models import LinearRegression
42-
import pandas as pd
43-
import pathlib
40+
import causalpy as cp
4441

4542

4643
# Import and process data
47-
rd_data_path = pathlib.Path.cwd().parents[1] / "causalpy" / "data" / "drinking.csv"
4844
df = (
49-
pd.read_csv(rd_data_path)[["agecell", "all", "mva", "suicide"]]
45+
cp.load_data("drinking")
5046
.rename(columns={"agecell": "age"})
5147
.assign(treated=lambda df_: df_.age > 21)
5248
.dropna(axis=0)
5349
)
5450

5551
# Run the analysis
56-
result = RegressionDiscontinuity(
52+
result = cp.pymc_experiments.RegressionDiscontinuity(
5753
df,
5854
formula="all ~ 1 + age + treated",
5955
running_variable_name="age",
60-
prediction_model=LinearRegression(),
56+
prediction_model=cp.pymc_models.LinearRegression(),
6157
treatment_threshold=21,
6258
)
6359

causalpy/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import arviz as az
2+
3+
import causalpy.pymc_experiments
4+
import causalpy.pymc_models
5+
import causalpy.skl_experiments
6+
import causalpy.skl_models
7+
8+
from .data import load_data
9+
10+
az.style.use("arviz-darkgrid")

causalpy/data/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
"""Code for loading datasets."""
2+
from .datasets import load_data
3+
4+
__all__ = ["load_data"]

0 commit comments

Comments
 (0)