Skip to content

Commit 7803438

Browse files
authored
Merge pull request #381 from jodal/tooling
Tooling upgrades
2 parents 4d0dc06 + fbfb1fe commit 7803438

32 files changed

+621
-754
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,38 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
include:
15-
- name: "Test: Python 3.9"
16-
python: "3.9"
17-
tox: py39
18-
- name: "Test: Python 3.10"
19-
python: "3.10"
20-
tox: py310
2115
- name: "Test: Python 3.11"
2216
python: "3.11"
2317
tox: py311
18+
- name: "Test: Python 3.12"
19+
python: "3.12"
20+
tox: py312
2421
coverage: true
25-
- name: "Lint: check-manifest"
26-
python: "3.11"
27-
tox: check-manifest
28-
- name: "Lint: flake8"
29-
python: "3.11"
30-
tox: flake8
22+
- name: "Lint: ruff lint"
23+
python: "3.12"
24+
tox: ruff-lint
25+
- name: "Lint: ruff format"
26+
python: "3.12"
27+
tox: ruff-format
3128

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

3633
steps:
37-
- uses: actions/checkout@v3
34+
- uses: actions/checkout@v4
3835
- name: Fix home dir permissions to enable pip caching
3936
run: chown -R root /github/home
40-
- uses: actions/setup-python@v4
37+
- uses: actions/setup-python@v5
4138
with:
4239
python-version: ${{ matrix.python }}
4340
cache: pip
44-
cache-dependency-path: setup.cfg
4541
- run: python -m pip install pygobject tox
4642
- run: python -m tox -e ${{ matrix.tox }}
4743
if: ${{ ! matrix.coverage }}
4844
- run: python -m tox -e ${{ matrix.tox }} -- --cov-report=xml
4945
if: ${{ matrix.coverage }}
50-
- uses: codecov/codecov-action@v3
46+
- uses: codecov/codecov-action@v4
5147
if: ${{ matrix.coverage }}
48+
with:
49+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/release.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ jobs:
99
runs-on: ubuntu-22.04
1010

1111
steps:
12-
- uses: actions/checkout@v3
13-
- uses: actions/setup-python@v4
14-
with:
15-
python-version: "3.11"
16-
- name: "Install dependencies"
17-
run: python3 -m pip install build
18-
- name: "Build package"
19-
run: python3 -m build
20-
- uses: pypa/gh-action-pypi-publish@v1.8.1
21-
with:
22-
password: ${{ secrets.PYPI_TOKEN }}
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v5
14+
with:
15+
python-version: "3.12"
16+
- name: "Install dependencies"
17+
run: python3 -m pip install build
18+
- name: "Build package"
19+
run: python3 -m build
20+
- uses: pypa/gh-action-pypi-publish@release/v1
21+
with:
22+
password: ${{ secrets.PYPI_TOKEN }}

