|
| 1 | +--- |
| 2 | +title: Contributing to GPJax |
| 3 | +--- |
| 4 | + |
| 5 | +GPJax welcomes contributions from interested individuals or groups. |
| 6 | +These guidelines help explain how you can contribute to the library |
| 7 | + |
| 8 | +There are 4 main ways of contributing to the library (in descending |
| 9 | +order of difficulty or scope): |
| 10 | + |
| 11 | +- Adding new or improved functionality to the existing codebase |
| 12 | +- Fixing outstanding issues (bugs) with the existing codebase. They |
| 13 | + range from low-level software bugs to higher-level design problems. |
| 14 | +- Contributing or improving the |
| 15 | + [docs](https://github.com/thomaspinder/GPJax/tree/master/docs) or |
| 16 | + [examples](https://github.com/thomaspinder/GPJax/tree/master/docs/nbs). |
| 17 | +- Submitting issues related to bugs or desired enhancements |
| 18 | + |
| 19 | +# Code of conduct |
| 20 | + |
| 21 | +As a contributor to GPJax, you can help us keep the community open and |
| 22 | +inclusive. Please read and follow our [Code of |
| 23 | +Conduct](https://github.com/thomaspinder/GPJax/blob/master/.github/CODE_OF_CONDUCT.md). |
| 24 | + |
| 25 | +# Opening issues and getting support |
| 26 | + |
| 27 | +Please open issues on [Github Issue |
| 28 | +Tracker](https://github.com/thomaspinder/GPJax/issues/new/choose). |
| 29 | + |
| 30 | +You can ask a question or start a discussion in the [Discussion |
| 31 | +section](https://github.com/thomaspinder/GPJax/discussions) on Github. |
| 32 | + |
| 33 | +# Contributing code via pull requests |
| 34 | + |
| 35 | +Please submit patches via pull requests. |
| 36 | + |
| 37 | +The preferred workflow for contributing is to fork the [GitHub |
| 38 | +repository](https://github.com/thomaspinder/GPJax), clone it to your |
| 39 | +local machine, and develop on a feature branch. Once you are ready to |
| 40 | +commit your changes, install the pre-commit hooks with |
| 41 | +`pre-commit install` and the commit and push your code as usual. |
| 42 | + |
| 43 | +Steps: |
| 44 | + |
| 45 | +1. Fork the [project repository](https://github.com/thomaspinder/GPJax) |
| 46 | + by clicking on the 'Fork' button near the top right of the main |
| 47 | + repository page. This creates a copy of the code under your GitHub |
| 48 | + user account. |
| 49 | + |
| 50 | +2. Clone your fork of the GPJax repo from your GitHub account to your |
| 51 | + local disk, and add the base repository as a remote: |
| 52 | + |
| 53 | + ```bash |
| 54 | + $ git clone [email protected]: <your GitHub handle >/GPJax.git |
| 55 | + $ cd GPJax |
| 56 | + $ git remote add upstream [email protected]:GPJax.git |
| 57 | + ``` |
| 58 | + |
| 59 | +3. Create a `feature` branch to hold your development changes: |
| 60 | + |
| 61 | + ```bash |
| 62 | + $ git checkout -b my-feature |
| 63 | + ``` |
| 64 | + |
| 65 | + Always use a `feature` branch. It's good practice to never routinely |
| 66 | + work on the `master` branch of any repository. |
| 67 | +
|
| 68 | +4. Project requirements are in `requirements.txt`. |
| 69 | +
|
| 70 | + We suggest using a [virtual |
| 71 | + environment](https://docs.python-guide.org/dev/virtualenvs/) for |
| 72 | + development. Once the virtual environment is activated, run: |
| 73 | +
|
| 74 | + ```bash |
| 75 | + $ pip install -e . |
| 76 | + $ pip install -r requirements-dev.txt |
| 77 | + ``` |
| 78 | +
|
| 79 | +5. Install the pre-commit hooks. Please **ensure you do this before |
| 80 | + commiting any files**. This can be done by executing the following: |
| 81 | +
|
| 82 | + ```bash |
| 83 | + $ pre-commit install |
| 84 | + ``` |
| 85 | +
|
| 86 | + If successful, this will print the following output |
| 87 | + `pre-commit installed at .git/hooks/pre-commit`. |
| 88 | +
|
| 89 | +6. Develop the feature on your feature branch. Add changed files using |
| 90 | + `git add` and then `git commit` files: |
| 91 | +
|
| 92 | + ```bash |
| 93 | + $ git add modified_files |
| 94 | + $ git commit |
| 95 | + ``` |
| 96 | +
|
| 97 | + to record your changes locally. After committing, it is a good idea |
| 98 | + to sync with the base repository in case there have been any |
| 99 | + changes: |
| 100 | +
|
| 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 | +7. Go to the GitHub web page of your fork of the GPJax repo. Click the |
| 113 | + 'Pull request' button to send your changes to the project's |
| 114 | + maintainer for review. |
| 115 | + |
| 116 | +# Pull request checklist |
| 117 | + |
| 118 | +We recommended that your contribution complies with the following |
| 119 | +guidelines before you submit a pull request: |
| 120 | + |
| 121 | +- If your pull request addresses an issue, please use the pull request |
| 122 | + title to describe the issue and mention the issue number in the pull |
| 123 | + request description. This will make sure a link back to the original |
| 124 | + issue is created. |
| 125 | + |
| 126 | +- All public methods must have informative docstrings |
| 127 | + |
| 128 | +- Please prefix the title of incomplete contributions with `[WIP]` (to |
| 129 | + indicate a work in progress). WIPs may be useful to (1) indicate you |
| 130 | + are working on something to avoid duplicated work, (2) request broad |
| 131 | + review of functionality or API, or (3) seek collaborators. |
| 132 | + |
| 133 | +- All other tests pass when everything is rebuilt from scratch. |
| 134 | + |
| 135 | +- Documentation and high-coverage tests are necessary for enhancements |
| 136 | + to be accepted. |
| 137 | + |
| 138 | +- Code with good test, check with: |
| 139 | + |
| 140 | + ```bash |
| 141 | + $ pip install -r requirements-dev.txt |
| 142 | + $ pytest tests --cov=./ --cov-report=html |
| 143 | + ``` |
| 144 | + |
| 145 | +This guide was derived from [PyMC's guide to |
| 146 | +contributing](https://github.com/pymc-devs/pymc/blob/main/CONTRIBUTING.md) |
0 commit comments