Skip to content

Commit

Permalink
freshen up a bit
Browse files Browse the repository at this point in the history
- Support Python 3.5, stop supporting Python 3.2 (several dependencies don't support it)
- Stop using deprecated Sphinx theme
- Upgrade dependencies
- Let slumber > 0.7 handle data serialization in Python > 3.2
  • Loading branch information
brad committed Oct 2, 2015
1 parent a5c9561 commit f0ff4ca
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 33 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -8,4 +8,5 @@ misfit.egg-info
__pycache__
*.pyc
*.egg
.eggs
docs/_build
8 changes: 5 additions & 3 deletions .travis.yml
@@ -1,10 +1,12 @@
language: python
python: 3.4
python: 3.5
env:
- TOX_ENV=pypy
# Avoid testing pypy on travis until the following issue is fixed:
# https://github.com/travis-ci/travis-ci/issues/4756
# - TOX_ENV=pypy
- TOX_ENV=py35
- TOX_ENV=py34
- TOX_ENV=py33
- TOX_ENV=py32
- TOX_ENV=py27
- TOX_ENV=py26
- TOX_ENV=docs
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Expand Up @@ -108,7 +108,7 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
html_theme = 'alabaster'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down
10 changes: 1 addition & 9 deletions misfit/misfit.py
Expand Up @@ -6,27 +6,19 @@
from oauthlib.oauth2 import Client
from requests_oauthlib import OAuth2
from slumber.exceptions import HttpClientError, HttpServerError
from slumber.serialize import Serializer, JsonSerializer

from .exceptions import MisfitException, MisfitHttpException

API_URL = 'https://api.misfitwearables.com/'


class MisfitSerializer(JsonSerializer):
""" Override the built-in JSON serializer to handle bytes """
def loads(self, data):
return json.loads(data.decode('utf8'))


class Misfit:
def __init__(self, client_id, client_secret, access_token, user_id=None):
auth = OAuth2(client_id, Client(client_id),
{'access_token': access_token})
user = user_id if user_id else 'me'
s = Serializer(default="json", serializers=[MisfitSerializer()])
self.api = slumber.API('%smove/resource/v1/user/%s/' % (API_URL, user),
auth=auth, serializer=s)
auth=auth)

def profile(self, object_id=None):
return MisfitProfile(self._get_object(self.api.profile, object_id))
Expand Down
14 changes: 7 additions & 7 deletions requirements/base.txt
@@ -1,7 +1,7 @@
arrow>=0.4.0,<0.5.0
cryptography>=0.7,<0.8
CherryPy>=3.6.0,<3.7.0
docopt>=0.6.0,<0.7.0
requests-oauthlib>=0.4.0,<0.5.0
six>=1.8.0,<1.9.0
slumber>=0.6.0,<0.7.0
arrow>0.5.4,<0.7
cryptography>=0.7,<1.1
CherryPy>=3.6,<3.9
docopt>=0.6,<0.7
requests-oauthlib>=0.4,<0.6
six>=1.8,<1.10
slumber>=0.7,<0.8
2 changes: 1 addition & 1 deletion requirements/dev.txt
@@ -1,4 +1,4 @@
-r base.txt
-r test.txt

tox>=1.8.0,<1.9.0
tox>=2.0,<2.2
14 changes: 7 additions & 7 deletions requirements/test.txt
@@ -1,7 +1,7 @@
coverage>=3.7.0,<3.8.0
freezegun>=0.2.3,<0.4.0
httmock>=1.2.0,<1.3.0
mock>=1.0.0,<1.1.0
nose>=1.3.0,<1.4.0
sphinx>=1.2,<1.3
unittest2>=0.8.0,<0.9.0
coverage>=3.7,<4.1
freezegun>=0.2.3,<0.4
httmock>=1.2,<1.3
mock>=1.0,<1.4
nose>=1.3,<1.4
sphinx>=1.2,<1.4
unittest2>=0.8,<1.2
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -39,9 +39,9 @@
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: Implementation :: PyPy'
),
)
8 changes: 4 additions & 4 deletions tox.ini
@@ -1,5 +1,5 @@
[tox]
envlist = pypy,py34,py33,py32,py27,py26,docs
envlist = pypy,py35,py34,py33,py27,py26,docs

[testenv]
commands = coverage run --source=misfit setup.py test
Expand All @@ -8,15 +8,15 @@ deps = -r{toxinidir}/requirements/test.txt
[testenv:pypy]
basepython = pypy

[testenv:py35]
basepython = python3.5

[testenv:py34]
basepython = python3.4

[testenv:py33]
basepython = python3.3

[testenv:py32]
basepython = python3.2

[testenv:py27]
basepython = python2.7

Expand Down

0 comments on commit f0ff4ca

Please sign in to comment.