Skip to content

Commit

Permalink
Merge pull request #381 from jodal/tooling
Browse files Browse the repository at this point in the history
Tooling upgrades
  • Loading branch information
jodal authored Mar 1, 2024
2 parents 4d0dc06 + fbfb1fe commit 7803438
Show file tree
Hide file tree
Showing 32 changed files with 621 additions and 754 deletions.
30 changes: 14 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,38 @@ 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
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.12"
tox: ruff-lint
- name: "Lint: ruff format"
python: "3.12"
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 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 }}
22 changes: 11 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ jobs:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: "Install dependencies"
run: python3 -m pip install build
- name: "Build package"
run: python3 -m build
- uses: pypa/gh-action-pypi-publish@v1.8.1
with:
password: ${{ secrets.PYPI_TOKEN }}
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: "Install dependencies"
run: python3 -m pip install build
- name: "Build package"
run: python3 -m build
- uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
15 changes: 7 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
*.egg-info
*.pyc
/.coverage
/.mypy_cache/
/.pytest_cache/
/.tox/
/*.egg-info
/build/
/dist/
/MANIFEST
.coverage
.mypy_cache/
.pytest_cache/
.tox/
build/
dist/
14 changes: 0 additions & 14 deletions MANIFEST.in

This file was deleted.

119 changes: 107 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,112 @@
[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-Spotify"
description = "Mopidy extension for playing music from Spotify"
readme = "README.rst"
requires-python = ">= 3.11"
license = { text = "Apache-2.0" }
authors = [{ name = "Stein Magnus Jodal", email = "[email protected]" }]
maintainers = [{ name = "Nick Steel", 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",
"Topic :: Multimedia :: Sound/Audio :: Players",
]
dynamic = ["version"]
dependencies = [
"mopidy >= 3.4.0",
"pykka >= 4.0",
"requests >= 2.20.0",
"setuptools >= 66",
]

[project.optional-dependencies]
lint = ["ruff"]
test = ["pytest", "pytest-cov", "responses"]
typing = []
dev = ["mopidy-spotify[lint,test,typing]", "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-spotify"
Issues = "https://github.com/mopidy/mopidy-spotify/issues"

[project.entry-points."mopidy.ext"]
spotify = "mopidy_spotify:Extension"


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

[tool.ruff.lint]
select = [
"A", # flake8-builtins
"ANN", # flake8-annotations
"ARG", # flake8-unused-arguments
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"C90", # mccabe
"D", # pydocstyle
"DTZ", # flake8-datetimez
"E", # pycodestyle
"ERA", # eradicate
"F", # pyflakes
"FBT", # flake8-boolean-trap
"I", # isort
"INP", # flake8-no-pep420
"ISC", # flake8-implicit-str-concat
"N", # pep8-naming
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PLC", # pylint convention
"PLE", # pylint error
"PLR", # pylint refactor
"PLW", # pylint warning
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"Q", # flake8-quotes
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # ruff
"SIM", # flake8-simplify
"SLF", # flake8-self
"T20", # flake8-print
"TCH", # flake8-type-checking
"TID", # flake8-tidy-imports
"TRY", # tryceratops
"UP", # pyupgrade
"W", # pycodestyle
]
ignore = [
"ANN", # flake8-annotations # TODO: Add types
"ANN101", # missing-type-self
"ANN102", # missing-type-cls
"ANN401", # any-type
"D", # pydocstyle
"ISC001", # single-line-implicit-string-concatenation
"SLF001", # private-member-access
"TRY003", # raise-vanilla-args
]

[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
"PT027", # pytest-unittest-raises-assertion
"TRY002", # raise-vanilla-class
]


[tool.setuptools_scm]
84 changes: 0 additions & 84 deletions setup.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions setup.py

This file was deleted.

4 changes: 2 additions & 2 deletions mopidy_spotify/__init__.py → src/mopidy_spotify/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import pathlib
from importlib.metadata import version

import pkg_resources
from mopidy import config, ext

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


class Extension(ext.Extension):
Expand Down
4 changes: 1 addition & 3 deletions mopidy_spotify/backend.py → src/mopidy_spotify/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,4 @@ def on_source_setup(self, source):
source.set_property("cache-credentials", self._credentials_dir)
if self._config["allow_cache"]:
source.set_property("cache-files", self._cache_location)
source.set_property(
"cache-max-size", self._config["cache_size"] * 1048576
)
source.set_property("cache-max-size", self._config["cache_size"] * 1048576)
Loading

0 comments on commit 7803438

Please sign in to comment.