Skip to content

Commit a8e5b53

Browse files
michaelosthegecanyon289OriolAbril
authored
Update contributing guide with etiquette section (#5611)
* Update outdated parts of contributing guide and PR template * Add section on contribution etiquette Co-authored-by: Ravin Kumar <[email protected]> Co-authored-by: Oriol Abril <[email protected]>
1 parent 849a64d commit a8e5b53

File tree

2 files changed

+74
-43
lines changed

2 files changed

+74
-43
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11

22
**Thank your for opening a PR!**
33

4+
Before you proceed, please make sure that [the pre-commit linting/style checks pass](https://docs.pymc.io/en/latest/contributing/python_style.html).
5+
46
Depending on what your PR does, here are a few things you might want to address in the description:
57
+ [ ] what are the (breaking) changes that this PR makes?
68
+ [ ] important background, or details about the implementation
79
+ [ ] are the changes—especially new features—covered by tests and docstrings?
8-
+ [ ] [linting/style checks have been run](https://docs.pymc.io/en/latest/contributing/python_style.html)
910
+ [ ] [consider adding/updating relevant example notebooks](https://github.com/pymc-devs/pymc-examples)
1011
+ [ ] right before it's ready to merge, mention the PR in the RELEASE-NOTES.md

CONTRIBUTING.md

Lines changed: 72 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,112 +9,141 @@ There are 4 main ways of contributing to the PyMC project (in descending order o
99
* Contributing or improving the documentation (`docs`) or examples (`pymc/examples`)
1010
* Submitting issues related to bugs or desired enhancements
1111

12-
# Opening issues
12+
## Opening issues
1313

1414
We appreciate being notified of problems with the existing PyMC code. We prefer that issues be filed the on [Github Issue Tracker](https://github.com/pymc-devs/pymc/issues), rather than on social media or by direct email to the developers.
1515

1616
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.
1717

1818
Filter on the ["beginner friendly"](https://github.com/pymc-devs/pymc/issues?q=is%3Aopen+is%3Aissue+label%3A%22beginner+friendly%22) label for issues which are good for new contributors.
1919

20-
# Contributing code via pull requests
20+
## Etiquette for code contributions
21+
* When you start working working on an issue, open a `Draft` pull request as soon as you make your first commit (see steps below).
22+
* Before opening a PR with a new feature, please make a proposal by opening an [issue](https://github.com/pymc-devs/pymc/issues) or [Discussion](https://github.com/pymc-devs/pymc/discussions) with the maintainers. Depending on the proposal we might direct you to other places such as [`pymc-experimental`](https://github.com/pymc-devs/pymc-experimental) or [`pymc-examples`](https://github.com/pymc-devs/pymc-examples).
23+
* Any issue without an open pull request is available for work.
24+
* If a pull request has no recent activity it may be closed, or taken over by someone else.
25+
* The specific timeframe for "recent" is hard to define as it depends on the contributor the specific code change, and other contextual factors. As a rule of thumb in a normal pull request with no other blockers there is typically activity every couple of days.
26+
* The core devs will make their best judgement when opting to close PRs or reassign them to others.
27+
* If unsure if an issue ticket is available feel free to ask in the issue ticket. Note however, that per the previous point an open pull request is way to claim an issue ticket. Please do not make unrealistic pledges in the issue tickets.
28+
* It's okay if you are delayed or need to take a break, but please leave a comment in the pull request if you cannot get it to a state where it can be merged. Depending on the change (urgent bugfix vs. new feature) the core devs can determine if the PR needs to be reassigned to get the work done.
29+
30+
## Contributing code via pull requests
2131

2232
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.
2333

2434
Contributors are also encouraged to contribute new code to enhance PyMC's functionality, also via pull requests. Please consult the [PyMC documentation](https://pymc-devs.github.io/pymc/) to ensure that any new contribution does not strongly overlap with existing functionality.
2535

2636
The preferred workflow for contributing to PyMC is to fork the [GitHub repository](https://github.com/pymc-devs/pymc/), clone it to your local machine, and develop on a feature branch.
2737

28-
## Steps:
38+
### Steps
39+
40+
1. Read the [Etiquette for code contributions](#etiquette-for-code-contributions).
2941

3042
1. Fork the [project repository](https://github.com/pymc-devs/pymc/) 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.
3143

32-
2. Clone your fork of the PyMC repo from your GitHub account to your local disk, and add the base repository as a remote:
44+
1. Clone your fork of the PyMC repo from your GitHub account to your local disk, and add the base repository as a remote:
3345

3446
```bash
35-
$ git clone [email protected]:<your GitHub handle>/pymc.git
36-
$ cd pymc
37-
$ git remote add upstream [email protected]:pymc-devs/pymc.git
47+
git clone [email protected]:<your GitHub handle>/pymc.git
48+
cd pymc
49+
git remote add upstream [email protected]:pymc-devs/pymc.git
3850
```
3951

40-
3. Create a ``feature`` branch to hold your development changes:
52+
1. Create a ``feature`` branch to hold your development changes:
4153

4254
```bash
43-
$ git checkout -b my-feature
55+
git checkout -b my-feature
4456
```
4557

4658
Always use a ``feature`` branch. It's good practice to never routinely work on the ``main`` branch of any repository.
4759

48-
4. Project requirements are in ``requirements.txt``, and libraries used for development are in ``requirements-dev.txt``. The easiest (and recommended) way to set up a development environment is via [miniconda](https://docs.conda.io/en/latest/miniconda.html):
60+
1. Project requirements are in ``requirements.txt``, and libraries used for development are in ``requirements-dev.txt``. The easiest (and recommended) way to set up a development environment is via [miniconda](https://docs.conda.io/en/latest/miniconda.html):
4961

5062
```bash
51-
$ conda env create -f conda-envs/environment-dev-py37.yml # or py38 or py39
52-
$ conda activate pymc-dev-py37
53-
$ pip install -e .
63+
conda env create -f conda-envs/environment-dev-py39.yml # or py38 or py37
64+
conda activate pymc-dev-py39
65+
pip install -e .
5466
```
5567

5668
_Alternatively_ you may (probably in a [virtual environment](https://docs.python-guide.org/dev/virtualenvs/)) run:
5769

5870
```bash
59-
$ pip install -e .
60-
$ pip install -r requirements-dev.txt
71+
pip install -e .
72+
pip install -r requirements-dev.txt
6173
```
62-
74+
<!-- Commented out because our Docker image is outdated/broken.
6375
Yet another alternative is to create a docker environment for development. See: [Developing in Docker](#Developing-in-Docker).
76+
-->
6477

65-
5. Develop the feature on your feature branch. Add changed files using ``git add`` and then ``git commit`` files:
78+
1. Develop the feature on your feature branch.
79+
```bash
80+
git checkout -b my-cool-bugfix
81+
```
6682

83+
1. Before committing, please run `pre-commit` checks.
6784
```bash
68-
$ git add modified_files
69-
$ git commit
85+
pip install pre-commit
86+
pre-commit run --all # 👈 to run it manually
87+
pre-commit install # 👈 to run it automatically before each commit
88+
```
89+
90+
1. Add changed files using ``git add`` and then ``git commit`` files:
91+
```bash
92+
git checkout -b my-cool-bugfix
93+
git add modified_files
94+
git commit
7095
```
7196

7297
to record your changes locally.
73-
After committing, it is a good idea to sync with the base repository in case there have been any changes:
98+
99+
1. After committing, sync with the base repository in case there have been any changes:
74100
```bash
75-
$ git fetch upstream
76-
$ git rebase upstream/main
101+
git fetch upstream
102+
git rebase upstream/main
77103
```
78104

79-
Then push the changes to your GitHub account with:
105+
Then push the changes to the fork in your GitHub account with:
80106

81107
```bash
82-
$ git push -u origin my-feature
108+
git push -u origin my-cool-bugfix
83109
```
84110

85-
6. Go to the GitHub web page of your fork of the PyMC 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.
111+
1. Go to the GitHub web page of your fork of the PyMC repo. Click the 'Pull request' button to open a pull request to the main project. Our CI pipeline will start running tests* and project maintainers can start reviewing your changes.
112+
<sup>*If this is your first contribution, the start of some CI jobs will have to be approved by a maintainer.</sup>
86113

87-
## Pull request checklist
114+
### Pull request checklist
88115

89116
We recommended that your contribution complies with the following guidelines before you submit a pull request:
90117

91118
* 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.
92119

93120
* All public methods must have informative docstrings with sample usage when appropriate.
94121

95-
* Please prefix the title of incomplete contributions with `[WIP]` (to indicate a work in progress). WIPs 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.
96-
97-
* All other tests pass when everything is rebuilt from scratch. See
98-
[Developing in Docker](#Developing-in-Docker) for information on running the test suite locally.
122+
* Please select "Create draft pull request" in the dropdown menu when opening your pull request to indicate a work in progress. This is to avoid duplicated work, to get early input on implementation details or API/functionality, or to seek collaborators.
99123

100-
* When adding additional functionality, provide at least one example script or Jupyter Notebook in the ``pymc/examples/`` folder. Have a look at other examples for reference. Examples should demonstrate why the new functionality is useful in practice and, if possible, compare it to other methods available in PyMC.
124+
<!-- Commented out because our Docker image is outdated/broken.
125+
See [Developing in Docker](#Developing-in-Docker) for information on running the test suite locally.
126+
-->
101127

102128
* Documentation and high-coverage tests are necessary for enhancements to be accepted.
103129

104-
* Run any of the pre-existing examples in ``docs/source/notebooks`` 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 PyMC for end users.
130+
* Depending on the functionality, please consider contributing an example Jupyter Notebook to [`pymc-examples`](https://github.com/pymc-devs/pymc-examples). Examples should demonstrate why the new functionality is useful in practice and, if possible, compare it to other methods available in PyMC.
105131

106-
You can also check for common programming errors with the following
107-
tools:
132+
* __No `pre-commit` errors:__ see the [Python code style](https://github.com/pymc-devs/pymc/wiki/Python-Code-Style) and [Jupyter Notebook style](https://github.com/pymc-devs/pymc/wiki/PyMC-Jupyter-Notebook-Style-Guide) page from our Wiki on how to install and run it.
108133

109-
* Code with good test **coverage** (at least 80%), check with:
134+
In addition to running `pre-commit`, please also run tests:
110135

111-
```bash
112-
$ pip install pytest pytest-cov coverage
113-
$ pytest --cov=pymc pymc/tests/<name of test>.py
114-
```
136+
```bash
137+
pip install pytest pytest-cov coverage
138+
139+
# To run a subset of tests
140+
pytest --verbose pymc/tests/<name of test>.py
115141

116-
* No `pre-commit` errors: see the [Python code style](https://github.com/pymc-devs/pymc/wiki/Python-Code-Style) and [Jupyter Notebook style](https://github.com/pymc-devs/pymc/wiki/PyMC-Jupyter-Notebook-Style-Guide) page from our Wiki on how to install and run it.
142+
# To get a coverage report
143+
pytest --verbose --cov=pymc --cov-report term-missing pymc/tests/<name of test>.py
144+
```
117145

146+
<!-- Commented out because our Docker image is outdated/broken.
118147
## Developing in Docker
119148
120149
We have provided a Dockerfile which helps for isolating build problems, and local development.
@@ -142,6 +171,7 @@ accessed with
142171
```
143172
docker exec -it pymc jupyter notebook list
144173
```
174+
-->
145175

146176
## Style guide
147177

@@ -150,6 +180,6 @@ We encourage you to configure the pre-commit hook as described in the [PyMC Pyth
150180

151181
Similarly, consult the [PyMC's Jupyter Notebook Style](https://docs.pymc.io/en/latest/contributing/jupyter_style.html) guides for notebooks.
152182

153-
For documentation strings, we *prefer* [numpy style](https://numpydoc.readthedocs.io/en/latest/format.html) to comply with the style that predominates in our upstream dependencies.
183+
For documentation strings, we use [numpy style](https://numpydoc.readthedocs.io/en/latest/format.html) to comply with the style that predominates in our upstream dependencies.
154184

155-
#### This guide was derived from the [scikit-learn guide to contributing](https://github.com/scikit-learn/scikit-learn/blob/master/CONTRIBUTING.md)
185+
__This guide was derived from the [scikit-learn guide to contributing](https://github.com/scikit-learn/scikit-learn/blob/master/CONTRIBUTING.md)__

0 commit comments

Comments
 (0)