Skip to content

Commit 1b320e4

Browse files
authored
Switch to pyproject and address linters (#162)
* Update all CI tooling and switch to pyproject * address lint issues found by new config * fix typo
1 parent 39aa091 commit 1b320e4

23 files changed

+290
-440
lines changed
Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,27 @@
1-
# This workflows will upload a Python Package using Twine when a release is created
2-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3-
4-
name: Upload Python Package
1+
name: Publish releases to PyPI
52

63
on:
74
release:
85
types: [published]
96

107
jobs:
11-
deploy:
12-
8+
build-and-publish:
9+
name: Builds and publishes releases to PyPI
1310
runs-on: ubuntu-latest
14-
1511
steps:
16-
- uses: actions/checkout@v3.5.2
17-
- name: Set up Python
18-
uses: actions/[email protected]
19-
with:
20-
python-version: '3.x'
21-
- name: Install dependencies
22-
run: |
23-
python -m pip install --upgrade pip
24-
pip install setuptools wheel twine
25-
- name: Build and publish
26-
env:
27-
TWINE_USERNAME: __token__
28-
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
29-
run: |
30-
python setup.py sdist bdist_wheel
31-
twine upload dist/*
12+
- uses: actions/checkout@v3.3.0
13+
- name: Set up Python 3.10
14+
uses: actions/[email protected]
15+
with:
16+
python-version: "3.10"
17+
- name: Install build
18+
run: >-
19+
pip install build
20+
- name: Build
21+
run: >-
22+
python3 -m build
23+
- name: Publish release to PyPI
24+
uses: pypa/[email protected]
25+
with:
26+
user: __token__
27+
password: ${{ secrets.PYPI_TOKEN }}

.github/workflows/test.yml

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will install Python dependencies, run tests and lint
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

4-
name: Test with Pre-commit
4+
name: Test
55

66
on:
77
push:
@@ -10,22 +10,43 @@ on:
1010
branches: [main]
1111

1212
jobs:
13-
build:
13+
lint:
1414
runs-on: ubuntu-latest
15+
continue-on-error: true
16+
17+
steps:
18+
- name: Check out code from GitHub
19+
uses: actions/[email protected]
20+
- name: Set up Python
21+
uses: actions/[email protected]
22+
with:
23+
python-version: "3.11"
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip build setuptools
27+
pip install . .[test]
28+
- name: Lint/test with pre-commit
29+
run: pre-commit run --all-files
30+
31+
test:
32+
runs-on: ubuntu-latest
33+
continue-on-error: true
1534
strategy:
35+
fail-fast: false
1636
matrix:
17-
python-version: ["3.9", "3.10"]
37+
python-version:
38+
- "3.11"
1839

1940
steps:
20-
- uses: actions/[email protected]
41+
- name: Check out code from GitHub
42+
uses: actions/[email protected]
2143
- name: Set up Python ${{ matrix.python-version }}
2244
uses: actions/[email protected]
2345
with:
2446
python-version: ${{ matrix.python-version }}
2547
- name: Install dependencies
2648
run: |
27-
python -m pip install --upgrade pip
28-
pip install -r requirements_dev.txt
29-
pre-commit install-hooks
30-
- name: Lint/test with pre-commit
31-
run: pre-commit run --all-files
49+
python -m pip install --upgrade pip build setuptools
50+
pip install .[test]
51+
- name: Pytest
52+
run: pytest --durations 10 --cov-report term-missing --cov=aioslimproto --cov-report=xml tests/

.pre-commit-config.yaml

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,47 @@
11
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: check-yaml
6+
- id: end-of-file-fixer
7+
- id: trailing-whitespace
8+
- id: no-commit-to-branch
9+
args:
10+
- --branch=main
11+
- id: debug-statements
12+
- repo: https://github.com/charliermarsh/ruff-pre-commit
13+
rev: 'v0.0.272'
14+
hooks:
15+
- id: ruff
216
- repo: https://github.com/psf/black
317
rev: 23.3.0
418
hooks:
519
- id: black
620
args:
721
- --safe
822
- --quiet
9-
- repo: https://github.com/PyCQA/flake8
10-
rev: 6.0.0
23+
- repo: https://github.com/codespell-project/codespell
24+
rev: v2.2.4
1125
hooks:
12-
- id: flake8
13-
exclude: ^examples/
26+
- id: codespell
27+
args: []
28+
exclude_types: [csv, json]
29+
exclude: ^tests/fixtures/
1430
additional_dependencies:
15-
- flake8-docstrings==1.6.0
16-
- repo: https://github.com/pre-commit/mirrors-isort
17-
rev: v5.10.1
18-
hooks:
19-
- id: isort
20-
exclude: ^examples/
21-
- repo: https://github.com/pre-commit/mirrors-mypy
22-
rev: v1.3.0
23-
hooks:
24-
- id: mypy
25-
additional_dependencies: [types-all]
26-
exclude: ^examples/
27-
- repo: https://github.com/pycqa/pydocstyle
28-
rev: 6.3.0
29-
hooks:
30-
- id: pydocstyle
31-
exclude: ^examples/|^.venv/|^.vscode/
32-
- repo: local
33-
hooks:
34-
- id: pylint
35-
name: pylint
36-
entry: script/run-in-env.sh pylint -j 0
37-
language: script
38-
types: [python]
39-
args: ["-rn", "-sn", "--rcfile=pylintrc", "--fail-on=I"]
40-
exclude: ^.venv/|^.vscode/|^tests/|example.py
31+
- tomli
32+
# TODO: enable pylint and mypy in follow up PR and fix the issues found
33+
# - repo: local
34+
# hooks:
35+
# - id: pylint
36+
# name: pylint
37+
# entry: script/run-in-env.sh pylint -j 0
38+
# language: script
39+
# types: [python]
40+
# files: ^aioslimproto/.+\.py$
41+
42+
# - id: mypy
43+
# name: mypy
44+
# entry: script/run-in-env.sh mypy
45+
# language: script
46+
# types: [python]
47+
# files: ^aioslimproto/.+\.py$

MANIFEST.in

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
include README.md
2-
include requirements.txt
1+
include *.txt
2+
include *.ttf
3+
include README.rst
34
include LICENSE
4-
include aioslimproto/font/
55
graft aioslimproto
6-
recursive-exclude * *.py[co]
6+
recursive-exclude * *.py[co]
7+
recursive-exclude * *.DS_Store

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ aioslimproto
88

99
SLIMProto implementation in async python allows you to control squeezebox players (and compatibles)
1010

11-
Requires Python 3.8+ and uses asyncio.
11+
Requires Python 3.10+ and uses asyncio.
1212

1313
For usage examples, see the examples folder.
14-

aioslimproto.code-workspace

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
],
1818
"compounds": []
1919
}
20-
}
20+
}

0 commit comments

Comments
 (0)