@@ -18,44 +18,39 @@ pip install -e .[dev]
18
18
19
19
#### Code Style
20
20
21
- BoTorch uses the [ black] ( https://github.com/ambv/black ) code formatter to
22
- enforce a common code style across the code base. black is installed easily via
23
- pip using ` pip install black ` , and run locally by calling
21
+ BoTorch uses [ ufmt] ( https://github.com/omnilib/ufmt ) to enforce consistent
22
+ code formatting (based on [ black] ( https://github.com/ambv/black ) ) and
23
+ import sorting (based on [ µsort] ( https://github.com/facebook/usort ) )
24
+ across the code base. Install via ` pip install ufmt ` , and
25
+ auto-format and auto-sort by running
24
26
``` bash
25
- black .
26
- ```
27
- from the repository root. No additional configuration should be needed (see the
28
- [ black documentation] ( https://black.readthedocs.io/en/stable/installation_and_usage.html#usage )
29
- for advanced usage).
30
-
31
- Docstring formatting: We recommend [ Google-style] ( https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html ) docstrings.
32
- To make sure documentation is rendered correctly, we require that every ` __init__ `
33
- function contains an "Args" block.
34
- We use ` flake8-docstrings ` to check this, as well as ` flake8 ` to check code style. To use these tools, run
35
- ` pip install flake8 ` and ` pip install flake8-docstrings ` , and then run
36
- ``` bash
37
- flake8 .
27
+ ufmt format .
38
28
```
29
+ from the repository root.
39
30
40
31
41
- #### Import Sorting
32
+ #### Flake8 linting
42
33
43
- BoTorch uses [ ufmt] https://github.com/omnilib/ufmt library for consistent
44
- sorting of imports across the codebase. Install via ` pip install ufmt ` , and
45
- auto-sort with
34
+ BoTorch uses ` flake8 ` for linting. To run the linter locally, install
35
+ ` flake8 ` via ` pip install flake8 ` , and then run
46
36
``` bash
47
- ufmt format .
37
+ flake8 .
48
38
```
49
39
from the repository root.
50
40
51
- We feel strongly that having a consistent code style and imports is important,
52
- so CI will fail on your PR if it does not pass ufmt muster (note: under the
53
- hood ufmt also checks black code style).
41
+
42
+ #### Docstring formatting
43
+
44
+ BoTorch uses [ Google-style] ( https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html ) docstrings.
45
+ To make sure documentation is rendered correctly, we require that every
46
+ ` __init__ ` function contains an ` Args: ` block. We use the ` flake8-docstrings `
47
+ plugin to check this - install via ` pip install flake8-docstrings ` and
48
+ run ` flake8 ` as above to check.
54
49
55
50
56
51
#### Type Hints
57
52
58
- BoTorch is fully typed using python 3.7 +
53
+ BoTorch is fully typed using python 3.8 +
59
54
[ type hints] ( https://www.python.org/dev/peps/pep-0484/ ) .
60
55
We expect any contributions to also use proper type annotations. While we
61
56
currently do not enforce full consistency of these in our continuous integration
@@ -112,7 +107,7 @@ We actively welcome your pull requests.
112
107
3 . If you have changed APIs, update the documentation. Make sure the
113
108
documentation builds.
114
109
4 . Ensure the test suite passes.
115
- 5 . Make sure your code passes both ` black ` and ` flake8 ` formatting checks.
110
+ 5 . Make sure your code passes both ` ufmt ` and ` flake8 ` formatting checks.
116
111
6 . If you haven't already, complete the Contributor License Agreement ("CLA").
117
112
118
113
0 commit comments