Debian Codegraph @

docs/develop/contributing.md

raw
1 # Contributing
2
3 [![Github-CI][github-ci]][github-link]
4 [![Coverage Status][codecov-badge]][codecov-link]
5 [![Documentation Status][rtd-badge]][rtd-link]
6 [![Code style: black][black-badge]][black-link]
7 [![PyPI][pypi-badge]][pypi-link]
8
9 ## Installation
10
11 For package development:
12
13 ```bash
14 git clone https://github.com/executablebooks/jupyter-cache
15 cd jupyter-cache
16 git checkout develop
17 pip install -e .[cli,code_style,testing,rtd]
18 ```
19
20 ## Code Style
21
22 Code style is tested using [flake8](http://flake8.pycqa.org),
23 with the configuration set in `.flake8`,
24 and code formatted with [black](https://github.com/ambv/black).
25
26 Installing with `jupyter-cache[code_style]` makes the [pre-commit](https://pre-commit.com/)
27 package available, which will ensure this style is met before commits are submitted, by reformatting the code
28 and testing for lint errors.
29 It can be setup by:
30
31 ```shell
32 >> cd jupyter-cache
33 >> pre-commit install
34 ```
35
36 Optionally you can run `black` and `flake8` separately:
37
38 ```shell
39 >> black .
40 >> flake8 .
41 ```
42
43 Editors like VS Code also have automatic code reformat utilities, which can adhere to this standard.
44
45 ## Testing
46
47 For code tests:
48
49 ```shell
50 >> cd jupyter-cache
51 >> pytest
52 ```
53
54 For documentation build tests:
55
56 ```shell
57 >> cd jupyter-cache/docs
58 >> make clean
59 >> make html-strict
60 ```
61
62 ## Pull Requests
63
64 To contribute, make Pull Requests to the `master` branch (this is the default branch). A PR can consist of one or multiple commits. Before you open a PR, make sure to clean up your commit history and create the commits that you think best divide up the total work as outlined above (use `git rebase` and `git commit --amend`). Ensure all commit messages clearly summarise the changes in the header and the problem that this commit is solving in the body.
65
66 Merging pull requests: There are three ways of 'merging' pull requests on GitHub:
67
68 - Squash and merge: take all commits, squash them into a single one and put it on top of the base branch.
69 Choose this for pull requests that address a single issue and are well represented by a single commit.
70 Make sure to clean the commit message (title & body)
71 - Rebase and merge: take all commits and 'recreate' them on top of the base branch. All commits will be recreated with new hashes.
72 Choose this for pull requests that require more than a single commit.
73 Examples: PRs that contain multiple commits with individually significant changes; PRs that have commits from different authors (squashing commits would remove attribution)
74 - Merge with merge commit: put all commits as they are on the base branch, with a merge commit on top
75 Choose for collaborative PRs with many commits. Here, the merge commit provides actual benefits.
76
77 [github-ci]: https://github.com/executablebooks/jupyter-cache/workflows/continuous-integration/badge.svg?branch=master
78 [github-link]: https://github.com/executablebooks/jupyter-cache
79 [codecov-badge]: https://codecov.io/gh/executablebooks/jupyter-cache/branch/master/graph/badge.svg
80 [codecov-link]: https://codecov.io/gh/executablebooks/jupyter-cache
81 [rtd-badge]: https://readthedocs.org/projects/jupyter-cache/badge/?version=latest
82 [rtd-link]: https://jupyter-cache.readthedocs.io/en/latest/?badge=latest
83 [black-badge]: https://img.shields.io/badge/code%20style-black-000000.svg
84 [pypi-badge]: https://img.shields.io/pypi/v/jupyter-cache.svg
85 [pypi-link]: https://pypi.org/project/jupyter-cache
86 [black-link]: https://github.com/ambv/black