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
|
# Setting up the API package
## General requirements
to develop on the API package, the following tools are needed:
1. Python >= 3.11
2. python modules (no need to install these manually):
- websockets
- pyzt
- pylint
- pytest
- pytest-mock
- pytest-cov
- pytest-asyncio
- coverage
## Make commands
```{note}
Make commands can be used on Windows with GnuWin or just running the commands defined in the make file.
```
### installing
1. `git clone https://github.com/bluecurrent/HomeAssistantAPI.git`
2. `python -m venv venv`
3. `make install`
### testing
- `make test`
- `make test-cov`
### lint, format, typechecking
- `make lint`
- `make ruff`
- `make black`
- `make mypy`
### publishing
1. `make build`
2. `make publish` (credentials stored in password manager)
### build documentation
- `make install-docs`
- `make html`
### Using an updated API package (without publishing it).
1. `make build`
2. `pip install bluecurrent-api-<VERSION>-py3-none-any.whl`
### Using newer build of the API package in a HA dev container (without publishing it).
1. move the .whl file to the container with `docker cp dist/bluecurrent-api-<VERSION>-py3-none-any.whl`
2. install the package inside the container
3. remove the .whl file.
### Publish checklist
1. Run tests, lint, format and type checker.
2. Increment version in pyproject.toml.
3. make build
4. For large changes install new package in Ha container and run integration tests and start ha and test manually.
5. Push to git
6. Wait until checks are successful.
7. make publish
|