Skip to content

Commit

Permalink
Merge pull request #80 from jodal/tooling
Browse files Browse the repository at this point in the history
Tooling upgrades
  • Loading branch information
jodal authored Nov 10, 2024
2 parents c12d208 + f2568ad commit f3b1c61
Show file tree
Hide file tree
Showing 34 changed files with 383 additions and 380 deletions.
35 changes: 18 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,41 @@ jobs:
fail-fast: false
matrix:
include:
- name: "Test: Python 3.9"
python: "3.9"
tox: py39
- name: "Test: Python 3.10"
python: "3.10"
tox: py310
- name: "Test: Python 3.11"
python: "3.11"
tox: py311
- name: "Test: Python 3.12"
python: "3.12"
tox: py312
- name: "Test: Python 3.13"
python: "3.13"
tox: py313
coverage: true
- name: "Lint: check-manifest"
python: "3.11"
tox: check-manifest
- name: "Lint: flake8"
python: "3.11"
tox: flake8
- name: "Lint: ruff lint"
python: "3.13"
tox: ruff-lint
- name: "Lint: ruff format"
python: "3.13"
tox: ruff-format

name: ${{ matrix.name }}
runs-on: ubuntu-22.04
container: ghcr.io/mopidy/ci:latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Fix home dir permissions to enable pip caching
run: chown -R root /github/home
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: pip
cache-dependency-path: setup.cfg
- run: python -m pip install pygobject tox
- run: python -m pip install tox
- run: python -m tox -e ${{ matrix.tox }}
if: ${{ ! matrix.coverage }}
- run: python -m tox -e ${{ matrix.tox }} -- --cov-report=xml
if: ${{ matrix.coverage }}
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v4
if: ${{ matrix.coverage }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*.egg-info
*.pyc
/*.egg-info
/.coverage
/.mypy_cache/
/.pytest_cache/
Expand Down
100 changes: 88 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,93 @@
[build-system]
requires = ["setuptools >= 30.3.0", "wheel"]
requires = ["setuptools >= 66", "setuptools-scm >= 7.1"]
build-backend = "setuptools.build_meta"


[tool.black]
target-version = ["py39", "py310", "py311"]
line-length = 80
[project]
name = "mopidy-local"
description = "Mopidy extension for playing music from your local music archive"
readme = "README.rst"
requires-python = ">= 3.11"
license = { text = "Apache-2.0" }
authors = [{ name = "Stein Magnus Jodal", email = "[email protected]" }]
classifiers = [
"Environment :: No Input/Output (Daemon)",
"Intended Audience :: End Users/Desktop",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Multimedia :: Sound/Audio :: Players",
]
dynamic = ["version"]
dependencies = [
"mopidy >= 4.0.0a1",
"pykka >= 2.0.1",
"setuptools >= 66",
"uritools >= 1.0",
]

[project.optional-dependencies]
lint = ["ruff >= 0.5"]
test = ["pytest", "pytest-cov"]
dev = ["mopidy-local[lint,test]", "tox"]

[tool.isort]
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
line_length = 88
known_tests = "tests"
sections = "FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,TESTS,LOCALFOLDER"
[project.urls]
Source = "https://github.com/mopidy/mopidy-local"
Issues = "https://github.com/mopidy/mopidy-local/issues"

[project.entry-points."mopidy.ext"]
local = "mopidy_local:Extension"


[tool.ruff]
target-version = "py311"

[tool.ruff.lint]
select = ["ALL"]
ignore = [
"ANN", # flake8-annotations # TODO
"ANN101", # missing-type-self
"ANN102", # missing-type-cls
"ANN401", # any-type
"BLE001", # blind-except # TODO
"D", # pydocstyle
"EM101", # raw-string-in-exception # TODO
"FIX001", # line-contains-fixme
"FIX002", # line-contains-todo
"G002", # logging-percent-format
"G004", # logging-f-string
"ISC001", # single-line-implicit-string-concatenation
"PTH123", # builtin-open # TODO
"RUF012", # mutable-class-default # TODO
"S101", # assert # TODO
"TD002", # missing-todo-author
"TD003", # missing-todo-link
"TRY003", # raise-vanilla-args
"TRY400", # error-instead-of-exception
"UP031", # printf-string-formatting # TODO
#
# These rules interfere with `ruff format`
"COM812", # missing-trailing-comma
"ISC001", # single-line-implicit-string-concatenation
]

[tool.ruff.lint.per-file-ignores]
"tests/*" = [
"ANN", # flake8-annotations
"ARG", # flake8-unused-arguments
"D", # pydocstyle
"FBT", # flake8-boolean-trap
"PLR0913", # too-many-arguments
"PLR2004", # magic-value-comparison
"PT011", # pytest-raises-too-broad # TODO
"PT027", # pytest-unittest-raises-assertion
"S101", # assert
"SLF001", # private-member-access
"TRY002", # raise-vanilla-class
]


[tool.setuptools_scm]
62 changes: 0 additions & 62 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,65 +1,3 @@
[metadata]
name = Mopidy-Local
version = 3.2.1
url = https://github.com/mopidy/mopidy-local
author = Stein Magnus Jodal
author_email = [email protected]
license = Apache License, Version 2.0
license_file = LICENSE
description = Mopidy extension for playing music from your local music archive
long_description = file: README.rst
classifiers =
Environment :: No Input/Output (Daemon)
Intended Audience :: End Users/Desktop
License :: OSI Approved :: Apache Software License
Operating System :: OS Independent
Programming Language :: Python :: 3
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Multimedia :: Sound/Audio :: Players


[options]
zip_safe = False
include_package_data = True
packages = find:
python_requires = >= 3.9
install_requires =
Mopidy >= 3.0.0
Pykka >= 2.0.1
setuptools
uritools >= 1.0


[options.extras_require]
lint =
black
check-manifest
flake8
flake8-black
flake8-bugbear
flake8-import-order
isort[pyproject]
test =
pytest
pytest-cov
dev =
%(lint)s
%(test)s


[options.packages.find]
exclude =
tests
tests.*


[options.entry_points]
mopidy.ext =
local = mopidy_local:Extension


[flake8]
application-import-names = mopidy_local, tests
max-line-length = 80
Expand Down
3 changes: 0 additions & 3 deletions setup.py

This file was deleted.

15 changes: 5 additions & 10 deletions mopidy_local/__init__.py → src/mopidy_local/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import pathlib

import pkg_resources
from importlib.metadata import version

from mopidy import config, ext

__version__ = pkg_resources.get_distribution("Mopidy-Local").version
__version__ = version("Mopidy-Local")


class Extension(ext.Extension):
Expand All @@ -23,9 +22,7 @@ def get_config_schema(self):
schema["data_dir"] = config.Deprecated()
schema["playlists_dir"] = config.Deprecated()
schema["tag_cache_file"] = config.Deprecated()
schema["scan_timeout"] = config.Integer(
minimum=1000, maximum=1000 * 60 * 60
)
schema["scan_timeout"] = config.Integer(minimum=1000, maximum=1000 * 60 * 60)
schema["scan_flush_threshold"] = config.Integer(minimum=0)
schema["scan_follow_symlinks"] = config.Boolean()
schema["included_file_extensions"] = config.List(optional=True)
Expand All @@ -40,16 +37,14 @@ def setup(self, registry):
from .actor import LocalBackend

registry.add("backend", LocalBackend)
registry.add(
"http:app", {"name": self.ext_name, "factory": self.webapp}
)
registry.add("http:app", {"name": self.ext_name, "factory": self.webapp})

def get_command(self):
from .commands import LocalCommand

return LocalCommand()

def webapp(self, config, core):
def webapp(self, config, core): # noqa: ARG002
from .web import ImageHandler, IndexHandler

image_dir = self.get_image_dir(config)
Expand Down
1 change: 0 additions & 1 deletion mopidy_local/actor.py → src/mopidy_local/actor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import logging

import pykka

from mopidy import backend

from mopidy_local import storage
Expand Down
Loading

0 comments on commit f3b1c61

Please sign in to comment.