Skip to content

Commit

Permalink
Merge pull request #233 from kingosticks/python3
Browse files Browse the repository at this point in the history
Python3
  • Loading branch information
jodal committed Nov 18, 2019
2 parents 5eb11f2 + ef3d728 commit 76bc9bb
Show file tree
Hide file tree
Showing 38 changed files with 2,128 additions and 1,740 deletions.
51 changes: 51 additions & 0 deletions .circleci/config.yml
@@ -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
key: tox-v1-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.cfg" }}
- 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
key: tox-v1-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.cfg" }}
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
17 changes: 8 additions & 9 deletions .gitignore
@@ -1,10 +1,9 @@
*.egg-info
*.pyc
*.swp
.cache/
.coverage
.tox/
MANIFEST
build/
dist/
xunit-*.xml
/.coverage
/.mypy_cache/
/.pytest_cache/
/.tox/
/*.egg-info
/build/
/dist/
/MANIFEST
42 changes: 0 additions & 42 deletions .travis.yml

This file was deleted.

File renamed without changes.
14 changes: 10 additions & 4 deletions MANIFEST.in
@@ -1,10 +1,16 @@
include *.py
include *.rst
include *.txt
include .travis.yml
include .mailmap
include LICENSE
include MANIFEST.in
include mopidy_spotify/ext.conf
include mopidy_spotify/spotify_appkey.key
include pyproject.toml
include tox.ini

recursive-include .circleci *
recursive-include .github *

include mopidy_*/ext.conf
include mopidy_spotify/spotify_appkey.key

recursive-include tests *.py
recursive-include tests/data *
23 changes: 12 additions & 11 deletions README.rst
Expand Up @@ -2,20 +2,20 @@
Mopidy-Spotify
**************

.. image:: https://img.shields.io/pypi/v/Mopidy-Spotify.svg?style=flat
:target: https://pypi.python.org/pypi/Mopidy-Spotify/
.. image:: https://img.shields.io/pypi/v/Mopidy-Spotify
:target: https://pypi.org/project/Mopidy-Spotify/
:alt: Latest PyPI version

.. image:: https://img.shields.io/travis/mopidy/mopidy-spotify/develop.svg?style=flat
:target: https://travis-ci.org/mopidy/mopidy-spotify
:alt: Travis CI build status
.. image:: https://img.shields.io/circleci/gh/mopidy/mopidy-spotify
:target: https://circleci.com/gh/mopidy/mopidy-spotify
:alt: CircleCI build status

.. image:: https://img.shields.io/coveralls/mopidy/mopidy-spotify/develop.svg?style=flat
:target: https://coveralls.io/r/mopidy/mopidy-spotify
:alt: Test coverage
.. image:: https://img.shields.io/codecov/c/gh/mopidy/mopidy-spotify
:target: https://codecov.io/gh/mopidy/mopidy-spotify
:alt: Test coverage

`Mopidy <http://www.mopidy.com/>`_ extension for playing music from
`Spotify <http://www.spotify.com/>`_.
`Mopidy <https://www.mopidy.com/>`_ extension for playing music from
`Spotify <https://www.spotify.com/>`_.


Status
Expand Down Expand Up @@ -118,7 +118,7 @@ OS X: Install the ``mopidy-spotify`` package from the
Else: Install the dependencies listed above yourself, and then install the
package from PyPI::

pip install Mopidy-Spotify
python3 -m pip Mopidy-Spotify


Configuration
Expand Down Expand Up @@ -191,6 +191,7 @@ Project resources

- `Source code <https://github.com/mopidy/mopidy-spotify>`_
- `Issue tracker <https://github.com/mopidy/mopidy-spotify/issues>`_
- `Changelog <https://github.com/mopidy/mopidy-spotify/blob/master/CHANGELOG.rst>`_


Credits
Expand Down
4 changes: 0 additions & 4 deletions dev-requirements.txt

This file was deleted.

52 changes: 25 additions & 27 deletions mopidy_spotify/__init__.py
@@ -1,54 +1,52 @@
from __future__ import unicode_literals
import pathlib

import os
import pkg_resources

from mopidy import config, ext


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


class Extension(ext.Extension):

dist_name = 'Mopidy-Spotify'
ext_name = 'spotify'
dist_name = "Mopidy-Spotify"
ext_name = "spotify"
version = __version__

def get_default_config(self):
conf_file = os.path.join(os.path.dirname(__file__), 'ext.conf')
return config.read(conf_file)
return config.read(pathlib.Path(__file__).parent / "ext.conf")

def get_config_schema(self):
schema = super(Extension, self).get_config_schema()
schema = super().get_config_schema()

schema['username'] = config.String()
schema['password'] = config.Secret()
schema["username"] = config.String()
schema["password"] = config.Secret()

schema['client_id'] = config.String()
schema['client_secret'] = config.Secret()
schema["client_id"] = config.String()
schema["client_secret"] = config.Secret()

schema['bitrate'] = config.Integer(choices=(96, 160, 320))
schema['volume_normalization'] = config.Boolean()
schema['private_session'] = config.Boolean()
schema["bitrate"] = config.Integer(choices=(96, 160, 320))
schema["volume_normalization"] = config.Boolean()
schema["private_session"] = config.Boolean()

schema['timeout'] = config.Integer(minimum=0)
schema["timeout"] = config.Integer(minimum=0)

schema['cache_dir'] = config.Deprecated() # since 2.0
schema['settings_dir'] = config.Deprecated() # since 2.0
schema["cache_dir"] = config.Deprecated() # since 2.0
schema["settings_dir"] = config.Deprecated() # since 2.0

schema['allow_cache'] = config.Boolean()
schema['allow_network'] = config.Boolean()
schema['allow_playlists'] = config.Boolean()
schema["allow_cache"] = config.Boolean()
schema["allow_network"] = config.Boolean()
schema["allow_playlists"] = config.Boolean()

schema['search_album_count'] = config.Integer(minimum=0, maximum=200)
schema['search_artist_count'] = config.Integer(minimum=0, maximum=200)
schema['search_track_count'] = config.Integer(minimum=0, maximum=200)
schema["search_album_count"] = config.Integer(minimum=0, maximum=200)
schema["search_artist_count"] = config.Integer(minimum=0, maximum=200)
schema["search_track_count"] = config.Integer(minimum=0, maximum=200)

schema['toplist_countries'] = config.List(optional=True)
schema["toplist_countries"] = config.List(optional=True)

return schema

def setup(self, registry):
from mopidy_spotify.backend import SpotifyBackend

registry.add('backend', SpotifyBackend)
registry.add("backend", SpotifyBackend)

0 comments on commit 76bc9bb

Please sign in to comment.