Skip to content

Commit dc0818f

Browse files
authored
Merge branch 'master' into fix-open-window-mode-merge-conflicts
2 parents 30cab1f + bfab483 commit dc0818f

File tree

64 files changed

+2248
-462
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2248
-462
lines changed

.devcontainer/devcontainer.json

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"customizations": {
3+
"codespaces": {
4+
"openFiles": [
5+
"README.md",
6+
"CONTRIBUTING.md"
7+
]
8+
},
9+
"vscode": {
10+
"extensions": [
11+
"ms-python.python",
12+
"redhat.vscode-yaml",
13+
"esbenp.prettier-vscode",
14+
"GitHub.vscode-pull-request-github",
15+
"charliermarsh.ruff",
16+
"GitHub.vscode-github-actions",
17+
"ryanluker.vscode-coverage-gutters"
18+
],
19+
"settings": {
20+
"[python]": {
21+
"editor.codeActionsOnSave": {
22+
"source.fixAll": "always",
23+
"source.organizeImports": "always"
24+
}
25+
},
26+
"coverage-gutters.customizable.context-menu": true,
27+
"coverage-gutters.customizable.status-bar-toggler-watchCoverageAndVisibleEditors-enabled": true,
28+
"coverage-gutters.showGutterCoverage": false,
29+
"coverage-gutters.showLineCoverage": true,
30+
"coverage-gutters.xmlname": "coverage.xml",
31+
"python.analysis.extraPaths": [
32+
"${workspaceFolder}/src"
33+
],
34+
"python.defaultInterpreterPath": ".venv/bin/python",
35+
"python.formatting.provider": "black",
36+
"python.linting.enabled": true,
37+
"python.linting.mypyEnabled": true,
38+
"python.linting.pylintEnabled": true,
39+
"python.testing.cwd": "${workspaceFolder}",
40+
"python.testing.pytestArgs": [
41+
"--cov-report=xml"
42+
],
43+
"python.testing.pytestEnabled": true,
44+
"ruff.importStrategy": "fromEnvironment",
45+
"ruff.interpreter": [
46+
".venv/bin/python"
47+
],
48+
"terminal.integrated.defaultProfile.linux": "zsh"
49+
}
50+
}
51+
},
52+
"features": {
53+
"ghcr.io/devcontainers-contrib/features/poetry:2": {},
54+
"ghcr.io/devcontainers/features/github-cli:1": {},
55+
"ghcr.io/devcontainers/features/node:1": {},
56+
"ghcr.io/devcontainers/features/python:1": {
57+
"installTools": false
58+
}
59+
},
60+
"image": "mcr.microsoft.com/vscode/devcontainers/python:3.12",
61+
"name": "PyTado",
62+
"postStartCommand": "bash scripts/bootstrap",
63+
"updateContentCommand": "bash scripts/bootstrap",
64+
"containerUser": "vscode",
65+
"remoteUser": "vscode",
66+
"updateRemoteUserUID": true,
67+
"containerEnv": {
68+
"HOME": "/home/vscode"
69+
}
70+
}

.envrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export VIRTUAL_ENV=."venv"
2+
layout python
3+
4+
[[ -f .envrc.private ]] && source_env .envrc.private
Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
# For most projects, this workflow file will not need changing; you simply need
2-
# to commit it to your repository.
3-
#
4-
# You may wish to alter this file to override the set of languages analyzed,
5-
# or to provide custom queries or build logic.
6-
#
7-
# ******** NOTE ********
8-
# We have attempted to detect the languages in your repository. Please check
9-
# the `language` matrix defined below to confirm you have the correct set of
10-
# supported CodeQL languages.
11-
#
121
name: "CodeQL Advanced"
132

143
on:
Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

4-
name: Python package
4+
name: Lint and test multiple Python versions
55

66
on:
77
push:
@@ -10,44 +10,58 @@ on:
1010
branches: [ master ]
1111

1212
jobs:
13-
build:
13+
lint:
1414

1515
runs-on: ubuntu-latest
16-
strategy:
17-
matrix:
18-
python-version: ["3.11", "3.12"]
19-
2016
steps:
2117
- uses: actions/checkout@v4
2218

