42 lines
1.2 KiB
Markdown
42 lines
1.2 KiB
Markdown
## Development Environment FAQ
|
||
|
||
### How to maintain `requirements.txt`?
|
||
|
||
The canonical list of installation requirements (including development requirements) is maintained in the [`setup.py`](setup.py) file.
|
||
|
||
The Requirements File ([`requirements.txt`](requirements.txt)) file must be kept in sync with that list.
|
||
|
||
To to automatically generate or update `requirements.txt` based on `setup.py`, run [`pip-tools`](https://github.com/jazzband/pip-tools)’s `pip-compile`:
|
||
|
||
```sh
|
||
python -m piptools compile --output-file=requirements.txt
|
||
```
|
||
|
||
**Warning:** Due to [limitations](https://github.com/jazzband/pip-tools/issues/908) in `pip-tools`, the same workflow can not be used for generating a `dev-requirements.txt` file, and requirements can not be declared in a `setup.cfg` file.
|
||
|
||
### How to install modules required for development?
|
||
|
||
```sh
|
||
python -m pip install -e ".[dev]"
|
||
```
|
||
|
||
### How to run a code formatter?
|
||
|
||
Run [Black](https://black.readthedocs.io/):
|
||
|
||
```sh
|
||
# Dry-run, showing what should be rewritten:
|
||
python -m black --target-version=py36 --diff .
|
||
|
||
# Run code format:
|
||
python -m black --target-version=py36 .
|
||
```
|
||
|
||
### How to run a linter?
|
||
|
||
Run [Flake8](https://flake8.pycqa.org/):
|
||
|
||
```sh
|
||
python -m flake8
|
||
```
|