From 31cbdb51dd3550cd5db2edac6d906156be6984b0 Mon Sep 17 00:00:00 2001 From: Andrey Khrolenok Date: Wed, 8 May 2024 22:57:53 +0300 Subject: [PATCH] Update dev environment --- .devcontainer.json | 16 +++-- .github/ISSUE_TEMPLATE/bug.yml | 4 +- .github/ISSUE_TEMPLATE/bug_report.md | 70 ---------------------- .github/ISSUE_TEMPLATE/feature_request.md | 40 ------------- .github/ISSUE_TEMPLATE/feature_request.yml | 4 +- .github/workflows/lint.yml | 2 +- .github/workflows/py-dead-code.yml | 2 +- .github/workflows/py-test.yml | 23 +------ .github/workflows/release.yml | 2 +- .pre-commit-config.yaml | 10 ++-- .ruff.toml | 10 ++-- hacs.json | 2 +- pylintrc | 2 +- pyproject.toml | 9 ++- requirements-test.txt | 4 +- requirements.txt | 4 +- tests/bandit.yaml | 1 - 17 files changed, 42 insertions(+), 163 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.devcontainer.json b/.devcontainer.json index c70f1f5..5cec644 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -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 @@ -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, diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index d8b9ed6..150595c 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -1,7 +1,7 @@ --- name: "Bug report" description: "Report a bug with the integration" -labels: "Bug" +labels: "bug" body: - type: markdown attributes: @@ -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: diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 5df85e3..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve component -title: '' -labels: 'bug' -assignees: '' - ---- - - - -**Environment** - - -- Home Assistant Core release with the issue: -- This custom component release with the issue: -- Last working this custom component release (if known): -- Operating environment (Home Assistant/Supervisor/Docker/venv): - -**Describe the bug** - - - -**Configuration.yaml** -```yaml - -Add your configs here if any. - -``` - -**Steps to Reproduce** - - - -**Expected behavior** - - - -**Debug log** - -```text - -Add your logs here. - -``` - -**Additional context** - diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index c2d2583..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: 'enhancement' -assignees: '' - ---- - - - -**Is your feature request related to a problem? Please describe.** - - - -**Describe the solution you'd like** - - - -**Describe alternatives you've considered** - - - -**Additional context** - diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 433467b..5b34fa1 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,7 +1,7 @@ --- name: "Feature request" description: "Suggest an idea for this project" -labels: "Feature+Request" +labels: "enhancement" body: - type: markdown attributes: @@ -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 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 091336c..4e07fbc 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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" diff --git a/.github/workflows/py-dead-code.yml b/.github/workflows/py-dead-code.yml index 3cdda49..5e3744b 100644 --- a/.github/workflows/py-dead-code.yml +++ b/.github/workflows/py-dead-code.yml @@ -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 diff --git a/.github/workflows/py-test.yml b/.github/workflows/py-test.yml index 6b97e0a..8745372 100644 --- a/.github/workflows/py-test.yml +++ b/.github/workflows/py-test.yml @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 884fa59..0fd446b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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() diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ea74596..97b27ac 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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: @@ -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: diff --git a/.ruff.toml b/.ruff.toml index 7a8331a..384e20e 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -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 @@ -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 \ No newline at end of file +[lint.mccabe] +max-complexity = 25 diff --git a/hacs.json b/hacs.json index 0c12f64..3fca37c 100644 --- a/hacs.json +++ b/hacs.json @@ -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 } diff --git a/pylintrc b/pylintrc index 850e50d..7b6263c 100644 --- a/pylintrc +++ b/pylintrc @@ -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 diff --git a/pyproject.toml b/pyproject.toml index cb14c1b..1b2b658 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,8 @@ +[project] +requires-python = ">=3.12" + [tool.black] -target-version = ["py310"] +target-version = ["py312"] extend-exclude = "/generated/" [tool.isort] @@ -17,7 +20,7 @@ forced_separate = [ combine_as_imports = true [tool.pylint.MAIN] -py-version = "3.10" +py-version = "3.12" ignore = [ "tests", ] @@ -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 diff --git a/requirements-test.txt b/requirements-test.txt index d0f4f99..e98091b 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -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 diff --git a/requirements.txt b/requirements.txt index 4060e25..02a0900 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -homeassistant>=2023.8.0 -pip>=21.0 +homeassistant>=2024.4.0 +pip>=24.0 diff --git a/tests/bandit.yaml b/tests/bandit.yaml index ebd284e..dcacabd 100644 --- a/tests/bandit.yaml +++ b/tests/bandit.yaml @@ -12,6 +12,5 @@ tests: - B318 - B319 - B320 - - B325 - B602 - B604