1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
|
# How to contribute
Do you have questions or issues? Join our chat!
[](https://t.me/drypython)
## Tutorials
If you want to start working on this project,
you will need to get familiar with these concepts:
- http://learnyouahaskell.com/functors-applicative-functors-and-monoids
- https://github.com/dbrattli/OSlash/wiki/Functors,-Applicatives,-And-Monads-In-Pictures
- https://gcanti.github.io/fp-ts/ and https://dev.to/gcanti
Here are some practical examples of what we are doing here:
- https://medium.com/@rnesytov/using-Result-monad-in-python-b6eac698dff5
- https://www.morozov.is/2018/09/08/monad-laws-in-ruby.html
- https://beepb00p.xyz/mypy-error-handling.html
## Dependencies
We use [`poetry`](https://github.com/python-poetry/poetry) to manage the dependencies.
To install them you would need to run the `install` command:
```bash
poetry install
```
To install extra dependencies for working on the `hypothesis` or `mypy` plugin:
```bash
poetry install --extras check-laws
poetry install --extras compatible-mypy
```
To activate your `virtualenv` run `eval $(poetry env activate)`.
## Tests
We use `pytest` and `flake8` for quality control.
We also use `wemake_python_styleguide` to enforce code quality.
To run standard tests:
```bash
poetry run pytest returns docs/pages tests
```
**NOTE:** type-safety tests not included, see section on type tests below
To run linting:
```bash
poetry run flake8 .
```
Keep in mind: default virtual environment folder excluded by flake8 style checking is `.venv`.
If you want to customize this parameter, you should do this in `setup.cfg`.
These steps are mandatory during CI.
### Type tests
We also use `pytest-mypy-plugins`. Tests cases are located inside `./typesafety`
If you create new types or typed functions, it is required to test their types.
The type-safety tests can be run with the following:
```bash
poetry run pytest typesafety
```
**NOTE:** This can take upwards of 20 minutes, only recommended to run if necessary.
Here's [a helpful tutorial](https://sobolevn.me/2019/08/testing-mypy-types) if you are looking
for more information.
## Type checks
We use `mypy` to run type checks on our code.
To use it:
```bash
poetry run mypy returns tests/**/*.py
```
This step is mandatory during CI.
## Submitting your code
We use [trunk based](https://trunkbaseddevelopment.com/)
development (we also sometimes call it `wemake-git-flow`).
What the point of this method?
1. We use protected `master` branch,
so the only way to push your code is via pull request
2. We use issue branches: to implement a new feature or to fix a bug
create a new branch named `issue-$TASKNUMBER`
3. Then create a pull request to `master` branch
4. We use `git tag`s to make releases, so we can track what has changed
since the latest release
So, this way we achieve an easy and scalable development process
which frees us from merging hell and long-living branches.
In this method, the latest version of the app is always in the `master` branch.
### Before submitting
Before submitting your code please do the following steps:
1. Run `pytest` to make sure everything was working before
2. Add any changes you want
3. Add tests for the new changes
4. Edit documentation if you have changed something significant
5. Update `CHANGELOG.md` with a quick summary of your changes
6. Run `pytest` again to make sure it is still working
7. Run `mypy` to ensure that types are correct
8. Run `flake8` to ensure that style is correct
9. Run `slotscheck` to ensure that slots are correct
## Other help
You can contribute by spreading a word about this library.
It would also be a huge contribution to write
a short article on how you are using this project.
You can also share your best practices with us.
Join in the conversation with us on our Telegram.
[](https://t.me/drypython)
|