You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update: Contributing guide with respect to #1358 (#1389)
* Update: Contributing guide with respect to #1358
* Fix: Add line on manually running pre-commit
* Add: Line for `isort` in contributing guide
* Fix: uncomment `make examples` in overview
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+52-27
Original file line number
Diff line number
Diff line change
@@ -87,7 +87,11 @@ Following that we'll tell you about how you can test your changes locally and th
87
87
Fortunately, you can check out [pyenv](https://github.com/pyenv/pyenv) which lets you switch between Python versions on the fly!
88
88
89
89
* Now that we have a virtual environment, it's time to install all the dependencies into it.
90
+
We've provided a simple `make` command to help do this.
90
91
```bash
92
+
make install-dev
93
+
94
+
# Manually
91
95
pip install -e .[test,examples,doc]
92
96
93
97
# If you're using shells other than bash you'll need to use
@@ -101,6 +105,8 @@ Following that we'll tell you about how you can test your changes locally and th
101
105
You can check out what these are in the `setup.py` file.
102
106
* If you're new to virtual environments, after performing all this, it's a great time to check out what actually exists in the `my-virtual-env` folder.
103
107
108
+
* You can check out some functionality we have captured in a `Makefile` by running `make help`
109
+
104
110
* Now it's time to make some changes, whether it be for [documentation](#documentation), a [bug fix](#bug-fixes) or a new [features](#features).
105
111
106
112
## Making Changes
@@ -234,23 +240,18 @@ Lastly, if the feature really is a game changer or you're very proud of it, cons
234
240
235
241
* Now we are going to use [sphinx](https://www.sphinx-doc.org/en/master/) to generate all the documentation and make sure there are no issues.
236
242
```bash
237
-
cd doc
238
-
make html
243
+
make doc
239
244
```
240
245
* If you're unfamiliar with sphinx, it's a documentation generator which can read comments and docstrings from within the code and generate html documentation.
241
-
* We also use sphinx-gallery which can take python files (such as those in the `examples` folder) and run them, creating html which shows the code and the output it generates.
242
-
Unfortunately this can take quite some time but you should only have to run this once.
243
-
* If you need to quickly check something, you can run `make html-noexamples` to prevent sphinx from running the examples.
244
-
```bash
245
-
cd doc
246
-
make html-noexamples
247
-
```
248
-
* Sphinx also has a command `linkcheck` for making sure all the links correctly go to some destination.
246
+
* If you've added documentation, we also has a command`linkcheck`for making sure all the links correctly go to some destination.
249
247
This helps tests for dead links or accidental typos.
250
248
```bash
251
-
cd doc
252
249
make linkcheck
253
250
```
251
+
* We also use sphinx-gallery which can take python files (such as those in the `examples` folder) and run them, creating html which shows the code and the output it generates.
252
+
```bash
253
+
make examples
254
+
```
254
255
* To view the documentation itself, make sure it is built with the above commands and then open `doc/build/html/index.html` with your favourite browser:
255
256
```bash
256
257
# Firefox
@@ -261,19 +262,33 @@ Lastly, if the feature really is a game changer or you're very proud of it, cons
261
262
```
262
263
263
264
* Once you've made all your changes and all the tests pass successfully, we need to make sure that the code fits a certain format and that the [typing](https://docs.python.org/3/library/typing.html) is correct.
264
-
To do this, we use a tool call `pre-commit` which runs `flake8`, a code checker and `mypy`, a static type checker against the code.
265
+
* Formatting and import sorting can helps keep things uniform across all coding styles. We use `black` and `isort` to do this for us. To automatically run these formatters across the code base, just run the following command:
265
266
```bash
266
-
pip install pre-commit
267
-
pre-commit run --all-files
267
+
make format
268
268
```
269
-
* The reason we use a code standard like `flake8` is to make sure that when we review code:
270
-
* There are no extra blank spaces and blank lines.
271
-
* Lines don't end up too long
272
-
* Code from multiple source keeps a similar appearance.
273
-
* We perform static type checking with `mypy` as this can remove a majority of bugs, before a test is even run.
274
-
It points out programmer errors and is what makes compiled languages so safe.
269
+
* To then check for other issues with `mypy`, `flake8` and `pydocstyle`, run
270
+
```bash
271
+
make check
272
+
```
273
+
* To do this checking automatically, we use `pre-commit` which if you already installed everything with `make install-dev` then this has been done for you.
274
+
This will happen every time you make a commit and warn you of any issues.
275
+
Otherwise you can run the following to install pre-commit.
276
+
```bash
277
+
pre-commit install
278
+
```
279
+
* To run `pre-commit` manually:
280
+
```bash
281
+
pre-commit run --al-files
282
+
```
283
+
* The reason we use tools like `flake8`, `mypy`, `black`, `isort` and `pydocstyle` is to make sure that when we review code:
284
+
* There are no extra blank spaces and blank lines. (`flake8`, `black`)
285
+
* Lines don't end up too long. (`flake8`, `black`)
286
+
* Code from multiple source keeps a similar appearance. (`black`)
287
+
* Importing things is consistently ordered. (`isort`)
288
+
* Functions are type annotated and correct with static type checking. (`mypy`)
289
+
* Function and classes have docstrings. (`pydocstyle`)
275
290
If you are new to Python types, or stuck with how something should be 'typed', please feel free to push the pull request in the following steps and we should be able to help you out.
276
-
* If interested, the configuration for `pre-commit` can be found in `.pre-commit-config.yaml`
291
+
* If interested, the configuration for`pre-commit` can be foundin`.pre-commit-config.yaml` with the other tools mainly being configured in`pyproject.toml` and `.flake8`.
277
292
278
293
279
294
## Creating the PR
@@ -341,6 +356,7 @@ Lastly, if the feature really is a game changer or you're very proud of it, cons
341
356
342
357
# Pull Request Overview
343
358
* Create a [fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) of the [automl/auto-sklearn](https://github.com/automl/auto-sklearn) git repo
359
+
* Check out what's available by running `make help`.
344
360
* Clone your own fork and create a new branch from the branch to work on
0 commit comments