Implementing cookiecutter
This commit is contained in:
134
.circleci/config.yml
Normal file → Executable file
134
.circleci/config.yml
Normal file → Executable file
@ -1,89 +1,51 @@
|
|||||||
version: 2
|
version: 2.1
|
||||||
jobs:
|
|
||||||
build:
|
orbs:
|
||||||
docker:
|
codecov: codecov/codecov@1.0.5
|
||||||
- image: nikolaik/python-nodejs:python2.7-nodejs11
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- restore_cache:
|
|
||||||
keys:
|
|
||||||
- v1-dependencies-{{ checksum "VERSION.md" }}
|
|
||||||
- run:
|
|
||||||
name: Install npm dependencies
|
|
||||||
command: npm install
|
|
||||||
- run:
|
|
||||||
name: Build code
|
|
||||||
command: npm run build:prod
|
|
||||||
- run:
|
|
||||||
name: Install python dependencies
|
|
||||||
command: pip install -e .
|
|
||||||
- save_cache:
|
|
||||||
paths:
|
|
||||||
- node_modules
|
|
||||||
- mopidy_iris
|
|
||||||
key: v1-dependencies-{{ checksum "VERSION.md" }}
|
|
||||||
test:
|
|
||||||
docker:
|
|
||||||
- image: nikolaik/python-nodejs:python2.7-nodejs11
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- restore_cache:
|
|
||||||
keys:
|
|
||||||
- v1-dependencies-{{ checksum "VERSION.md" }}
|
|
||||||
- run:
|
|
||||||
name: Run tests
|
|
||||||
command: npm run test
|
|
||||||
deploy:
|
|
||||||
docker:
|
|
||||||
- image: nikolaik/python-nodejs:python2.7-nodejs11
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- restore_cache:
|
|
||||||
keys:
|
|
||||||
- v1-dependencies-{{ checksum "VERSION.md" }}
|
|
||||||
- run:
|
|
||||||
name: Prepare .pypirc
|
|
||||||
command: |
|
|
||||||
echo -e "[distutils]" >> ~/.pypirc
|
|
||||||
echo -e "index-servers =" >> ~/.pypirc
|
|
||||||
echo -e " pypi" >> ~/.pypirc
|
|
||||||
echo -e "[distutils]" >> ~/.pypirc
|
|
||||||
echo -e "[pypi]" >> ~/.pypirc
|
|
||||||
echo -e "username = jaedb" >> ~/.pypirc
|
|
||||||
echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc
|
|
||||||
- run:
|
|
||||||
name: Create and distribute package to pypi
|
|
||||||
command: python setup.py sdist upload -r pypi
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
build_and_test:
|
test:
|
||||||
jobs:
|
jobs:
|
||||||
- build:
|
- py38
|
||||||
filters:
|
- py37
|
||||||
branches:
|
- black
|
||||||
only: deploy/test
|
- check-manifest
|
||||||
- test:
|
- flake8
|
||||||
requires:
|
|
||||||
- build
|
jobs:
|
||||||
filters:
|
py38: &test-template
|
||||||
branches:
|
docker:
|
||||||
only: deploy/test
|
- image: mopidy/ci-python:3.8
|
||||||
build_test_and_deploy:
|
steps:
|
||||||
jobs:
|
- checkout
|
||||||
- build:
|
- restore_cache:
|
||||||
filters:
|
name: Restoring tox cache
|
||||||
branches:
|
key: tox-v1-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.cfg" }}
|
||||||
only: deploy/release
|
- run:
|
||||||
- test:
|
name: Run tests
|
||||||
requires:
|
command: |
|
||||||
- build
|
tox -e $CIRCLE_JOB -- \
|
||||||
filters:
|
--junit-xml=test-results/pytest/results.xml \
|
||||||
branches:
|
--cov-report=xml
|
||||||
only: deploy/release
|
- save_cache:
|
||||||
- deploy:
|
name: Saving tox cache
|
||||||
requires:
|
key: tox-v1-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.cfg" }}
|
||||||
- build
|
paths:
|
||||||
- test
|
- ./.tox
|
||||||
filters:
|
- ~/.cache/pip
|
||||||
branches:
|
- codecov/upload:
|
||||||
only: deploy/release
|
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
|
||||||
|
|||||||
17
pyproject.toml
Executable file
17
pyproject.toml
Executable 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"
|
||||||
88
setup.cfg
88
setup.cfg
@ -1,5 +1,85 @@
|
|||||||
[wheel]
|
|
||||||
universal = 1
|
|
||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
description-file = README.md
|
name = Mopidy-Iris
|
||||||
|
version = 3.0.0
|
||||||
|
url = https://github.com/jaedb/mopidy-iris
|
||||||
|
author = James Barnsley
|
||||||
|
author_email = james@barnsley.nz
|
||||||
|
license = Apache License, Version 2.0
|
||||||
|
license_file = LICENSE
|
||||||
|
description = Fully-featured Mopidy frontend client
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
[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 =
|
||||||
|
iris = mopidy_iris:Extension
|
||||||
|
|
||||||
|
|
||||||
|
[flake8]
|
||||||
|
application-import-names = mopidy_iris, 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
|
||||||
|
|||||||
42
setup.py
42
setup.py
@ -1,41 +1,3 @@
|
|||||||
from __future__ import unicode_literals
|
from setuptools import setup
|
||||||
|
|
||||||
import re
|
setup()
|
||||||
from setuptools import setup, find_packages
|
|
||||||
|
|
||||||
def get_version(filename):
|
|
||||||
content = open(filename).read()
|
|
||||||
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", content))
|
|
||||||
return metadata['version']
|
|
||||||
|
|
||||||
setup(
|
|
||||||
name='Mopidy-Iris',
|
|
||||||
version=get_version('mopidy_iris/__init__.py'),
|
|
||||||
url='https://github.com/jaedb/iris',
|
|
||||||
license='Apache License, Version 2.0',
|
|
||||||
author='James Barnsley',
|
|
||||||
author_email='james@barnsley.nz',
|
|
||||||
description='A fully-functional Mopidy web client encompassing Spotify and many other backends',
|
|
||||||
packages=find_packages(),
|
|
||||||
zip_safe=False,
|
|
||||||
include_package_data=True,
|
|
||||||
install_requires=[
|
|
||||||
'setuptools >= 3.3',
|
|
||||||
'Mopidy >= 2.0',
|
|
||||||
'ConfigObj >= 5.0.6',
|
|
||||||
'requests >= 2.0.0'
|
|
||||||
],
|
|
||||||
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',
|
|
||||||
'Topic :: Multimedia :: Sound/Audio :: Players',
|
|
||||||
],
|
|
||||||
entry_points={
|
|
||||||
'mopidy.ext': [
|
|
||||||
'iris = mopidy_iris:Extension',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|||||||
0
tests/__init__.py
Executable file
0
tests/__init__.py
Executable file
24
tests/test_extension.py
Executable file
24
tests/test_extension.py
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
from mopidy_iris import Extension
|
||||||
|
from mopidy_iris import frontend as frontend_lib
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_default_config():
|
||||||
|
ext = Extension()
|
||||||
|
|
||||||
|
config = ext.get_default_config()
|
||||||
|
|
||||||
|
assert "[iris]" in config
|
||||||
|
assert "enabled = true" in config
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_config_schema():
|
||||||
|
ext = Extension()
|
||||||
|
|
||||||
|
schema = ext.get_config_schema()
|
||||||
|
|
||||||
|
# TODO Test the content of your config schema
|
||||||
|
# assert "username" in schema
|
||||||
|
# assert "password" in schema
|
||||||
|
|
||||||
|
|
||||||
|
# TODO Write more tests
|
||||||
23
tox.ini
Executable file
23
tox.ini
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
[tox]
|
||||||
|
envlist = py37, py38, black, check-manifest, flake8
|
||||||
|
|
||||||
|
[testenv]
|
||||||
|
sitepackages = true
|
||||||
|
deps = .[test]
|
||||||
|
commands =
|
||||||
|
python -m pytest \
|
||||||
|
--basetemp={envtmpdir} \
|
||||||
|
--cov=mopidy_iris --cov-report=term-missing \
|
||||||
|
{posargs}
|
||||||
|
|
||||||
|
[testenv:black]
|
||||||
|
deps = .[lint]
|
||||||
|
commands = python -m black --check .
|
||||||
|
|
||||||
|
[testenv:check-manifest]
|
||||||
|
deps = .[lint]
|
||||||
|
commands = python -m check_manifest
|
||||||
|
|
||||||
|
[testenv:flake8]
|
||||||
|
deps = .[lint]
|
||||||
|
commands = python -m flake8 --show-source --statistics
|
||||||
Reference in New Issue
Block a user