Skip to content

Commit

Permalink
Switch from rye to uv, Python 3.13, HA 2025.2 (#903)
Browse files Browse the repository at this point in the history
  • Loading branch information
frenck authored Feb 20, 2025
1 parent 98d9b89 commit 976349e
Show file tree
Hide file tree
Showing 70 changed files with 10,269 additions and 8,899 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/devcontainers/base:debian
FROM mcr.microsoft.com/devcontainers/python:3.13

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

Expand Down
21 changes: 6 additions & 15 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,9 @@
"name": "Spook development environment",
"dockerFile": "./Dockerfile",
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {
"installDirectlyFromGitHubRelease": true,
"version": "latest"
},
"ghcr.io/devcontainers/features/node:1": {
"nodeGypDependencies": false,
"version": "lts"
},
"ghcr.io/schlich/devcontainer-features/rye:1": {
"uv": true
}
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/node:1": {},
"ghcr.io/va-h/devcontainers-features/uv:1": {}
},
"forwardPorts": [8123, 3000],
"portsAttributes": {
Expand All @@ -30,11 +22,10 @@
}
},
"runArgs": ["-e", "GIT_EDITOR=code --wait"],
"onCreateCommand": "rye config --set-bool behavior.use-uv=true && npm install -g mystmd",
"updateContentCommand": "rye sync",
"onCreateCommand": "npm install -g mystmd",
"updateContentCommand": "uv sync --extra cli && uv run pre-commit install",
"containerEnv": {
"DEVCONTAINER": "1",
"RYE_HOME": "/home/vscode/.rye"
"DEVCONTAINER": "1"
},
"remoteUser": "vscode",
"customizations": {
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: 🏗 Install MyST
run: npm install -g mystmd

- name: 🚀 Build documenation
- name: 🚀 Build documentation
working-directory: ./documentation
run: myst build --html

Expand Down
18 changes: 8 additions & 10 deletions .github/workflows/pylint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
workflow_dispatch:

env:
DEFAULT_PYTHON: "3.11"
DEFAULT_PYTHON: "3.13"

jobs:
pylint:
Expand All @@ -17,16 +17,14 @@ jobs:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected]

- name: 🏗 Set up rye
uses: eifinger/setup-rye@v4.2.8
- name: 🏗 Set up uv
uses: astral-sh/setup-uv@v5.2.2
with:
enable-cache: true
python-version: ${{ env.DEFAULT_PYTHON }}

- name: 🏎️ Enable uv in rye
run: rye config --set-bool behavior.use-uv=true
- name: 🏗 Install dependencies
run: uv sync --extra cli --frozen --dev

- name: 🏗 Sync dependencies
run: rye sync

- name: 🚀 Run Pylint
run: rye run pylint custom_components/spook
- name: 🚀 Run pylint
run: uv run pre-commit run pylint --all-files
18 changes: 8 additions & 10 deletions .github/workflows/ruff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
workflow_dispatch:

env:
DEFAULT_PYTHON: "3.11"
DEFAULT_PYTHON: "3.13"

jobs:
ruff:
Expand All @@ -17,19 +17,17 @@ jobs:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected]

- name: 🏗 Set up rye
uses: eifinger/setup-rye@v4.2.8
- name: 🏗 Set up uv
uses: astral-sh/setup-uv@v5.2.2
with:
enable-cache: true
python-version: ${{ env.DEFAULT_PYTHON }}

- name: 🏎️ Enable uv in rye
run: rye config --set-bool behavior.use-uv=true

- name: 🏗 Sync dependencies
run: rye sync
- name: 🏗 Install dependencies
run: uv sync --extra cli --frozen --dev

- name: 🚀 Run ruff linter
run: rye run ruff check .
run: uv run ruff check --output-format=github .

