diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml new file mode 100644 index 0000000..977952c --- /dev/null +++ b/.github/workflows/mypy.yml @@ -0,0 +1,28 @@ +name: Type check + +on: [push] + +jobs: + mypy: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.13"] + + steps: + - uses: actions/checkout@v5 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements_dev.txt + - name: Install library + run: | + python -m pip install . + - name: Run mypy + run: | + mypy SolixBLE tests --strict --namespace-packages --explicit-package-bases diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml new file mode 100644 index 0000000..0d1e50c --- /dev/null +++ b/.github/workflows/ruff.yml @@ -0,0 +1,8 @@ +name: Ruff +on: [ push, pull_request ] +jobs: + ruff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/ruff-action@v3 \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 16c7da5..49990d6 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,5 +1,7 @@ { "recommendations": [ - "ms-python.black-formatter" + "ms-python.black-formatter", + "charliermarsh.ruff", + "ms-python.mypy-type-checker" ] } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 3b9671c..a9f9c0f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,6 +6,7 @@ "editor.defaultFormatter": "ms-python.black-formatter", "editor.formatOnSave": true }, + "ruff.lint.enable": true, "cSpell.enabled": true, "cSpell.words": [ "Anker", diff --git a/README.md b/README.md index 9867dd3..375430a 100644 --- a/README.md +++ b/README.md @@ -89,3 +89,8 @@ pip install SolixBLE See the `Generic` class inside `SolixBLE/devices/generic.py` and the [documentation](https://solixble.readthedocs.io/en/latest/new_devices.html) for guidance on how to add support for new devices. + + +## Disclaimer + +SolixBLE is a software library designed to work with Anker Solix/Prime devices. ANKER is a registered trademark of Anker Innovations Limited. This project is not affiliated with, endorsed by, or sponsored by Anker Innovations Limited (Though I wouldn't mind being sponsored 😉). All other trademarks cited herein are the property of their respective owners. \ No newline at end of file diff --git a/docs/source/index.rst b/docs/source/index.rst index 8eba0d9..b0afc96 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -147,6 +147,14 @@ Serial number ❌ ❌ ======================= ============= ============= +Disclaimer +---------- + +SolixBLE is a software library designed to work with Anker Solix/Prime devices. +ANKER is a registered trademark of Anker Innovations Limited. +This project is not affiliated with, endorsed by, or sponsored by Anker Innovations Limited (Though I wouldn't mind being sponsored 😉). +All other trademarks cited herein are the property of their respective owners. + Contents -------- diff --git a/pyproject.toml b/pyproject.toml index 3818f26..ffab4fa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,13 @@ classifiers = [ "Programming Language :: Python :: 3.11" ] +[tool.ruff.lint] +select = ["ALL"] +ignore = ["D202", "D212", "D213", "G004"] + +[tool.ruff.lint.per-file-ignores] +"tests/*" = ["S101"] + [project.urls] Homepage = "https://github.com/flip-dots/SolixBLE" Documentation = "https://solixble.readthedocs.io/en/latest/" diff --git a/requirements_dev.txt b/requirements_dev.txt index 7d1ca86..c7967e2 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -4,4 +4,6 @@ pytest-cov bleak cryptography pycryptodome -bleak-retry-connector \ No newline at end of file +bleak-retry-connector +ruff +mypy \ No newline at end of file