Skip to content

Commit d70bfc3

Browse files
committed
Merge remote-tracking branch 'upstream/main' into github-actions
2 parents c9dfd6c + 3e3dbcb commit d70bfc3

File tree

13 files changed

+2120
-2
lines changed

13 files changed

+2120
-2
lines changed

.devcontainer/devcontainer.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"containerEnv": {
3+
"POETRY_VIRTUALENVS_IN_PROJECT": "true"
4+
},
5+
"customizations": {
6+
"codespaces": {
7+
"openFiles": [
8+
"README.md",
9+
"pyhilo/api.py",
10+
"pyhilo/devices.py"
11+
]
12+
},
13+
"vscode": {
14+
"extensions": [
15+
"charliermarsh.ruff",
16+
"esbenp.prettier-vscode",
17+
"esbenp.prettier-vscode",
18+
"GitHub.vscode-github-actions",
19+
"GitHub.vscode-pull-request-github",
20+
"ms-python.mypy-type-checker",
21+
"ms-python.pylint",
22+
"ms-python.python",
23+
"ms-python.vscode-pylance",
24+
"redhat.vscode-yaml",
25+
"redhat.vscode-yaml",
26+
"ryanluker.vscode-ecoverage-gutters",
27+
"visualstudioexptteam.vscodeintellicode"
28+
],
29+
"settings": {
30+
"[python]": {
31+
"editor.codeActionsOnSave": {
32+
"source.fixAll": true,
33+
"source.organizeImports": true,
34+
"files.trimTrailingWhitespace": true
35+
}
36+
},
37+
"coverage-gutters.customizable.context-menu": true,
38+
"coverage-gutters.customizable.status-bar-toggler-watchCoverageAndVisibleEditors-enabled": true,
39+
"coverage-gutters.showGutterCoverage": false,
40+
"coverage-gutters.showLineCoverage": true,
41+
"coverage-gutters.xmlname": "coverage.xml",
42+
"python.analysis.extraPaths": ["${workspaceFolder}/pyhilo"],
43+
"python.defaultInterpreterPath": ".venv/bin/python",
44+
"python.formatting.provider": "ruff",
45+
"python.testing.cwd": "${workspaceFolder}",
46+
"python.testing.pytestArgs": ["--cov-report=xml"],
47+
"python.testing.pytestEnabled": true,
48+
"ruff.importStrategy": "fromEnvironment",
49+
"ruff.interpreter": [".venv/bin/python"],
50+
"terminal.integrated.defaultProfile.linux": "zsh"
51+
}
52+
}
53+
},
54+
"features": {
55+
"ghcr.io/devcontainers-contrib/features/poetry:2": {},
56+
"ghcr.io/devcontainers/features/github-cli:1": {},
57+
"ghcr.io/devcontainers/features/node:1": {},
58+
"ghcr.io/devcontainers/features/python:1": {
59+
"installTools": false
60+
}
61+
},
62+
"image": "mcr.microsoft.com/devcontainers/python:3",
63+
"name": "A Python3, async interface to the Hilo API",
64+
"updateContentCommand": ". ${NVM_DIR}/nvm.sh && nvm install && nvm use && npm install && poetry install && poetry run pre-commit install"
65+
}

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_style = space
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
indent_size = 2
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* text eol=lf
2+
*.py whitespace=error

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,10 @@ dmypy.json
132132
.DS_Store
133133

134134
# Pycharm stuff
135-
*.idea
135+
*.idea
136+
137+
# Optional npm cache directory
138+
.npm
139+
140+
# Dependency directories
141+
node_modules/

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22.14.0

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.gitignore

.yamllint

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
ignore:
3+
- .venv
4+
rules:
5+
braces:
6+
level: error
7+
min-spaces-inside: 0
8+
max-spaces-inside: 1
9+
min-spaces-inside-empty: -1
10+
max-spaces-inside-empty: -1
11+
brackets:
12+
level: error
13+
min-spaces-inside: 0
14+
max-spaces-inside: 0
15+
min-spaces-inside-empty: -1
16+
max-spaces-inside-empty: -1
17+
colons:
18+
level: error
19+
max-spaces-before: 0
20+
max-spaces-after: 1
21+
commas:
22+
level: error
23+
max-spaces-before: 0
24+
min-spaces-after: 1
25+
max-spaces-after: 1
26+
comments:
27+
level: error
28+
require-starting-space: true
29+
min-spaces-from-content: 1
30+
comments-indentation:
31+
level: error
32+
document-end:
33+
level: error
34+
present: false
35+
document-start:
36+
level: error
37+
present: true
38+
empty-lines:
39+
level: error
40+
max: 1
41+
max-start: 0
42+
max-end: 1
43+
hyphens:
44+
level: error
45+
max-spaces-after: 1
46+
indentation:
47+
level: error
48+
spaces: 2
49+
indent-sequences: true
50+
check-multi-line-strings: false
51+
key-duplicates:
52+
level: error
53+
line-length:
54+
level: warning
55+
max: 120
56+
allow-non-breakable-words: true
57+
allow-non-breakable-inline-mappings: true
58+
new-line-at-end-of-file:
59+
level: error
60+
new-lines:
61+
level: error
62+
type: unix
63+
trailing-spaces:
64+
level: error
65+
truthy:
66+
level: error

