2020-06-20 18:43:10 +00:00
|
|
|
# Contributing to Rich
|
|
|
|
|
2020-11-28 12:32:15 +00:00
|
|
|
This project welcomes contributions in the form of Pull Requests.
|
|
|
|
For clear bug-fixes / typos etc. just submit a PR.
|
|
|
|
For new features or if there is any doubt in how to fix a bug, you might want
|
|
|
|
to open an issue prior to starting work, or email willmcgugan+rich@gmail.com
|
|
|
|
to discuss it first.
|
2020-06-20 18:43:10 +00:00
|
|
|
|
|
|
|
## Development Environment
|
|
|
|
|
2020-11-30 08:43:53 +00:00
|
|
|
Rich uses [poetry](https://python-poetry.org/docs/) for packaging and
|
|
|
|
dependency management. To start developing with Rich, either install the
|
|
|
|
recommended way (using curl) as described in their
|
|
|
|
[docs](https://python-poetry.org/docs/#installation), or simply run:
|
|
|
|
|
|
|
|
```
|
|
|
|
pip install poetry
|
|
|
|
```
|
|
|
|
|
|
|
|
Once Poetry is installed, run
|
2020-06-20 18:43:10 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
poetry install
|
|
|
|
```
|
|
|
|
|
2020-11-30 08:43:53 +00:00
|
|
|
To install dependencies
|
|
|
|
|
2020-06-20 18:43:10 +00:00
|
|
|
### Tests
|
|
|
|
|
|
|
|
Run tests with the following command:
|
|
|
|
|
|
|
|
```
|
2020-06-21 11:26:08 +00:00
|
|
|
make test
|
2020-06-20 18:43:10 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
Or if you don't have make, run the following:
|
|
|
|
|
|
|
|
```
|
|
|
|
pytest --cov-report term-missing --cov=rich tests/ -vv
|
|
|
|
```
|
|
|
|
|
|
|
|
New code should ideally have tests and not break existing tests.
|
|
|
|
|
|
|
|
### Type Checking
|
|
|
|
|
2020-11-28 12:32:15 +00:00
|
|
|
Rich uses type annotations throughout, and `mypy` to do the checking.
|
|
|
|
Run the following to type check Rich:
|
2020-06-20 18:43:10 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
make typecheck
|
|
|
|
```
|
|
|
|
|
|
|
|
Or if you don't have `make`:
|
|
|
|
|
|
|
|
```
|
|
|
|
mypy -p rich --ignore-missing-imports --warn-unreachable
|
|
|
|
```
|
|
|
|
|
|
|
|
Please add type annotations for all new code.
|
|
|
|
|
|
|
|
### Code Formatting
|
|
|
|
|
2020-08-21 09:20:36 +00:00
|
|
|
Rich uses [`black`](https://github.com/psf/black) for code formatting.
|
|
|
|
I recommend setting up black in your editor to format on save.
|
|
|
|
|
|
|
|
To run black from the command line, use `make format-check` to check your formatting,
|
|
|
|
and use `make format` to format and write to the files.
|