|
|
|
# Contributing to ClusterView
|
|
|
|
|
|
|
|
## PR Requirements
|
|
|
|
|
|
|
|
Before a PR is accepted it must pass the following requirements in CircleCI:
|
|
|
|
|
|
|
|
- [ ] All tests must pass
|
|
|
|
- [ ] The code must be lint free as determined by `flake8`
|
|
|
|
|
|
|
|
Additionally, any new code included in the PR must be tested fully.
|
|
|
|
|
|
|
|
## Developer Requirements
|
|
|
|
|
|
|
|
You will want to make sure that all developer requirements are installed. To
|
|
|
|
do this after creating a new `virtualenv` environment:
|
|
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
pip3 install -r requirements-dev.txt
|
|
|
|
```
|
|
|
|
|
|
|
|
This will install all normal requirements as well as testing requirements.
|
|
|
|
|
|
|
|
## Linting
|
|
|
|
|
|
|
|
We use `flake8` for linting.
|
|
|
|
|
|
|
|
Run `python -m flake8` in order to get a lint report.
|
|
|
|
|
|
|
|
## Running Tests
|
|
|
|
|
|
|
|
We use `pytest` as our testing framework.
|
|
|
|
|
|
|
|
To run tests with test coverage use `pytest --cov=clusterview tests/`.
|
|
|
|
|
|
|
|
## Updating the UI Design File
|
|
|
|
|
|
|
|
In order to load the UI and be able to interact with the various parts you will
|
|
|
|
need to convert the UI file to a python file. To do so:
|
|
|
|
|
|
|
|
```sh
|
|
|
|
pyuic5 <ui_file>.ui -o <python_file>.py
|
|
|
|
```
|
|
|
|
|
|
|
|
For example, to be able to use changes you've made to the main UI file:
|
|
|
|
|
|
|
|
```
|
|
|
|
pyuic5 clusterview.ui clusterview_ui.py
|
|
|
|
```
|
|
|
|
|
|
|
|
## Style
|
|
|
|
|
|
|
|
### Import Organization
|
|
|
|
|
|
|
|
Import organization is a critical part of good software engineering. In large
|
|
|
|
projects considerable time can be wasted looking for a specific import.
|
|
|
|
The imports must be organized as follows:
|
|
|
|
|
|
|
|
```python
|
|
|
|
|
|
|
|
# System imports first
|
|
|
|
|
|
|
|
# Third party imports second
|
|
|
|
|
|
|
|
# UNLV/ClusterView modules external to the current module third
|
|
|
|
|
|
|
|
# Modules local to the current module last
|
|
|
|
```
|
|
|
|
|
|
|
|
Additionally, each imported module will be alphabetized by the module name
|
|
|
|
inside of the `import X` (X being the module name) or the `from X import Y`
|
|
|
|
(X being the module name).
|
|
|
|
|
|
|
|
If you are importing more than one thing from a module, alphabetize those as well
|
|
|
|
|
|
|
|
`from x import foo, bar, baz`
|
|
|
|
|
|
|
|
should be
|
|
|
|
|
|
|
|
`from x import bar, baz, foo`.
|