Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update python to 3.11 and add Black formatter #48

Merged
merged 2 commits into from
Oct 12, 2023
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
10 changes: 4 additions & 6 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ElevenLabs TTS Custom Component",
"image": "mcr.microsoft.com/vscode/devcontainers/python:0-3.10-bullseye",
"image": "mcr.microsoft.com/vscode/devcontainers/python:0-3.11",
"postCreateCommand": "scripts/setup",
"appPort": [
"9123:8123"
Expand All @@ -11,17 +11,15 @@
"ms-python.python",
"github.vscode-pull-request-github",
"ryanluker.vscode-coverage-gutters",
"ms-python.vscode-pylance"
"ms-python.vscode-pylance",
"ms-python.black-formatter"
],
"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",
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
Expand Down
21 changes: 20 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,30 @@ jobs:
- name: "Set up Python"
uses: actions/[email protected]
with:
python-version: "3.10"
python-version: "3.11"
cache: "pip"

- name: "Install requirements"
run: python3 -m pip install -r requirements.txt

- name: "Run"
run: python3 -m ruff check .

black:
name: "Black"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout the repository"
uses: "actions/[email protected]"

- name: "Set up Python"
uses: actions/[email protected]
with:
python-version: "3.11"
cache: "pip"

- name: "Install requirements"
run: python3 -m pip install -r requirements.txt

- name: "Run"
run: python3 -m black --check .
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: "Set up Python"
uses: actions/[email protected]
with:
python-version: "3.10"
python-version: "3.11"
cache: "pip"

- name: "Install requirements"
Expand Down
6 changes: 3 additions & 3 deletions custom_components/elevenlabs_tts/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
DEFAULT_OPTIMIZE_LATENCY,
DEFAULT_SIMILARITY,
DEFAULT_STABILITY,
DEFAULT_VOICE,
DEFAULT_STYLE,
DEFAULT_USE_SPEAKER_BOOST,
DEFAULT_USE_SPEAKER_BOOST,
DEFAULT_VOICE,
DOMAIN,
)
from .elevenlabs import ElevenLabsClient
Expand Down Expand Up @@ -141,7 +141,7 @@ async def async_step_init(self, user_input=None):
default=self.config_entry.options.get(
CONF_USE_SPEAKER_BOOST, DEFAULT_USE_SPEAKER_BOOST
),
): bool,
): bool,
}
),
)
Expand Down
1 change: 0 additions & 1 deletion custom_components/elevenlabs_tts/elevenlabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,3 @@ async def get_tts_options(
optimize_latency,
api_key,
)

4 changes: 2 additions & 2 deletions custom_components/elevenlabs_tts/tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
CONF_STABILITY,
CONF_STYLE,
CONF_USE_SPEAKER_BOOST,
DOMAIN
DOMAIN,
)
from .elevenlabs import ElevenLabsClient

Expand Down Expand Up @@ -74,7 +74,7 @@ def supported_options(self) -> list[str]:
CONF_STABILITY,
CONF_SIMILARITY,
CONF_STYLE,
CONF_USE_SPEAKER_BOOST,
CONF_USE_SPEAKER_BOOST,
CONF_MODEL,
CONF_OPTIMIZE_LATENCY,
CONF_API_KEY,
Expand Down
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": "ElevenLabs TTS",
"filename": "elevenlabs_tts.zip",
"hide_default_branch": true,
"homeassistant": "2023.5.3",
"homeassistant": "2023.10.1",
"render_readme": true,
"zip_release": true
}
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
colorlog==6.7.0
homeassistant>=2023.5.3
homeassistant>=2023.8.1
pip>=21.0,<23.3
ruff==0.0.292
black==23.3.0
orjson
2 changes: 1 addition & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-r requirements.txt
pytest
pytest-cov
pytest-homeassistant-custom-component==0.13.45
pytest-homeassistant-custom-component==0.13.64
pre-commit>=2.11.1
respx

Expand Down
2 changes: 2 additions & 0 deletions scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ set -e
cd "$(dirname "$0")/.."

ruff check . --fix

black .