Skip to content

Commit

Permalink
Updates along with v0.31 python-plugwise
Browse files Browse the repository at this point in the history
  • Loading branch information
CoMPaTech authored and bouwew committed Apr 18, 2023
1 parent 7ed137c commit de010c4
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 128 deletions.
14 changes: 0 additions & 14 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,6 @@ body:
attributes:
value: |
# Plugwise Information
- type: dropdown
validations:
required: true
attributes:
label: What kind of Plugwise device is having issues?
description: >
Select the best possible option (i.e. for issues with a Lisa or Tom, select Adam - for issues with a Circle, select Stretch or USB).
options:
- "Smile: Adam (including Lisa, Tom, Floor)"
- "Smile: Anna"
- "Smile: P1"
- "Smile: Stretch"
- "USB: Stick"
- "Other product (we might not (yet) know of it's existence!)"
- type: input
validations:
required: true
Expand Down
14 changes: 0 additions & 14 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,6 @@ body:
attributes:
value: |
# Plugwise Information
- type: dropdown
validations:
required: true
attributes:
label: What kind of Plugwise device is having issues?
description: >
Select the best possible option (i.e. for issues with a Lisa or Tom, select Adam - for issues with a Circle, select Stretch or USB).
options:
- "Smile: Adam (including Lisa, Tom, Floor)"
- "Smile: Anna"
- "Smile: P1"
- "Smile: Stretch"
- "USB: Stick"
- "Other product (we might not (yet) know of it's existence!)"
- type: input
validations:
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -399,4 +399,4 @@ jobs:
run: |
. venv/bin/activate
echo "Showing complexity higher or equal to 'C'"
radon cc plugwise/__init__.py plugwise/helper.py tests/test_stick.py -s -nc --no-assert
radon cc plugwise/ tests/ -s -nc --no-assert
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# Changelog

## Ongoing: Logic separation between USB and non-USB
## v0.31 refactoring (alpha only, effectively refactored version release): Logic separation between USB and non-USB

- Functionality split between Smile and USB
- USB component (suggested `python-plugwise-usb` for USB (or stick-standalone) route)

## v0.30 (initial alpha, effectively not released)

- Last version joined with Networking (e.g. Smile/Stretch) products (as `python-plugwise`).
- v0.31 will be forked as `python-plugwise-usb`

## v0.27.10: Anna + Elga: final fix for [#320](https://github.com/plugwise/plugwise-beta/issues/320)

Expand Down
3 changes: 0 additions & 3 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ requirements*.txt @plugwise/devs
/tests/ @bouwew @compatech
/scripts/ @bouwew @compatech

# NET specific
/plugwise/smile.py @bouwew @compatech

# USB specific
/plugwise/connections/ @brefra
/plugwise/controller.py @bouwew @brefra
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Module providing interfacing with the Plugwise devices:
The devices listed below have **NOT** been tested and are therefore unknown for their correct operation
- [x] Sense
- [x] Switch

