Update project to match cookiecutter-mopidy-ext

remotes/origin/python3
Phil Howard 2019-11-21 18:09:05 +00:00
parent 6058b28934
commit d6df8e5726
9 changed files with 193 additions and 114 deletions

51
.circleci/config.yml Normal file
View File

@ -0,0 +1,51 @@
version: 2.1
orbs:
codecov: codecov/codecov@1.0.5
workflows:
version: 2
test:
jobs:
- py38
- py37
- black
- check-manifest
- flake8
jobs:
py38: &test-template
docker:
- image: mopidy/ci-python:3.8
steps:
- checkout
- restore_cache:
name: Restoring tox cache
{% raw %}key: tox-v1-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.cfg" }}{% endraw %}
- run:
name: Run tests
command: |
tox -e $CIRCLE_JOB -- \
--junit-xml=test-results/pytest/results.xml \
--cov-report=xml
- save_cache:
name: Saving tox cache
{% raw %}key: tox-v1-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.cfg" }}{% endraw %}
paths:
- ./.tox
- ~/.cache/pip
- codecov/upload:
file: coverage.xml
- store_test_results:
path: test-results
py37:
<<: *test-template
docker:
- image: mopidy/ci-python:3.7
black: *test-template
check-manifest: *test-template
flake8: *test-template

16
.gitignore vendored
View File

@ -1,9 +1,9 @@
*.egg-info
*.pyc *.pyc
.coverage /.coverage
.pytest_cache/ /.mypy_cache/
.tox/ /.pytest_cache/
MANIFEST /.tox/
build/ /*.egg-info
dist/ /build/
.vscode/ /dist/
/MANIFEST

View File

@ -1,28 +0,0 @@
language: python
python:
- "2.7"
virtualenv:
system_site_packages: true
addons:
apt:
sources:
- mopidy-stable
packages:
- mopidy
env:
- TOX_ENV=py27
- TOX_ENV=flake8
- TOX_ENV=check-manifest
install:
- pip install tox
script:
- tox -e $TOX_ENV
after_success:
- if [ $TOX_ENV == 'py27' ]; then pip install coveralls; coveralls; fi

View File

@ -1,9 +1,15 @@
include .travis.yml include *.py
include CHANGELOG.rst include *.rst
include .mailmap
include LICENSE include LICENSE
include MANIFEST.in include MANIFEST.in
include README.rst include pyproject.toml
include mopidy_raspberry_gpio/ext.conf
include tox.ini include tox.ini
recursive-include .circleci *
recursive-include .github *
include mopidy_*/ext.conf
recursive-include tests *.py recursive-include tests *.py
recursive-include tests/data *

View File

@ -2,17 +2,17 @@
Mopidy-Raspberry-GPIO Mopidy-Raspberry-GPIO
**************************** ****************************
.. image:: https://img.shields.io/pypi/v/Mopidy-Raspberry-GPIO.svg?style=flat .. image:: https://img.shields.io/pypi/v/Mopidy-Raspberry-GPIO.svg
:target: https://pypi.org/project/Mopidy-Raspberry-GPIO/ :target: https://pypi.org/project/Mopidy-Raspberry-GPIO/
:alt: Latest PyPI version :alt: Latest PyPI version
.. image:: https://img.shields.io/travis/pimoroni/mopidy-raspberry-gpio/master.svg?style=flat .. image:: https://img.shields.io/circleci/build/gh/pimoroni/mopidy-raspberry-gpio
:target: https://travis-ci.org/pimoroni/mopidy-raspberry-gpio :target: https://circleci.com/gh/pimoroni/mopidy-raspberry-gpio
:alt: Travis CI build status :alt: CircleCI build status
.. image:: https://img.shields.io/coveralls/pimoroni/mopidy-raspberry-gpio/master.svg?style=flat .. image:: https://img.shields.io/codecov/c/gh/pimoroni/mopidy-raspberry-gpio
:target: https://coveralls.io/r/pimoroni/mopidy-raspberry-gpio :target: https://codecov.io/gh/pimoroni/mopidy-raspberry-gpio
:alt: Test coverage :alt: Test coverage
Mopidy extension for GPIO input on a Raspberry Pi Mopidy extension for GPIO input on a Raspberry Pi
@ -22,7 +22,7 @@ Installation
Install by running:: Install by running::
pip install Mopidy-Raspberry-GPIO python3 -m pip install Mopidy-Raspberry-GPIO
Or, if available, install the Debian/Ubuntu package from `apt.mopidy.com Or, if available, install the Debian/Ubuntu package from `apt.mopidy.com
<https://apt.mopidy.com/>`_. <https://apt.mopidy.com/>`_.