README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# python-hilo
22

3+
[![GitHub Release][releases-shield]][releases]
4+
[![License][license-shield]](LICENSE)
5+
6+
[![Build Status][build-shield]][build]
7+
[![Open in Dev Containers][devcontainer-shield]][devcontainer]
8+
39
`python-hilo` (aka `pyhilo`) is a Python 3.11, `asyncio`-driven interface to the unofficial
410
Hilo API from Hydro Quebec. This is meant to be integrated into Home Assistant but can also
511
be used as a standalone library.
@@ -16,3 +22,68 @@ Home assistant integration is available [here](https://github.com/dvd-dev/hilo)
1622

1723
If anyone wants to contribute, feel free to submit a PR. If you'd like to sync up first, you can
1824
fire me an email [email protected]
25+
26+
## Setting up development environment
27+
28+
The easiest way to start, is by opening a CodeSpace here on GitHub, or by using
29+
the [Dev Container][devcontainer] feature of Visual Studio Code.
30+
31+
[![Open in Dev Containers][devcontainer-shield]][devcontainer]
32+
33+
This Python project is fully managed using the [Poetry][poetry] dependency
34+
manager. But also relies on the use of NodeJS for certain checks during
35+
development.
36+
37+
You need at least:
38+
39+
- Python 3.11+
40+
- [Poetry][poetry-install]
41+
- NodeJS 20+ (including NPM)
42+
43+
To install all packages, including all development requirements:
44+
45+
```bash
46+
npm install
47+
poetry install
48+
```
49+
50+
As this repository uses the [pre-commit][pre-commit] framework, all changes
51+
are linted and tested with each commit. You can run all checks and tests
52+
manually, using the following command:
53+
54+
```bash
55+
poetry run pre-commit run --all-files
56+
```
57+
58+
To run just the Python tests:
59+
60+
```bash
61+
poetry run pytest
62+
```
63+
64+
## Authors & contributors
65+
66+
The original setup of this repository is by [David Vallée Delisle][dvd-dev].
67+
68+
Credits to [@frenck][frenck] for the base container configuration.
69+
The license of python-wled can be found in
70+
[third_party/python-wled/LICENSE](third_party/python-wled/LICENSE).
71+
72+
For a full list of all authors and contributors,
73+
check [the contributor's page][contributors].
74+
75+
76+
77+
[build-shield]: https://github.com/dvd-dev/python-hilo/actions/workflows/tests.yaml/badge.svg
78+
[build]: https://github.com/dvd-dev/python-hilo/actions/workflows/tests.yaml
79+
[releases-shield]: https://img.shields.io/github/release/dvd-dev/python-hilo.svg
80+
[releases]: https://github.com/dvd-dev/python-hilo/releases
81+
[license-shield]: https://img.shields.io/github/license/dvd-dev/python-hilo.svg
82+
[devcontainer-shield]: https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode
83+
[devcontainer]: https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/dvd-dev/python-hilo
84+
[poetry-install]: https://python-poetry.org/docs/#installation
85+
[poetry]: https://python-poetry.org
86+
[pre-commit]: https://pre-commit.com/
87+
[dvd-dev]: https://github.com/dvd-dev
88+
[frenck]: https://github.com/frenck
89+
[contributors]: https://github.com/dvd-dev/python-hilo/graphs/contributors

package-lock.json

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "python-hilo",
3+
"version": "2025.2.2",
4+
"private": true,
5+
"description": "A Python3, async interface to the Hilo API",
6+
"scripts": {
7+
"prettier": "prettier --write **/*.{json,js,md,yml,yaml} *.{json,js,md,yml,yaml}"
8+
},
9+
"author": "David Vallee Delisle <[email protected]>",
10+
"license": "MIT",
11+
"devDependencies": {
12+
"prettier": "3.5.1"
13+
}
14+
}

0 commit comments

Comments
 (0)