- [x] [Home-Assistant](https://home-assistant.io) via
- [x] Native supporting networked Plugwise products
- [ ] Native supporting USB Plugwise products (in progress)
Expand All @@ -63,6 +64,7 @@ As per the origins we have retained the appropriate licensing and including the

Origins (from newest to oldest):

- USB module and integration is supported by @brefra (Frank), ssupported and helped by @bouwew (Bouwe) and @CoMPaTech (Tom) where possible.
- 'All' available Plugwise support by @bouwew (Bouwe), @brefra (Frank) and @CoMPaTech (Tom)
- Upstreamed haanna/HA-core Anna, including all later products - 'Plugwise-Smile/Plugwise-HA/plugwise-beta` by @bouwew (Bouwe) & @CoMPaTech (Tom)
- Networked Plugwise Anna module with custom_module - `haanna/anna-ha` via <https://github.com/laetificat> (Kevin)
Expand Down
2 changes: 1 addition & 1 deletion scripts/complexity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if [ -f "${my_venv}/bin/activate" ]; then
echo "-----------------------------"
echo "Running cyclomatic complexity"
echo "-----------------------------"
PYTHONPATH=$(pwd) radon cc plugwise/smile.py plugwise/helper.py tests/test_smile.py -s -nc --no-assert
PYTHONPATH=$(pwd) radon cc plugwise/ tests/ -s -nc --no-assert
else
echo "Virtualenv available, bailing out"
exit 2
Expand Down
61 changes: 1 addition & 60 deletions tests/INIT.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,6 @@
# Setup GitHub Repository and tooling

## Pre

Needed:

- [ ] Github account (or organisation and account(s))
- [ ] Codecov account (just choose 'login with github')
- [ ] CodeFactor account (again, login with github)
- [ ] Add codecov as an integration from Github's integrations (basically 'buy' it, except its at no cost)

## Configuration

After the initial setup of the repo/initial commit, walk the repo-settings on GitHub using your browser.

- [ ] [Set the product image, turn off wiki and automatically delete branches (from defaults)](https://github.com/plugwise/python-plugwise/settings)
- [ ] [Activate both dependabots and keep dependency graph open](https://github.com/plugwise/python-plugwise/settings/security_analysis)
- [ ] [Integrations, configure codecov (should show up from organisation)](https://github.com/plugwise/python-plugwise/settings/installations)

For this step you might need to follow [this publishing guide](https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/) taking you through most of the steps. Note that the projects on PyPi already [**need to exist**](https://packaging.python.org/tutorials/packaging-projects/) so use a generic token first and later adjust that to only this project (as explained on that howto):

- [ ] [Configure secrets for PYPI_TOKEN and TESTPYPI_TOKEN](https://github.com/plugwise/Plugwise-Smile/settings/secrets)

## Initializing pypi

Once the project is ready for upload to test (i.e. version number ending in `a0` or something likewise): upload it manually using `twine upload`:

Prepare:

- [ ] `python3 -m venv venv ; source venv/bin/activate ; pip install --upgrade pip; pip install -r requirements_test.txt ; pip install --upgrade setuptools wheel twine`

Package: (**ensure you are in your venv**)

- [ ] [pypi packaging](https://packaging.python.org/tutorials/packaging-projects/)
- [ ] `python3 setup.py sdist bdist_wheel`

Then reconfigure your tokens on the pypi website accordingly (only allowing project updates) and carry on.

**Note** once you complete this you can `pip uninstall setuptools wheel twine` as we are going to keep github and travis do this from now on.

**Important** now go to (test) PyPi and actually invite the other members as owners (or at least maintainers) so everything can live on if yours makes other choices.

## Github Actions

We use Github actions to verify code and perform tests before pushing to (test) PyPi.

## CodeFactor & CodeCov

We use - besides testing, linting and flaking - also CodeFactor.io to determine our code quality and CodeCov.io for coverage reporting.

## Test

Now test by creating a branch `git branch -a test` and committing/pushing against this and see if everything starts to work.
(Mostly just click on the build details and figure out what/if travis is doing everything its supposed to do and is 'green'.

If it is, merge, and it should do the real thing (assuming you increased the version number correctly).

## Connect codecov

Codecov can take a while on a new repo, but just check to see if it sees all repo's you have (might not see the newest ones yet).

From [integrations](https://github.com/plugwise/python-plugwise/settings/installations) set to configure codecov
For now pointing to [plugwise-python](https://github.com/plugwise/python-plugwise/blob/main/tests/INIT.md) until USB has tests.

## Templates for Github issues

Expand Down
34 changes: 1 addition & 33 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,3 @@
# Testing (for developers)

Plugwise-Smile has to be in working and functioning condition on all circumstances. Hence testing is applied and tested through [Github Actions](https://github.com/plugwise/python-plugwise/actions).

## Tests

From the above list of setups a number of values is selected to be asserted. Currently we have the following asserts in place:

Information gathering: (negative)

- Check handling against a Smile that 'times out' during request
- Check handling against a Smile refusing contact (`internal server error`)

Service handling (i.e. changing setpoint or switching a relay)

- Check against a Smile not accepting change (`internal server error`) (negative)
- Switch a relay, change a setpoint or change a schema/preset (positive)

Data processing (positive)

- Includes checking various `measures` and settings for each device / location / combination of both

## Running tests against Plugwise Smile

`*) This states Smile as unfortunately tests for USB are still to be added`

Our tests are mainly conducted locally by the contributors and using Github Actions, see the workflows in `.github/workflows`. You can always look up the latest (hopefully successful) build at [python-plugwise Github actions](https://github.com/plugwise/python-plugwise/actions).

If you want to run tests locally, use the provided `scripts/setup_test.sh` to initialize and enable your virtualenv using `source venv/bin/activate`.

Without your virtualenv, run the `scripts/setup_test.sh` script. With that (and your virtualenv enabled) you can run `scripts/tests_and_coverage.sh` or `scripts/complexity.sh` to show areas that need Cyclometic Complexity improving.

## Quality

Code quality is checked (through [Github Actions](https://github.com/plugwise/python-plugwise/actions)) at [CodeFactor](https://www.codefactor.io/repository/github/plugwise/python-plugwise) and [codecov.io](https://app.codecov.io/gh/plugwise/python-plugwise) as depicted by the badges on the [main repository page](https://github.com/plugwise/python-plugwise).
`*) unfortunately tests for USB are still to be added`

0 comments on commit de010c4

Please sign in to comment.