Skip to content

Latest commit

 

History

History
167 lines (110 loc) · 2.66 KB

DEVELOPMENT.md

File metadata and controls

167 lines (110 loc) · 2.66 KB

Development

Run main script that publish and subscribes to MQTT

poetry run pub-sub

Install pyenv

brew update
brew install pyenv

Install poetry

brew update
brew install pipx
pipx install poetry

Upgrade poetry

pipx upgrade poetry

or

poetry self update

Upgrade poetry dependencies

Get the latest versions of the dependencies and to update the poetry.lock file

poetry update

Start shell

poetry shell

Install all dependencies (main and dev)

poetry install

Install main dependencies only

poetry install --only main

Install git hooks scripts

pre-commit install

Run the hooks against all files

pre-commit run --all-files

Add main package

poetry add <package>

Add dev package

poetry add <package> --group dev

Check and update outdated dependencies

poetry show --outdated
poetry add <outdated package>@latest

Auto generated documentation

To update documentation of the user settings as JSON schema settings.json and markdown settings.md

poetry run generate_docs

Testing

Run tests in command line

pytest is used as test framework.

poetry run pytest

Create test coverage

pytest-cov is used to produce test coverage reports.

poetry run coverage run -m pytest -vv && poetry run coverage report

Run tests in IntelliJ

In order to run tests easily in IntelliJ you should install the plugin pytest imp.

You should also configure the path to the pyproject.toml in the pytest plugin at Settings > Tools > Python Integrated Tools > py.test

Code style

Black code style is used as code style.

You can do a style check, without fixing the issues:

poetry run black src tests --check --diff

or fix the issues automatically:

poetry run black src tests

Static code analysis

Pylint is used for static code analysis.

poetry run pylint src

Import ordering

isort is used to verify import ordering.

You can do a check, without fixing the issues:

poetry run isort src tests --check --diff

or fix the issues automatically:

poetry run isort src tests