Debian Codegraph @

docs/guide/development.md

raw
1 # Development
2
3 ::: tip NOTE
4 The following is only necessary if you want to contribute features
5 to EagerPy. As a user of EagerPy, you can just do a normal
6 [installation](./getting-started).
7 :::
8
9 ## Installation
10
11 First clone the repsository using `git`:
12
13 ```bash
14 git clone https://github.com/jonasrauber/eagerpy
15 ```
16
17 You can then do an editable installation using `pip -e`:
18
19 ```bash
20 cd eagerpy
21 pip3 install -e .
22 ```
23
24 ::: tip
25 Create a new branch for each new feature or contribution.
26 This will be necessary to open a pull request later.
27 :::
28
29 ## Coding Style
30
31 We follow the [PEP 8 Style Guide for Python Code](https://www.python.org/dev/peps/pep-0008/).
32 We use [black](https://github.com/psf/black) for automatic code formatting.
33 In addition, we use [flake8](https://flake8.pycqa.org/en/latest/) to detect
34 certain PEP 8 violations.
35
36 ::: tip
37 Have a look at the `Makefile`. It contains many useful commands, e.g. `make black` or `make flake8`.
38 :::
39
40 ## Type annotions and MyPy
41
42 EagerPy uses Python type annotations introduced in [PEP 484](https://www.python.org/dev/peps/pep-0484/).
43 We use [mypy](http://mypy-lang.org) for static type checking with relatively
44 strict settings. All code in EagerPy has to be type annotated.
45
46 We recommend to run MyPy or a comparable type checker automatically in your
47 editor (e.g. VIM) or IDE (e.g. PyCharm). You can also run MyPy from the
48 command line:
49
50 ```bash
51 make mypy # run this in the root folder that contains the Makefile
52 ```
53
54 ::: tip NOTE
55 `__init__` methods should not have return type annotations unless
56 they have no type annotated arguments (i.e. only `self`), in which case
57 the return type of `__init__` should be specifed as `None`.
58 :::
59
60 ## Creating a pull request on GitHub
61
62 First, fork the [EagerPy repository on GitHub](https://github.com/jonasrauber/eagerpy).
63 Then, add the fork to your local GitHub repository:
64
65 ```bash
66 git remote add fork https://github.com/YOUR USERNAME/eagerpy
67 ```
68
69 Finally, push your new branch to GitHub and open a pull request.
70
71 ## Release Process
72
73 EagerPy currently follows a rapid release process. Whenever non-trivial
74 changes have been made, the documentation and tests have been updated,
75 and all tests pass, a new version can be released. To reduce the barrier,
76 this is simply done by creating a new release on GitHub. This automatically
77 triggers a [GitHub Action](https://github.com/jonasrauber/eagerpy/actions)
78 that builds the package and publishes the new version on the Python Package
79 Index [PyPI](https://pypi.org/project/eagerpy/). The latest version can
80 thus be simply installed using `pip`: