File: developer.md

package info (click to toggle)
pykoplenti 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 372 kB
  • sloc: python: 2,215; makefile: 3
file content (50 lines) | stat: -rw-r--r-- 1,689 bytes parent folder | download
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
# Developer Notes

## Code Format

```shell script
isort pykoplenti
black --fast pykoplenti
```

## Initialize developer environment with pipenv

```shell script
pipenv sync --dev
```

## Run pytest using tox

`tox` is configured to run pytest with different versions of pydantic.

Run all environemnts:

```shell script
tox
```

Available environments:

* `py39-pydantic1` - Python 3.9 with Pydantic 1.x
* `py39-pydantic2` - Python 3.9 with Pydantic 2.x
* `py310-pydantic1` - Python 3.10 with Pydantic 1.x
* `py310-pydantic2` - Python 3.10 with Pydantic 2.x
* `py311-pydantic1` - Python 3.11 with Pydantic 1.x
* `py311-pydantic2` - Python 3.11 with Pydantic 2.x
* `py312-pydantic1` - Python 3.12 with Pydantic 1.x
* `py312-pydantic2` - Python 3.12 with Pydantic 2.x

If `tox` should use `pyenv`, the package `tox-pyenv-redux` must be installed manually.
It cannot be installed in pipenv dev, because it is incompatible with github actions.

## Running smoke tests

The test suite contains some smoke tests that connect directly to an inverter and attempt to retrieve data from it.
These tests are normally disabled but can be enabled by setting some environment variables before running `pytest`.
It is recommended to set these variables in `.env` where `pipenv` reads them before executing a command.

| Variable         | Description                                           |
| ---------------- | ----------------------------------------------------- |
| SMOKETEST_HOST   | The ip or host of the inverter.                       |
| SMOKETEST_PORT   | The port of the web API of the inverter (default: 80) |
| SMOKETEST_PASS   | The password of the web UI                            |