17
pyproject.toml Normal file
View File

@ -0,0 +1,17 @@
[build-system]
requires = ["setuptools >= 30.3.0", "wheel"]
[tool.black]
target-version = ["py37", "py38"]
line-length = 80
[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"

View File

@ -1,6 +1,85 @@
[flake8] [metadata]
application-import-names = mopidy_raspberry_gpio,tests name = mopidy-raspberry-gpio
exclude = .git,.tox version = 0.0.2
url = https://github.com/pimoroni/mopidy-raspberry-gpio
author = Phil Howard
author_email = phil@pimoroni.com
license = Apache License, Version 2.0
license_file = LICENSE
description = Mopidy extension for GPIO input on a Raspberry Pi
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.7
Programming Language :: Python :: 3.8
Topic :: Multimedia :: Sound/Audio :: Players
[wheel]
universal = 1 [options]
zip_safe = False
include_package_data = True
packages = find:
python_requires = >= 3.7
install_requires =
Mopidy >= 3.0.0a4 # Change to >= 3.0 once final is released
Pykka >= 2.0.1
setuptools
[options.extras_require]
lint =
black
check-manifest
flake8
flake8-bugbear
flake8-import-order
isort[pyproject]
release =
twine
wheel
test =
pytest
pytest-cov
dev =
%(lint)s
%(release)s
%(test)s
[options.packages.find]
exclude =
tests
tests.*
[options.entry_points]
mopidy.ext =
raspberry-gpio = mopidy_raspberry_gpio:Extension
[flake8]
application-import-names = mopidy_raspberry_gpio, tests
max-line-length = 80
exclude = .git, .tox, build
select =
# Regular flake8 rules
C, E, F, W
# flake8-bugbear rules
B
# B950: line too long (soft speed limit)
B950
# pep8-naming rules
N
ignore =
# E203: whitespace before ':' (not PEP8 compliant)
E203
# E501: line too long (replaced by B950)
E501
# W503: line break before binary operator (not PEP8 compliant)
W503
# B305: .next() is not a thing on Python 3 (used by playback controller)
B305

View File

@ -1,45 +1,3 @@
from __future__ import unicode_literals from setuptools import setup
import re setup()
from setuptools import find_packages, setup
def get_version(filename):
with open(filename) as fh:
metadata = dict(re.findall('__([a-z]+)__ = "([^"]+)"', fh.read()))
return metadata["version"]
setup(
name="Mopidy-Raspberry-GPIO",
version=get_version("mopidy_raspberry_gpio/__init__.py"),
url="https://github.com/pimoroni/mopidy-raspberry-gpio",
license="Apache License, Version 2.0",
author="Phil Howard",
author_email="phil@pimoroni.com",
description="Mopidy extension for GPIO input on a Raspberry Pi",
long_description=open("README.rst").read(),
packages=find_packages(exclude=["tests", "tests.*"]),
zip_safe=False,
include_package_data=True,
python_requires="> 2.7, < 3",
install_requires=[
"setuptools",
"Mopidy >= 2.2",
"Pykka >= 2.0",
],
entry_points={
"mopidy.ext": [
"raspberry-gpio = mopidy_raspberry_gpio:Extension",
]
},
classifiers=[
"Environment :: No Input/Output (Daemon)",
"Intended Audience :: End Users/Desktop",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 2.7",
"Topic :: Multimedia :: Sound/Audio :: Players",
],
)

30
tox.ini
View File

@ -1,27 +1,23 @@
[tox] [tox]
envlist = py27, py27-flake8, py27-check-manifest envlist = py37, py38, black, check-manifest, flake8
[testenv] [testenv]
sitepackages = true sitepackages = true
deps = deps = .[test]
mock
pytest
pytest-cov
pytest-xdist
commands = commands =
pytest \ python -m pytest \
-v -r wsx \
--basetemp={envtmpdir} \ --basetemp={envtmpdir} \
--cov=mopidy_raspberry_gpio --cov-report=term-missing \ --cov=mopidy_raspberry_gpio --cov-report=term-missing \
{posargs} {posargs}
[testenv:py27-flake8] [testenv:black]
deps = deps = .[lint]
flake8 commands = python -m black --check .
flake8-import-order
skip_install = true
commands = python -m flake8
[testenv:py27-check-manifest] [testenv:check-manifest]
deps = check-manifest deps = .[lint]
commands = check-manifest commands = python -m check_manifest
[testenv:flake8]
deps = .[lint]
commands = python -m flake8 --show-source --statistics