Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .devcontainer/integration/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM ghcr.io/astral-sh/uv:trixie-slim

# Create vscode user
RUN useradd -m -s /bin/bash vscode \
&& echo "vscode ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers


# Ensure workspace exists and is owned by vscode
RUN mkdir -p /workspace && chown -R vscode:vscode /workspace

# Switch to vscode for all runtime operations
USER vscode
WORKDIR /workspace/HA-Battery-Notes
30 changes: 13 additions & 17 deletions .devcontainer/integration/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
{
"name": "BN Integration",
"image": "mcr.microsoft.com/devcontainers/python:3.13",
"build": {"dockerfile": "Dockerfile"},
"remoteUser": "vscode",
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {
"installDirectlyFromGitHubRelease": true,
"version": "latest"
},
"ghcr.io/devcontainers-extra/features/poetry:2": {
"version": "latest"
},
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/node:1": {
"nodeGypDependencies": true,
"version": "lts"
},
"ghcr.io/devcontainers/features/rust:1": {},
"ghcr.io/devcontainers-extra/features/apt-packages:1": {
"packages": ["ffmpeg", "libturbojpeg0", "libpcap-dev"]
"version": "lts"
},
"ghcr.io/devcontainers-extra/features/apt-packages:1": {
"packages": [
"build-essential",
"ffmpeg",
"libpcap-dev",
"libturbojpeg0"
]
}
},
"postCreateCommand": "scripts/setup",
Expand All @@ -39,7 +37,6 @@
"settings": {
"files.eol": "\n",
"editor.tabSize": 4,
"python.pythonPath": "/usr/bin/python3",
"python.analysis.autoSearchPaths": false,
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
Expand All @@ -56,6 +53,5 @@
}
}
}
},
"remoteUser": "vscode"
}
}
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ updates:
schedule:
interval: "weekly"

- package-ecosystem: "pip"
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "weekly"
Expand Down
59 changes: 12 additions & 47 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,66 +7,31 @@ on:
paths:
- '**.py' # Run if pushed commits include a change to a Python (.py) file.
- '.github/workflows/lint.yml' # Run if pushed commits include a change to a github actions workflow file.
- 'requirements.txt' # Run if pushed commits include a change to the Python requirements.txt file.
- '.pyproject.toml' # Run if project configuration file changes.
pull_request:
branches:
- "main"
paths:
- '**.py' # Run if pushed commits include a change to a Python (.py) file.
- '.github/workflows/lint.yml' # Run if pushed commits include a change to a github actions workflow file.
- 'requirements.txt' # Run if pushed commits include a change to the Python requirements.txt file.
- '.pyproject.toml' # Run if project configuration file changes.
workflow_dispatch:

jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
python-version:
- "3.13"

runs-on: ${{ matrix.os }}

permissions:
security-events: write
actions: read
contents: read
ruff_check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
- name: Ruff Check
uses: astral-sh/ruff-action@v3
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install uv and create venv
run: |
pip install -U pip uv
uv venv

- name: Enable venv
run: |
source .venv/bin/activate
echo $PATH >> $GITHUB_PATH

- name: Install dependencies
run: |
if [ -f requirements.txt ]; then uv pip install -r requirements.txt; fi

- name: Install dev dependencies
run: |
pip install mypy

- name: Analyse the code with ruff
run: |
python3 -m ruff check .
args: check --output-format=github

# - name: Type check the code with mypy
# run: |
# mypy custom_components/battery_notes/ --check-untyped-defs
#TODO: Temporary disable until V3
# - name: Ruff Format
# uses: astral-sh/ruff-action@v3
# with:
# args: format --check --diff
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ __pycache__
*.egg-info
*/build/*
*/dist/*

.venv
.ruff_cache

# misc
.coverage
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13.2
Loading