You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository is under active development by a small number of contributors at the moment. Once the code and API has settled a bit we will open up and welcome contributions. But not yet.
3
+
CausalPy welcomes contributions from interested individuals or groups. These guidelines are provided to give potential contributors information to make their contribution compliant with the conventions of the CausalPy project, and maximize the probability of such contributions are merged as quickly and efficiently as possible. Contributors need not be experts, but should be interested in the project, willing to learn, and share knowledge.
4
4
5
-
## Setup for local development
5
+
There are 4 main ways of contributing to the CausalPy project (in ascending order of difficulty or scope):
6
6
7
-
1. Create a new environment using Python >=3.8, for example 3.10
7
+
1. Submitting issues related to bugs or desired enhancements.
8
+
2. Contributing or improving the documentation (docs) or examples.
9
+
3. Fixing outstanding issues (bugs) with the existing codebase. They range from low-level software bugs to higher-level design problems.
10
+
4. Adding new or improved functionality to the existing codebase.
8
11
9
-
```
10
-
conda create --name CausalPy python=3.10
11
-
```
12
+
Items 2-4 require setting up a local development environment, see [Local development steps](#Local-development-steps) for more information.
12
13
13
-
2. Activate environment:
14
+
## Opening issues
14
15
15
-
```
16
-
conda activate CausalPy
17
-
```
16
+
We appreciate being notified of problems with the existing CausalPy code. We prefer that issues be filed the on [Github Issue Tracker](https://github.com/pymc-labs/CausalPy/issues), rather than on social media or by direct email to the developers.
18
17
19
-
3. Install the package in editable mode
18
+
Please verify that your issue is not being currently addressed by other issues or pull requests by using the GitHub search tool to look for key words in the project issue tracker.
20
19
21
-
```
22
-
pip install -e .
23
-
```
20
+
## Contributing code via pull requests
24
21
25
-
4. Install development dependencies
22
+
While issue reporting is valuable, we strongly encourage users who are inclined to do so to submit patches for new or existing issues via pull requests. This is particularly the case for simple fixes, such as typos or tweaks to documentation, which do not require a heavy investment of time and attention.
26
23
27
-
```
28
-
pip install causalpy[dev]
29
-
pip install causalpy[docs]
30
-
pip install causalpy[test]
31
-
pip install causalpy[lint]
32
-
```
24
+
Contributors are also encouraged to contribute new code to enhance CausalPy's functionality, via pull requests.
33
25
34
-
If that fails, try:
26
+
The preferred workflow for contributing to CausalPy is to fork the GitHub repository, clone it to your local machine, and develop on a feature branch.
35
27
36
-
```
37
-
pip install 'causalpy[dev]'
38
-
pip install 'causalpy[docs]'
39
-
pip install 'causalpy[test]'
40
-
pip install 'causalpy[lint]'
41
-
```
28
+
For more instructions see the [Pull request checklist](#pull-request-checklist)
42
29
43
-
It may also be necessary to [install](https://pandoc.org/installing.html)`pandoc`. On a mac, I run `brew install pandoc`.
30
+
## Local development steps
44
31
45
-
5. You may also need to run this to get pre-commit checks working
32
+
1. If you have not already done so, fork the [project repository](https://github.com/pymc-labs/CausalPy) by clicking on the 'Fork' button near the top right of the main repository page. This creates a copy of the code under your GitHub user account.
46
33
47
-
```
48
-
pre-commit install
49
-
```
34
+
1. Clone your fork of the `CausalPy` repo from your GitHub account to your local disk, and add the base repository as a remote:
50
35
51
-
6. Note: You may have to run the following command to make Jupyter Lab aware of the `CausalPy` environment.
1. Create a feature branch (e.g. `my-feature`) to hold your development changes:
56
43
57
-
## Building the documentation locally
44
+
```bash
45
+
git checkout -b my-feature
46
+
```
47
+
48
+
Always use a feature branch. It's good practice to never routinely work on the `main` branch of any repository.
49
+
50
+
1. Create a new environment using Python >=3.8, for example 3.11
51
+
52
+
```bash
53
+
conda create --name CausalPy python=3.11
54
+
```
55
+
56
+
Activate the environment.
57
+
58
+
```bash
59
+
conda activate CausalPy
60
+
```
61
+
62
+
Install the package (in editable mode) and its development dependencies:
63
+
64
+
```bash
65
+
pip install -e .
66
+
```
67
+
68
+
Install development dependencies
69
+
70
+
```
71
+
pip install 'causalpy[dev]'
72
+
pip install 'causalpy[docs]'
73
+
pip install 'causalpy[test]'
74
+
pip install 'causalpy[lint]'
75
+
```
76
+
77
+
It may also be necessary to [install](https://pandoc.org/installing.html) `pandoc`. On a mac, run `brew install pandoc`.
78
+
79
+
Set [pre-commit hooks](https://pre-commit.com/)
80
+
81
+
```bash
82
+
pre-commit install
83
+
```
84
+
85
+
If you are editing or writing new examples in the form of Jupyter notebooks, you may have to run the following command to make Jupyter Lab aware of the `CausalPy` environment.
After committing, it is a good idea to sync with the base repository in case there have been any changes:
58
100
59
-
Ensure the right packages (in `requirements-docs.txt`) are available in the environment. See the steps above.
101
+
```bash
102
+
git fetch upstream
103
+
git rebase upstream/main
104
+
```
105
+
106
+
Then push the changes to your GitHub account with:
107
+
108
+
```bash
109
+
git push -u origin my-feature
110
+
```
111
+
112
+
1. Before you submit a Pull request, follow the [Pull request checklist](#pull-request-checklist).
113
+
114
+
1. Finally, to submit a pull request, go to the GitHub web page of your fork of the CausalPy repo. Click the 'Pull request' button to send your changes to the project's maintainers for review. This will send an email to the committers.
115
+
116
+
## Pull request checklist
117
+
118
+
We recommend that your contribution complies with the following guidelines before you submit a pull request:
119
+
120
+
- If your pull request addresses an issue, please use the pull request title to describe the issue and mention the issue number in the pull request description. This will make sure a link back to the original issue is created.
121
+
122
+
- All public methods must have informative docstrings with sample usage when appropriate.
123
+
124
+
- To indicate a work in progress please mark the PR as `draft`. Drafts may be useful to (1) indicate you are working on something to avoid duplicated work, (2) request broad review of functionality or API, or (3) seek collaborators.
125
+
126
+
- All other tests pass when everything is rebuilt from scratch.
127
+
128
+
- When adding additional functionality, either edit an existing example, or create a new example (typically in the form of a Jupyter Notebook) in the `CausalPy/docs/source/mmm` or `CausalPy/docs/source/clv` folders. Have a look at other examples forreference. Examples should demonstrate why the new functionality is usefulin practice.
129
+
130
+
- Documentation and high-coverage tests are necessary for enhancements to be accepted.
- If you have changed the documentation, you should [build the docs locally](#Building-the-documentation-locally) and check that the changes look correct.
135
+
136
+
- Run any of the pre-existing examples in`CausalPy/docs/source/*` that contain analyses that would be affected by your changes to ensure that nothing breaks. This is a useful opportunity to not only check your work for bugs that might not be revealed by unit test, but also to show how your contribution improves CausalPy for end users.
137
+
138
+
- Your code passes linting tests. Run the line below to check linting errors:
139
+
140
+
```bash
141
+
make check_lint
142
+
```
143
+
If you want to fix linting errors automatically, run
144
+
145
+
```bash
146
+
make lint
147
+
```
148
+
149
+
1. To run tests:
150
+
151
+
```bash
152
+
make test
153
+
```
154
+
155
+
6. To check code style:
156
+
157
+
```bash
158
+
make check_lint
159
+
```
160
+
161
+
## Building the documentation locally
60
162
61
163
A local build of the docs is achieved by:
62
164
@@ -73,16 +175,6 @@ make clean && make html
73
175
74
176
Docs are built in`docs/_build`, but these docs are _not_ committed to the GitHub repository due to `.gitignore`.
75
177
76
-
## Remote documentation
77
-
78
-
Documentation is hosted on https://causalpy.readthedocs.io/. New remote builds are triggered automatically whenever there is an update to the `main` branch.
79
-
80
-
The `.readthedocs.yaml` file contains the configurations for the remote build.
81
-
82
-
If there are autodoc issues/errors in remote builds of the docs, we need to add all package dependencies (in `requirements.txt`) into the list `autodoc_mock_imports` in `docs/config.py`.
83
-
84
-
85
-
86
178
## Overview of code structure
87
179
88
180
UML diagrams can be created with the command below. If you have not already done so, you may need to `pip install 'causalpy[lint]'` in order to install `pyreverse`.
@@ -96,3 +188,7 @@ Classes
96
188
97
189
Packages
98
190

191
+
192
+
---
193
+
194
+
This guide takes some inspiration from the [Bambi guide to contributing](https://github.com/bambinos/bambi/blob/main/docs/CONTRIBUTING.md)
0 commit comments