Skip to content

Commit f94096b

Browse files
Edit README.md documentation to add chapter on pre-commit.
1 parent 4f0f5ef commit f94096b

File tree

2 files changed

+36
-9
lines changed

2 files changed

+36
-9
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ PR fixes the following issue:
2424
- [ ] I've made corresponding changes to the documentation;
2525
- [ ] I've made sure my changes generate no warnings;
2626
- [ ] mypy returns no errors when run on the root package;
27-
<!-- If you use pre-commit hooks you can always check the following tasks -->
27+
<!-- If you use pre-commit hooks you can always check off the following tasks -->
2828
- [ ] I've run black to format my code;
2929
- [ ] I've run isort to format my code's import statements;
3030
- [ ] flake8 reports no errors when run on the entire code base;

README.md

+35-8
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,9 @@ Contributors must uphold the [Contributor Covenant code of conduct](https://gith
312312
1. [Installation and setup](#installation-and-setup)
313313
* [Cloning the repository](#cloning-the-repository)
314314
* [Installing the dependencies](#installing-the-dependencies)
315+
* [Set up the pre-commit hooks (optional)](#set-up-the-pre-commit-hooks-optional)
315316
2. [Before opening a PR](#before-opening-a-pr)
317+
* [Tip](#tip)
316318
3. [License](#license)
317319

318320
## Installation and setup
@@ -333,23 +335,48 @@ git clone --branch v3-beta --single-branch https://github.com/bitfinexcom/bitfin
333335
python3 -m pip install -r dev-requirements.txt
334336
```
335337

336-
Make sure to install `dev-requirements.txt` instead of `requirements.txt`. \
337-
`dev-requirements.txt` will install all dependencies in `requirements.txt` plus any development dependencies. \
338-
This will also install the versions in use of [`pylint`](https://github.com/pylint-dev/pylint) and [`mypy`](https://github.com/python/mypy), which you should both use before opening your PRs.
338+
Make sure to install `dev-requirements.txt` (and not `requirements.txt`!). \
339+
`dev-requirements.txt` will install all dependencies in `requirements.txt` plus any development dependency. \
340+
dev-requirements includes [mypy](https://github.com/python/mypy), [black](https://github.com/psf/black), [isort](https://github.com/PyCQA/isort), [flake8](https://github.com/PyCQA/flake8), and [pre-commit](https://github.com/pre-commit/pre-commit) (more on these tools in later chapters).
339341

340342
All done, your Python 3.8+ environment should now be able to run `bitfinex-api-py`'s source code.
341343

344+
### Set up the pre-commit hooks (optional)
345+
346+
**Do not skip this paragraph if you intend to contribute to the project.**
347+
348+
This repository includes a pre-commit configuration file that defines the following hooks:
349+
1. [isort](https://github.com/PyCQA/isort)
350+
2. [black](https://github.com/psf/black)
351+
3. [flake8](https://github.com/PyCQA/flake8)
352+
353+
To set up pre-commit use:
354+
```console
355+
python3 -m pre-commit install
356+
```
357+
358+
These will ensure that isort, black and flake8 are run on each git commit.
359+
360+
[Visit this page to learn more about git hooks and pre-commit.](https://pre-commit.com/#introduction)
361+
362+
#### Manually triggering the pre-commit hooks
363+
364+
You can also manually trigger the execution of all hooks with:
365+
```console
366+
python3 -m pre-commit run --all-files
367+
```
368+
342369
## Before opening a PR
343370

344-
**We won't accept your PR or we will request changes if the following requirements aren't met.**
371+
**We won't accept your PR or we'll request changes if the following requirements aren't met.**
345372

346373
Wheter you're submitting a bug fix, a new feature or a documentation change, you should first discuss it in an issue.
347374

348-
All PRs must follow this [PULL_REQUEST_TEMPLATE](https://github.com/bitfinexcom/bitfinex-api-py/blob/v3-beta/.github/PULL_REQUEST_TEMPLATE.md) and include an exhaustive description.
375+
You must be able to check off all tasks listed in [PULL_REQUEST_TEMPLATE](https://raw.githubusercontent.com/bitfinexcom/bitfinex-api-py/master/.github/PULL_REQUEST_TEMPLATE.md) before opening a pull request.
376+
377+
### Tip
349378

350-
Before opening a pull request, you should also make sure that:
351-
- [ ] [`pylint`](https://github.com/pylint-dev/pylint) returns a score of 10.00/10.00 when run against your code.
352-
- [ ] [`mypy`](https://github.com/python/mypy) doesn't throw any error code when run on the project (excluding notes).
379+
Setting up the project's pre-commit hooks will help automate this process ([more](#set-up-the-pre-commit-hooks-optional)).
353380

354381
## License
355382

0 commit comments

Comments
 (0)