23-
- name: Set up Python ${{ matrix.python-version }}
19+
- name: Set up Python
2420
uses: actions/setup-python@v5
25-
with:
26-
python-version: ${{ matrix.python-version }}
27-
21+
2822
- name: Install dependencies
2923
run: |
3024
python -m pip install --upgrade pip
31-
pip install -r requirements.txt
32-
pip install -e .
33-
25+
pip install -e '.[all]'
26+
3427
- name: Lint with black
3528
uses: psf/black@stable
3629
with:
3730
options: "--check --verbose"
3831
src: "./PyTado"
3932
use_pyproject: true
40-
41-
- name: Run Tests with Coverage
33+
34+
test:
35+
36+
runs-on: ubuntu-latest
37+
strategy:
38+
matrix:
39+
python-version: ["3.13", "3.12", "3.11"]
40+
41+
steps:
42+
- uses: actions/checkout@v4
43+
44+
- name: Set up Python ${{ matrix.python-version }}
45+
uses: actions/setup-python@v5
46+
with:
47+
python-version: ${{ matrix.python-version }}
48+
49+
- name: Install dependencies
50+
run: |
51+
python -m pip install --upgrade pip
52+
pip install -e '.[all]'
53+
54+
- name: Run Tests with coverage
4255
run: |
43-
pip install coverage pytest pytest-cov
44-
coverage run -m pytest --maxfail=1 --disable-warnings -q
45-
coverage report -m
46-
coverage html
47-
48-
# Optionally upload coverage reports as an artifact.
49-
- name: Upload coverage report
50-
uses: actions/upload-artifact@v3
56+
pytest --cov --junitxml=junit.xml -o junit_family=legacy --cov-branch --cov-report=xml
57+
58+
- name: Upload test results to Codecov
59+
if: ${{ !cancelled() }}
60+
uses: codecov/test-results-action@v1
61+
with:
62+
token: ${{ secrets.CODECOV_TOKEN }}
63+
64+
- name: Upload coverage reports to Codecov
65+
uses: codecov/codecov-action@v5
5166
with:
52-
name: coverage-html-report
53-
path: coverage_html_report
67+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/pre-commit.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- master
7+
pull_request: ~
8+
9+
env:
10+
FORCE_COLOR: 1
11+
12+
jobs:
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install -e '.[all]'
25+
26+
- name: Run pre-commit hooks
27+
uses: pre-commit/action@v3.0.1
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Upload Python Package
1+
name: Build and deploy to pypi
22

33
on:
44
release:
@@ -20,8 +20,6 @@ jobs:
2020
- uses: actions/checkout@v4
2121
- name: Set up Python
2222
uses: actions/setup-python@v5
23-
with:
24-
python-version: "3.x"
2523
- name: Install pypa/build
2624
run: >-
2725
python3 -m

.gitignore

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ instance/
7171
# Sphinx documentation
7272
docs/_build/
7373

74+
# Ruff cache
75+
.ruff_cache
76+
77+
# Example dev
78+
/examples/example_dev.py
79+
7480
# PyBuilder
7581
.pybuilder/
7682
target/
@@ -127,6 +133,8 @@ venv/
127133
ENV/
128134
env.bak/
129135
venv.bak/
136+
.envrc.private
137+
!/.envrc
130138

131139
# Spyder project settings
132140
.spyderproject
@@ -157,4 +165,7 @@ cython_debug/
157165
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158166
# and can be added to the global gitignore or merged into this file. For a more nuclear
159167
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160-
#.idea/
168+
#.idea/
169+
170+
.DS_Store
171+
junit.xml

.pre-commit-config.yaml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
fail_fast: true
2+
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v5.0.0
6+
hooks:
7+
- id: no-commit-to-branch
8+
name: "Don't commit to master branch"
9+
args: [--branch, master]
10+
- id: check-ast
11+
- id: check-json
12+
- id: check-merge-conflict
13+
- id: check-toml
14+
- id: check-yaml
15+
- id: check-json
16+
- id: end-of-file-fixer
17+
exclude: custom_components/econnect_metronet/manifest.json
18+
- id: mixed-line-ending
19+
- id: trailing-whitespace
20+
21+
22+
- repo: https://github.com/PyCQA/isort
23+
rev: 5.13.2
24+
hooks:
25+
- id: isort
26+
exclude: tests/
27+
args: ["--profile", "black"]
28+
29+
- repo: https://github.com/hhatto/autopep8
30+
rev: v2.3.1
31+
hooks:
32+
- id: autopep8
33+
exclude: tests/
34+
args: [--max-line-length=100, --in-place, --aggressive]
35+
36+
- repo: https://github.com/PyCQA/flake8
37+
rev: 7.1.1
38+
hooks:
39+
- id: flake8
40+
exclude: tests/
41+
args: [--max-line-length=100]
42+
43+
- repo: https://github.com/asottile/pyupgrade
44+
rev: v3.19.1
45+
hooks:
46+
- id: pyupgrade
47+
48+
- repo: https://github.com/PyCQA/bandit
49+
rev: '1.8.0'
50+
hooks:
51+
- id: bandit
52+
args: ["-c", "pyproject.toml"]
53+
additional_dependencies: ["bandit[toml]"]
54+
55+
- repo: https://github.com/astral-sh/ruff-pre-commit
56+
# Ruff version.
57+
rev: v0.8.4
58+
hooks:
59+
- id: ruff
60+
exclude: tests/
61+
args: [--line-length=100, --fix]
62+
63+
- repo: https://github.com/pre-commit/mirrors-mypy
64+
rev: v1.14.0
65+
hooks:
66+
- id: mypy
67+
exclude: tests/
68+
additional_dependencies: [types-requests]
69+
70+
- repo: local
71+
hooks:
72+
- id: prettier
73+
name: prettier
74+
entry: prettier
75+
language: system
76+
types: [python, json, yaml, markdown]
77+
78+
- id: pytest
79+
name: pytest
80+
entry: pytest
81+
language: python
82+
types: [python]
83+
pass_filenames: false
84+
always_run: true
85+
additional_dependencies: [responses, pytest-mock]

.python-version

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

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
"github.vscode-github-actions",
55
"ms-python.pylint"
66
]
7-
}
7+
}

0 commit comments

Comments
 (0)