.gitignore

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
*.egg-info
12
*.pyc
2-
/.coverage
3-
/.mypy_cache/
4-
/.pytest_cache/
5-
/.tox/
6-
/*.egg-info
7-
/build/
8-
/dist/
9-
/MANIFEST
3+
.coverage
4+
.mypy_cache/
5+
.pytest_cache/
6+
.tox/
7+
build/
8+
dist/

MANIFEST.in

Lines changed: 0 additions & 14 deletions
This file was deleted.

pyproject.toml

Lines changed: 107 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,112 @@
11
[build-system]
2-
requires = ["setuptools >= 30.3.0", "wheel"]
2+
requires = ["setuptools >= 66", "setuptools-scm >= 7.1"]
3+
build-backend = "setuptools.build_meta"
34

45

5-
[tool.black]
6-
target-version = ["py39", "py310", "py311"]
7-
line-length = 80
6+
[project]
7+
name = "Mopidy-Spotify"
8+
description = "Mopidy extension for playing music from Spotify"
9+
readme = "README.rst"
10+
requires-python = ">= 3.11"
11+
license = { text = "Apache-2.0" }
12+
authors = [{ name = "Stein Magnus Jodal", email = "[email protected]" }]
13+
maintainers = [{ name = "Nick Steel", email = "[email protected]" }]
14+
classifiers = [
15+
"Environment :: No Input/Output (Daemon)",
16+
"Intended Audience :: End Users/Desktop",
17+
"License :: OSI Approved :: Apache Software License",
18+
"Operating System :: OS Independent",
19+
"Programming Language :: Python :: 3",
20+
"Programming Language :: Python :: 3.11",
21+
"Programming Language :: Python :: 3.12",
22+
"Topic :: Multimedia :: Sound/Audio :: Players",
23+
]
24+
dynamic = ["version"]
25+
dependencies = [
26+
"mopidy >= 3.4.0",
27+
"pykka >= 4.0",
28+
"requests >= 2.20.0",
29+
"setuptools >= 66",
30+
]
831

32+
[project.optional-dependencies]
33+
lint = ["ruff"]
34+
test = ["pytest", "pytest-cov", "responses"]
35+
typing = []
36+
dev = ["mopidy-spotify[lint,test,typing]", "tox"]
937

10-
[tool.isort]
11-
multi_line_output = 3
12-
include_trailing_comma = true
13-
force_grid_wrap = 0
14-
use_parentheses = true
15-
line_length = 88
16-
known_tests = "tests"
17-
sections = "FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,TESTS,LOCALFOLDER"
38+
[project.urls]
39+
Source = "https://github.com/mopidy/mopidy-spotify"
40+
Issues = "https://github.com/mopidy/mopidy-spotify/issues"
41+
42+
[project.entry-points."mopidy.ext"]
43+
spotify = "mopidy_spotify:Extension"
44+
45+
46+
[tool.ruff]
47+
target-version = "py311"
48+
49+
[tool.ruff.lint]
50+
select = [
51+
"A", # flake8-builtins
52+
"ANN", # flake8-annotations
53+
"ARG", # flake8-unused-arguments
54+
"B", # flake8-bugbear
55+
"C4", # flake8-comprehensions
56+
"C90", # mccabe
57+
"D", # pydocstyle
58+
"DTZ", # flake8-datetimez
59+
"E", # pycodestyle
60+
"ERA", # eradicate
61+
"F", # pyflakes
62+
"FBT", # flake8-boolean-trap
63+
"I", # isort
64+
"INP", # flake8-no-pep420
65+
"ISC", # flake8-implicit-str-concat
66+
"N", # pep8-naming
67+
"PGH", # pygrep-hooks
68+
"PIE", # flake8-pie
69+
"PLC", # pylint convention
70+
"PLE", # pylint error
71+
"PLR", # pylint refactor
72+
"PLW", # pylint warning
73+
"PT", # flake8-pytest-style
74+
"PTH", # flake8-use-pathlib
75+
"Q", # flake8-quotes
76+
"RET", # flake8-return
77+
"RSE", # flake8-raise
78+
"RUF", # ruff
79+
"SIM", # flake8-simplify
80+
"SLF", # flake8-self
81+
"T20", # flake8-print
82+
"TCH", # flake8-type-checking
83+
"TID", # flake8-tidy-imports
84+
"TRY", # tryceratops
85+
"UP", # pyupgrade
86+
"W", # pycodestyle
87+
]
88+
ignore = [
89+
"ANN", # flake8-annotations # TODO: Add types
90+
"ANN101", # missing-type-self
91+
"ANN102", # missing-type-cls
92+
"ANN401", # any-type
93+
"D", # pydocstyle
94+
"ISC001", # single-line-implicit-string-concatenation
95+
"SLF001", # private-member-access
96+
"TRY003", # raise-vanilla-args
97+
]
98+
99+
[tool.ruff.lint.per-file-ignores]
100+
"tests/*" = [
101+
"ANN", # flake8-annotations
102+
"ARG", # flake8-unused-arguments
103+
"D", # pydocstyle
104+
"FBT", # flake8-boolean-trap
105+
"PLR0913", # too-many-arguments
106+
"PLR2004", # magic-value-comparison
107+
"PT027", # pytest-unittest-raises-assertion
108+
"TRY002", # raise-vanilla-class
109+
]
110+
111+
112+
[tool.setuptools_scm]

setup.cfg

Lines changed: 0 additions & 84 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

mopidy_spotify/__init__.py renamed to src/mopidy_spotify/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import pathlib
2+
from importlib.metadata import version
23

3-
import pkg_resources
44
from mopidy import config, ext
55

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

88

99
class Extension(ext.Extension):

mopidy_spotify/backend.py renamed to src/mopidy_spotify/backend.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,4 @@ def on_source_setup(self, source):
5050
source.set_property("cache-credentials", self._credentials_dir)
5151
if self._config["allow_cache"]:
5252
source.set_property("cache-files", self._cache_location)
53-
source.set_property(
54-
"cache-max-size", self._config["cache_size"] * 1048576
55-
)
53+
source.set_property("cache-max-size", self._config["cache_size"] * 1048576)

0 commit comments

Comments
 (0)