- name: 🚀 Run ruff formatter
run: rye run ruff format --check .
run: uv run ruff format --check .
22 changes: 11 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,51 @@ repos:
name: 🐶 Ruff Linter
language: system
types: [python]
entry: rye run ruff check --fix
entry: uv run ruff check --fix
require_serial: true
stages: [commit, push, manual]
- id: ruff-format
name: 🐶 Ruff Formatter
language: system
types: [python]
entry: rye run ruff format
entry: uv run ruff format
require_serial: true
stages: [commit, push, manual]
- id: check-json
name: Check JSON files
name: Check JSON files
language: system
types: [json]
entry: rye run check-json
entry: uv run check-json
- id: check-toml
name: ✅ Check TOML files
language: system
types: [toml]
entry: rye run check-toml
entry: uv run check-toml
- id: check-yaml
name: ✅ Check YAML files
language: system
types: [yaml]
entry: rye run check-yaml
entry: uv run check-yaml
- id: check-merge-conflict
name: 💥 Check for merge conflicts
language: system
types: [text]
entry: rye run check-merge-conflict
entry: uv run check-merge-conflict
- id: check-symlinks
name: 🔗 Check for broken symlinks
language: system
types: [symlink]
entry: rye run check-symlinks
entry: uv run check-symlinks
- id: end-of-file-fixer
name: ⮐ Fix End of Files
language: system
types: [text]
entry: rye run end-of-file-fixer
entry: uv run end-of-file-fixer
stages: [commit, push, manual]
- id: no-commit-to-branch
name: 🛑 Don't commit to main branch
language: system
entry: rye run no-commit-to-branch
entry: uv run no-commit-to-branch
pass_filenames: false
always_run: true
args:
Expand All @@ -59,7 +59,7 @@ repos:
name: 🌟 Starring code with pylint
language: system
types: [python]
entry: rye run pylint
entry: uv run pylint
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
hooks:
Expand Down
1 change: 0 additions & 1 deletion .python-version

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"config": {
"step": {
"switch": {
"data": {
"name": "الاسم",
"hide_source": "إخفاء وحدة المصدر",
"entity_id": "وحدة المصدر"
}
},
"user": {
"description": "يتيح لك هذا المساعد عكس سلوك الوحدة. على سبيل المثال، عكس فتح/إغلاق أو تشغيل/إيقاف أجهزة الاستشعار الثنائية والمفاتيح.",
"menu_options": {
"switch": "عكس مفتاح",
"binary_sensor": "عكس مستشعر ثنائي"
}
},
"binary_sensor": {
"data": {
"hide_source": "إخفاء وحدة المصدر",
"name": "الاسم",
"entity_id": "وحدة المصدر"
}
}
"config": {
"step": {
"switch": {
"data": {
"name": "الاسم",
"hide_source": "إخفاء وحدة المصدر",
"entity_id": "وحدة المصدر"
}
},
"user": {
"description": "يتيح لك هذا المساعد عكس سلوك الوحدة. على سبيل المثال، عكس فتح/إغلاق أو تشغيل/إيقاف أجهزة الاستشعار الثنائية والمفاتيح.",
"menu_options": {
"switch": "عكس مفتاح",
"binary_sensor": "عكس مستشعر ثنائي"
}
},
"binary_sensor": {
"data": {
"hide_source": "إخفاء وحدة المصدر",
"name": "الاسم",
"entity_id": "وحدة المصدر"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
{
"config": {
"step": {
"binary_sensor": {
"data": {
"entity_id": "Zdrojová entita",
"hide_source": "Skrýt zdrojovou entitu",
"name": "Název"
},
"title": "Invertovat 👻"
},
"switch": {
"data": {
"entity_id": "Zdrojová entita",
"hide_source": "Skrýt zdrojovou entitu",
"name": "Název"
},
"title": "Invertovat 👻"
},
"user": {
"title": "Invertovat 👻",
"menu_options": {
"binary_sensor": "Invertovat binární senzor",
"switch": "Invertovat přepínač"
},
"description": "Tento pomocník umožňuje invertovat chování entity. Například otočení otevřeno/zavřeno nebo zapnuto/vypnuto binárního senzoru či přepínače."
}
}
},
"options": {
"step": {
"binary_sensor": {
"data": {
"entity_id": "Zdrojová entita",
"hide_source": "Skrýt zdrojovou entitu",
"name": "Název"
},
"title": "Invertovat 👻"
},
"switch": {
"data": {
"entity_id": "Zdrojová entita",
"hide_source": "Skrýt zdrojovou entitu",
"name": "Název"
},
"title": "Invertovat 👻"
}
}
},
"title": "Invertovat 👻"
"config": {
"step": {
"binary_sensor": {
"data": {
"entity_id": "Zdrojová entita",
"hide_source": "Skrýt zdrojovou entitu",
"name": "Název"
},
"title": "Invertovat 👻"
},
"switch": {
"data": {
"entity_id": "Zdrojová entita",
"hide_source": "Skrýt zdrojovou entitu",
"name": "Název"
},
"title": "Invertovat 👻"
},
"user": {
"title": "Invertovat 👻",
"menu_options": {
"binary_sensor": "Invertovat binární senzor",
"switch": "Invertovat přepínač"
},
"description": "Tento pomocník umožňuje invertovat chování entity. Například otočení otevřeno/zavřeno nebo zapnuto/vypnuto binárního senzoru či přepínače."
}
}
},
"options": {
"step": {
"binary_sensor": {
"data": {
"entity_id": "Zdrojová entita",
"hide_source": "Skrýt zdrojovou entitu",
"name": "Název"
},
"title": "Invertovat 👻"
},
"switch": {
"data": {
"entity_id": "Zdrojová entita",
"hide_source": "Skrýt zdrojovou entitu",
"name": "Název"
},
"title": "Invertovat 👻"
}
}
},
"title": "Invertovat 👻"
}
Loading

0 comments on commit 976349e

Please sign in to comment.