|
| 1 | +### `pca-errors` |
| 2 | + |
| 3 | +## Contributing Guideline |
| 4 | + |
| 5 | +First off, thanks for taking the time to contribute! |
| 6 | + |
| 7 | +The following is a set of guidelines for contributing to `pca-errors` on GitHub. These are mostly guidelines, not rules. Use your best judgement, and feel free to propose changes to this document in a pull request. |
| 8 | + |
| 9 | +### Table of contents |
| 10 | + |
| 11 | +- [Contributing Guideline](#contributing-guideline) |
| 12 | + - [Table of contents](#table-of-contents) |
| 13 | +- [How to contribute](#how-to-contribute) |
| 14 | + - [Reporting bugs](#reporting-bugs) |
| 15 | + - [Before submitting a bug report](#before-submitting-a-bug-report) |
| 16 | + - [How do I submit a bug report?](#how-do-i-submit-a-bug-report) |
| 17 | + - [Suggesting enhancements](#suggesting-enhancements) |
| 18 | + - [Before submitting an enhancement suggestion](#before-submitting-an-enhancement-suggestion) |
| 19 | + - [How do I submit an Enhancement suggestion?](#how-do-i-submit-an-enhancement-suggestion) |
| 20 | + - [Contributing to the code](#contributing-to-the-code) |
| 21 | + - [Local development](#local-development) |
| 22 | + - [Local testing](#local-testing) |
| 23 | + - [Pull requests](#pull-requests) |
| 24 | + |
| 25 | +## How to contribute |
| 26 | + |
| 27 | +### Reporting bugs |
| 28 | + |
| 29 | +This section guides you through submitting a bug report for `pca-errors`. |
| 30 | +Following these guidelines helps maintainers and the community understand your report, reproduce the behavior, and find related reports. |
| 31 | + |
| 32 | +#### Before submitting a bug report |
| 33 | + |
| 34 | +...**check that your issue does not already exist in the [issue tracker](https://github.com/pcah/pca-errors/issues)**. |
| 35 | + |
| 36 | +> **Note:** If you find a **Closed** issue that seems like it is the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one. |
| 37 | +
|
| 38 | +#### How do I submit a bug report? |
| 39 | + |
| 40 | +Bugs are tracked on the [issue tracker](https://github.com/pcah/pca-errors/issues) where you can create a new one and provide the following information by filling in [the bug report template](https://github.com/pcah/pca-errors/blob/master/docs/issue-templates/bug-report.md). |
| 41 | + |
| 42 | +Explain the problem and include additional details to help maintainers reproduce the problem: |
| 43 | + |
| 44 | +- **Use a clear and descriptive title** for the issue to identify the problem. |
| 45 | +- **Describe the exact steps which reproduce the problem** in as many details as possible. |
| 46 | +- **Provide specific examples to demonstrate the steps to reproduce the issue**. Include links to files or GitHub projects, or copy-paste-able snippets, which you use in those examples. |
| 47 | +- **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior. |
| 48 | +- **Explain which behavior you expected to see instead and why.** |
| 49 | + |
| 50 | +Provide more context by answering these questions: |
| 51 | + |
| 52 | +- **Did the problem start happening recently** (e.g. after updating to a new version of `pca-errors`) or was this always a problem? |
| 53 | +- If the problem started happening recently, **can you reproduce the problem in an older version of `pca-errors`?** What's the most recent version in which the problem doesn't happen? |
| 54 | +- **Can you reliably reproduce the issue?** If not, provide details about how often the problem happens and under which conditions it normally happens. |
| 55 | + |
| 56 | +Include details about your configuration and environment: |
| 57 | + |
| 58 | +- **Which version of `pca-errors` are you using?** You can get the exact version by running `python -c "import pca.packages.errors; print(pca.packages.errors.VERSION)"` in your terminal in the python environment or `poetry version` in the library repository. |
| 59 | +- **Which Python version `pca-errors` has been installed for?** Execute the `python -V` to get the information. |
| 60 | +- **What's the name and version of the OS you're using**? |
| 61 | + |
| 62 | +### Suggesting enhancements |
| 63 | + |
| 64 | +This section guides you through submitting an enhancement suggestion for `pca-errors`, including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your suggestion and find related suggestions. |
| 65 | + |
| 66 | +#### Before submitting an enhancement suggestion |
| 67 | + |
| 68 | +- **Check the [FAQs](https://github.com/pcah/pca-errors/blob/master/docs/FAQ.md)** for a list of common questions and problems. |
| 69 | +- **Check that your idea of the enhancement does not already exist in the [issue tracker](https://github.com/pcah/pca-errors/issues)**. |
| 70 | +- **Check that your idea is consistent with [the Principles](https://github.com/pcah/pca-errors/blob/master/docs/PRINCIPLES.md)** of the `pca-errors`. |
| 71 | + |
| 72 | +#### How do I submit an Enhancement suggestion? |
| 73 | + |
| 74 | +Enhancement suggestions are tracked on the [issue tracker](https://github.com/pcah/pca-errors/issues) where you can create a new one and provide the following information: |
| 75 | + |
| 76 | +- **Use a clear and descriptive title** for the issue to identify the suggestion. |
| 77 | +- **Provide a step-by-step description of the suggested enhancement** in as many details as possible. |
| 78 | +- **Provide specific examples to demonstrate the steps**. |
| 79 | +- **Describe the current behavior** and **explain which behavior you expected to see instead** and why. |
| 80 | + |
| 81 | +### Contributing to the code |
| 82 | + |
| 83 | +#### Local development |
| 84 | + |
| 85 | +You will need Poetry to start contributing on the `pca-errors` codebase. |
| 86 | + |
| 87 | +You will first need to ensure you have `git`, `python` & `poetry` installed. Then, clone the repository using `git` and place yourself in its directory: |
| 88 | + |
| 89 | +```bash |
| 90 | +$ git clone git@github.com:pcah/pca-errors.git |
| 91 | +$ cd pca-errors |
| 92 | +``` |
| 93 | + |
| 94 | +Now, you will need to install the required dependency for `pca-errors` and be sure that the current tests are passing on the dev environment: |
| 95 | + |
| 96 | +```bash |
| 97 | +$ poetry install |
| 98 | +``` |
| 99 | + |
| 100 | +To use a specific development environment, make sure you provide one by yourself. Supported environments include Pythons: 3.9, 3.8 and Pypy3 (for detailes, check [pyproject.toml](pyproject.toml)). |
| 101 | + |
| 102 | +#### Local testing |
| 103 | + |
| 104 | +- To run tests for all supported environments, run: |
| 105 | + |
| 106 | + ```bash |
| 107 | + $ poetry run tox |
| 108 | + ``` |
| 109 | + |
| 110 | +- To check a specific supported Python version, specify it after `-e` option: |
| 111 | + |
| 112 | + ```bash |
| 113 | + $ poetry run tox -e ENVIRONMENT |
| 114 | + ``` |
| 115 | + |
| 116 | + where `ENVIRONMENT` becomes one of `py39|py38|py37|pypy3` (for detailes, check [tox.ini](tox.ini))). |
| 117 | + |
| 118 | +- To check code styling rules, run linting container: |
| 119 | + |
| 120 | + ```bash |
| 121 | + $ poetry run pre-commit run -a |
| 122 | + ``` |
| 123 | + |
| 124 | + `pca-errors` uses the [black](https://github.com/psf/black) coding formatter and you must ensure that your code follows it. If not, the CI will fail and your Pull Request will not be merged. |
| 125 | + |
| 126 | + Similarly, the import statements are sorted with [isort](https://github.com/timothycrosley/isort) and special care must be taken to respect it. If you don't, the CI will fail as well. |
| 127 | +
|
| 128 | + Python code style is guarded with [flake8](https://flake8.pycqa.org/). Documentation style is guarded with [markdownlint](https://github.com/markdownlint/markdownlint). Both of them will fail your build, if you don't follow their rules. |
| 129 | + |
| 130 | + To make sure that you don't accidentally commit code that does not follow the coding style, you can install a pre-commit hook that will check that everything is in order: |
| 131 | +
|
| 132 | + ```bash |
| 133 | + $ poetry run pre-commit install --install-hooks |
| 134 | + ``` |
| 135 | +
|
| 136 | + You can also run it anytime using: |
| 137 | +
|
| 138 | + ```bash |
| 139 | + $ poetry run pre-commit run --all-files |
| 140 | + ``` |
| 141 | +
|
| 142 | +- Your code must always be accompanied by corresponding tests, if tests are not present your code will not be merged. |
| 143 | +
|
| 144 | +#### Pull requests |
| 145 | +
|
| 146 | +- Fill in [the pull request template](https://github.com/pcah/pca-errors/blob/master/docs/issue-templates/pull-request.md). |
| 147 | +- Be sure your commit messages repects [the commit message template](https://github.com/pcah/pca-errors/blob/master/docs/issue-templates/commit-message.md). |
| 148 | +- Be sure that your pull request contains tests that cover the changed or added code. |
| 149 | +- If your changes warrant a documentation change, the pull request must also update the documentation. |
0 commit comments