# This workflow will install Python dependencies, run tests and lint
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
-name: Test with Pre-commit and Tox
+name: Test with Pre-commit
on:
push:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
- sudo apt-get install -y --no-install-recommends libsndfile1 libtag1v5 libtag1-dev
python -m pip install --upgrade pip
- pip install tox tox-gh-actions pre-commit
+ pip install pre-commit
pre-commit install-hooks
- - name: Lint with pre-commit
+ - name: Lint/test with pre-commit
run: pre-commit run --all-files
- - name: Test with tox
- run: tox
- id: mypy
additional_dependencies: [types-all]
exclude: ^examples/
+ - repo: local
+ hooks:
+ - id: pylint
+ name: pylint
+ entry: pylint
+ language: system
+ types: [python]
+ args: ["-rn", "-sn", "--rcfile=pylintrc", "--fail-on=I"]
+ exclude: ^examples/|^.venv/|^.vscode/
+
"""Various helpers for audio manipulation."""
+from __future__ import annotations
import asyncio
import logging
"""Provides a simple stateless caching system."""
+from __future__ import annotations
import asyncio
import functools
"""Several helper/utils to compare objects."""
+from __future__ import annotations
+
import re
from typing import TYPE_CHECKING, List
"""Helpers for date and time."""
+from __future__ import annotations
import datetime
"""Utilities for image manipulation and retrieval."""
+from __future__ import annotations
from io import BytesIO
"""Various helpers for web requests."""
+from __future__ import annotations
import asyncio
The subprocess implementation in asyncio can (still) sometimes cause deadlocks,
even when properly handling reading/writes from different tasks.
"""
+from __future__ import annotations
import asyncio
import logging
"""Typing helper."""
+from __future__ import annotations
from typing import TYPE_CHECKING, Any, List, Optional
"""Helper and utility functions."""
+from __future__ import annotations
+
import asyncio
import functools
import os
"""Qobuz musicprovider support for MusicAssistant."""
+from __future__ import annotations
import datetime
import hashlib
"""Spotify musicprovider support for MusicAssistant."""
+from __future__ import annotations
+
import asyncio
import json
import os
"""Tune-In musicprovider support for MusicAssistant."""
+from __future__ import annotations
+
from typing import List, Optional
from asyncio_throttle import Throttler
--- /dev/null
+[MASTER]
+ignore=tests
+ignore-patterns=app_vars
+# 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
+persistent=no
+suggestion-mode=yes
+extension-pkg-whitelist=taglib
+
+[BASIC]
+good-names=id,i,j,k,ex,Run,_,fp,T,ev
+
+[MESSAGES CONTROL]
+# Reasons disabled:
+# format - handled by black
+# locally-disabled - it spams too much
+# duplicate-code - unavoidable
+# cyclic-import - doesn't test if both import on load
+# abstract-class-little-used - prevents from setting right foundation
+# unused-argument - generic callbacks and setup methods create a lot of warnings
+# too-many-* - are not enforced for the sake of readability
+# too-few-* - same as too-many-*
+# abstract-method - with intro of async there are always methods missing
+# inconsistent-return-statements - doesn't handle raise
+# too-many-ancestors - it's too strict.
+# wrong-import-order - isort guards this
+# fixme - project is in development phase
+disable=
+ format,
+ abstract-class-little-used,
+ abstract-method,
+ cyclic-import,
+ duplicate-code,
+ inconsistent-return-statements,
+ locally-disabled,
+ not-context-manager,
+ too-few-public-methods,
+ too-many-ancestors,
+ too-many-arguments,
+ too-many-branches,
+ too-many-instance-attributes,
+ too-many-lines,
+ too-many-locals,
+ too-many-public-methods,
+ too-many-return-statements,
+ too-many-statements,
+ too-many-boolean-expressions,
+ unused-argument,
+ wrong-import-order,
+ fixme
+# enable useless-suppression temporarily every now and then to clean them up
+enable=
+ use-symbolic-message-instead
+
+[REPORTS]
+score=no
+
+[REFACTORING]
+
+# Maximum number of nested blocks for function / method body
+max-nested-blocks=15
+
+[TYPECHECK]
+# For attrs
+ignored-classes=_CountingAttr
+
+[FORMAT]
+expected-line-ending-format=LF
\ No newline at end of file
}
PROJECT_DIR = Path(__file__).parent.resolve()
README_FILE = PROJECT_DIR / "README.rst"
+REQUIREMENTS_FILE = PROJECT_DIR / "requirements.txt"
PACKAGES = find_packages(exclude=["tests", "tests.*"])
PACKAGE_FILES = []
for (path, directories, filenames) in os.walk("music_assistant/"):
for filename in filenames:
PACKAGE_FILES.append(os.path.join("..", path, filename))
-with open("requirements.txt") as f:
- REQUIRES = f.read().splitlines()
-
setup(
name=PROJECT_PACKAGE_NAME,
version=PROJECT_VERSION,
packages=PACKAGES,
include_package_data=True,
zip_safe=False,
- install_requires=REQUIRES,
+ install_requires=REQUIREMENTS_FILE.read_text(encoding="utf-8"),
python_requires=f">={PROJECT_REQ_PYTHON_VERSION}",
test_suite="tests",
entry_points={
+++ /dev/null
-[tox]
-envlist = py39, py310, lint, mypy
-skip_missing_interpreters = True
-
-[gh-actions]
-python =
- 3.9: py39, lint, mypy
- 3.10: py310
-
-[testenv:lint]
-basepython = python3
-ignore_errors = True
-commands =
- black --check ./
- flake8 music_assistant tests
- pylint music_assistant tests
- pydocstyle music_assistant tests
-deps =
- -rrequirements_lint.txt
- -rrequirements_test.txt
-
-[testenv:mypy]
-basepython = python3
-ignore_errors = True
-commands =
- mypy music_assistant
-deps =
- -rrequirements_lint.txt
\ No newline at end of file