Skip to content

Commit 5cb63e6

Browse files
authored
Document code standards (#552)
1 parent 31ed298 commit 5cb63e6

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

docs/contributing.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,36 @@ If you run into issues with the development environment, here are some recommend
5757
- Manually find and clean the cache dir listed in `pixi info` and then retry the development workflow.
5858
- Ask for help in the [VirtualiZarr channel of the Earthmover community slack](https://earthmover-community.slack.com/archives/C08EXCE8ZQX).
5959

60+
### Code standards
6061

62+
#### Pre-commit
63+
64+
All code must conform to the PEP8 standard. `VirtualiZarr` uses a set of `pre-commit` hooks and the `pre-commit` bot to format, type-check, and prettify the codebase. `pre-commit` can be installed locally by running:
65+
66+
```
67+
python -m pip install pre-commit
68+
```
69+
The hooks can be installed locally by running:
70+
71+
```
72+
pre-commit install
73+
```
74+
75+
This would run the checks every time a commit is created locally. These checks will also run on every commit pushed to an open PR, resulting in some automatic styling fixes by the `pre-commit` bot. The checks will by default only run on the files modified by a commit, but the checks can be triggered for all the files by running:
76+
77+
```
78+
pre-commit run --all-files
79+
```
80+
81+
If you would like to skip the failing checks and push the code for further discussion, use the `--no-verify` option with `git commit`.
82+
83+
#### Private functions
84+
85+
`VirtualiZarr` uses the following convention for private functions:
86+
87+
- Functions are preceded with an `_` (single underscore) if they should only be used within that module and may change at any time
88+
- Functions without a preceding `_` (single underscore) are treated as relatively stable by the rest of the codebase, but not for public use (i.e. they are stable developer API).
89+
- Public functions are documented in the fully public API and should follow the backwards-compatibility expectations of Effective Effort Versioning.
6190

6291
## Contributing documentation
6392

0 commit comments

Comments
 (0)