Skip to content

Commit

Permalink
Update dev environment
Browse files Browse the repository at this point in the history
  • Loading branch information
Limych committed May 8, 2024
1 parent a267042 commit 31cbdb5
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 163 deletions.
16 changes: 10 additions & 6 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ludeeus/integration_blueprint",
"image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye",
"image": "mcr.microsoft.com/devcontainers/python:1-3.12",
"postCreateCommand": "scripts/setup",
"forwardPorts": [
8123
Expand All @@ -17,17 +17,21 @@
"ms-python.python",
"github.vscode-pull-request-github",
"ryanluker.vscode-coverage-gutters",
"ms-python.vscode-pylance"
"ms-python.vscode-pylance",
"ms-python.black-formatter",
"ms-python.pylint"
],
"settings": {
"files.eol": "\n",
"editor.tabSize": 4,
"python.pythonPath": "/usr/bin/python3",
"python.analysis.autoSearchPaths": false,
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.formatting.provider": "black",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"black-formatter.path": [
"/usr/local/py-utils/bin/black"
],
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: "Bug report"
description: "Report a bug with the integration"
labels: "Bug"
labels: "bug"
body:
- type: markdown
attributes:
Expand All @@ -22,7 +22,7 @@ body:
required: true
- label: This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
required: true
- label: This issue is not a duplicate issue of any [previous issues](https://github.com/ludeeus/integration_blueprint/issues?q=is%3Aissue+label%3A%22Bug%22+)..
- label: This issue is not a duplicate issue of any [previous issues](https://github.com/Limych/ha-blueprint/issues?q=is%3Aissue+label%3A%22bug%22+)..
required: true
- type: textarea
attributes:
Expand Down
70 changes: 0 additions & 70 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

40 changes: 0 additions & 40 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: "Feature request"
description: "Suggest an idea for this project"
labels: "Feature+Request"
labels: "enhancement"
body:
- type: markdown
attributes:
Expand All @@ -14,7 +14,7 @@ body:
required: true
- label: This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
required: true
- label: This issue is not a duplicate feature request of [previous feature requests](https://github.com/ludeeus/integration_blueprint/issues?q=is%3Aissue+label%3A%22Feature+Request%22+).
- label: This issue is not a duplicate feature request of [previous feature requests](https://github.com/Limych/ha-blueprint/issues?q=is%3Aissue+label%3A%22enhancement%22+).
required: true

- type: textarea
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version-file: 'pyproject.toml'
cache: "pip"

- name: "Install requirements"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/py-dead-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version-file: 'pyproject.toml'

- name: "Cache pip"
uses: actions/cache@v4
Expand Down
23 changes: 3 additions & 20 deletions .github/workflows/py-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version-file: 'pyproject.toml'

- name: "Cache pip"
uses: actions/cache@v4
Expand Down Expand Up @@ -64,22 +64,14 @@ jobs:
needs: lint
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
max-parallel: 3
matrix:
python-version: ['3.11', '3.12']
experimental: [false]
# include:
# - python-version: '3.12'
# experimental: true
steps:
- name: "Checkout code"
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version-file: 'pyproject.toml'

- name: "Cache pip"
uses: actions/cache@v4
Expand Down Expand Up @@ -109,25 +101,16 @@ jobs:
echo '"""Stub."""' >custom_components/__init__.py
fi
- name: "Run tests with pytest"
if: matrix.python-version != '3.11'
run: |
pytest --basetemp=$RUNNER_TEMP --durations=10 -n auto --dist=loadfile -qq -o console_output_style=count -p no:sugar
./scripts/check_dirty
- name: "Install Coveralls"
if: matrix.python-version == '3.11'
run: |
pip install pytest-xdist coveralls
- name: "Run tests with pytest & Calculate coverage"
if: matrix.python-version == '3.11'
run: |
pytest --basetemp=$RUNNER_TEMP --durations=10 -n auto --dist=loadfile -qq -o console_output_style=count -p no:sugar --cov --cov-report=
./scripts/check_dirty
- name: "Send coverage to Coveralls"
if: matrix.python-version == '3.11'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: coveralls --service=github
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
if: env.release_version != '' && success()
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version-file: 'pyproject.toml'

- name: "Cache pip"
if: env.release_version != '' && success()
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ repos:
language: script
files: ^(custom_components/.+/const\.py|requirements\.txt)$
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.241
rev: v0.3.5
hooks:
- id: ruff
args:
- --fix
files: ^(custom_components|bin|tests)/.+\.py$
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
rev: v3.15.2
hooks:
- id: pyupgrade
args: [ --py310-plus ]
args: [ --py312-plus ]
stages: [manual]
- repo: https://github.com/psf/black
rev: 23.1.0
rev: 24.3.0
hooks:
- id: black
args:
Expand All @@ -37,7 +37,7 @@ repos:
files: ^(custom_components|bin|tests)/.+\.py$
stages: [manual]
- repo: https://github.com/PyCQA/bandit
rev: 1.7.4
rev: 1.7.8
hooks:
- id: bandit
args:
Expand Down
10 changes: 5 additions & 5 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The contents of this file is based on https://github.com/home-assistant/core/blob/dev/pyproject.toml

target-version = "py310"
target-version = "py312"

select = [
"B007", # Loop control variable {name} not used within loop body
Expand Down Expand Up @@ -38,11 +38,11 @@ ignore = [
"E731", # do not assign a lambda expression, use a def
]

[flake8-pytest-style]
[lint.flake8-pytest-style]
fixture-parentheses = false

[pyupgrade]
[lint.pyupgrade]
keep-runtime-typing = true

[mccabe]
max-complexity = 25
[lint.mccabe]
max-complexity = 25
2 changes: 1 addition & 1 deletion hacs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Integration blueprint",
"filename": "integration_blueprint.zip",
"hide_default_branch": true,
"homeassistant": "2023.8.0",
"homeassistant": "2024.4.0",
"render_readme": true,
"zip_release": true
}
2 changes: 1 addition & 1 deletion pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ignore=tests
# Use a conservative default here; 2 should speed up most setups and not hurt
# any too bad. Override on command line as appropriate.
jobs=2
load-plugins=pylint_strict_informational
fail-on=I
persistent=no
extension-pkg-whitelist=ciso8601

Expand Down
9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[project]
requires-python = ">=3.12"

[tool.black]
target-version = ["py310"]
target-version = ["py312"]
extend-exclude = "/generated/"

[tool.isort]
Expand All @@ -17,7 +20,7 @@ forced_separate = [
combine_as_imports = true

[tool.pylint.MAIN]
py-version = "3.10"
py-version = "3.12"
ignore = [
"tests",
]
Expand Down Expand Up @@ -162,7 +165,7 @@ log_date_format = "%Y-%m-%d %H:%M:%S"
asyncio_mode = "auto"

[tool.ruff]
target-version = "py310"
target-version = "py312"

select = [
"C", # complexity
Expand Down
4 changes: 2 additions & 2 deletions requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ pylint~=3.1
pylint-strict-informational==0.1
pytest>=7.2
pytest-cov>=3.0
pytest-homeassistant-custom-component>=0.12
pytest-homeassistant-custom-component>=0.13
tzdata
ruff~=0.4
ruff>=0.4
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
homeassistant>=2023.8.0
pip>=21.0
homeassistant>=2024.4.0
pip>=24.0
1 change: 0 additions & 1 deletion tests/bandit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ tests:
- B318
- B319
- B320
- B325
- B602
- B604

0 comments on commit 31cbdb5

Please sign in to comment.