Skip to content

Commit 8f89ae5

Browse files
committed
Merge pull request #119 from box/release
Additional changes for 1.4.2 release
2 parents 98f1b81 + 706f065 commit 8f89ae5

File tree

9 files changed

+72
-23
lines changed

9 files changed

+72
-23
lines changed

HISTORY.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,25 @@ Release History
66
Upcoming
77
++++++++
88

9+
1.4.2 (2016-02-23)
10+
++++++++++++++++++
11+
12+
- Make sure that ``__all__`` is only defined once, as a list of ``str``. Some
13+
programs (e.g. PyInstaller) naively parse __init__.py files, and if
14+
``__all__`` is defined twice, the second one will be ignored. This can cause
15+
``__all__`` to appear as a list of ``unicode`` on Python 2.
16+
- Create wheel with correct conditional dependencies and license file.
17+
- Change the ``license`` meta-data from the full license text, to just a short
18+
string, as specified in [1][2].
19+
20+
[1] <https://docs.python.org/3.5/distutils/setupscript.html#additional-meta-data>
21+
22+
[2] <https://www.python.org/dev/peps/pep-0459/#license>
23+
24+
- Include entire test/ directory in source distribution. test/__init__.py was
25+
previously missing.
26+
- Update documentation.
27+
928
1.4.1 (2016-02-11)
1029
++++++++++++++++++
1130

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
include README.rst LICENSE
2+
3+
recursive-include test *

README.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ instead use an instance of ``JWTAuth``.
301301
client_id='YOUR_CLIENT_ID',
302302
client_secret='YOUR_CLIENT_SECRET',
303303
enterprise_id='YOUR_ENTERPRISE_ID',
304+
jwt_key_id='YOUR_JWT_KEY_ID',
304305
rsa_private_key_file_sys_path='CERT.PEM',
305306
store_tokens=your_store_tokens_callback_method,
306307
)
@@ -322,14 +323,15 @@ These users can then be authenticated:
322323
.. code-block:: python
323324
324325
ned_auth = JWTAuth(
325-
client_id='YOUR_CLIENT_ID',
326-
client_secret='YOUR_CLIENT_SECRET',
327-
enterprise_id='YOUR_ENTERPRISE_ID',
328-
rsa_private_key_file_sys_path='CERT.PEM',
329-
store_tokens=your_store_tokens_callback_method,
330-
)
331-
ned_auth.authenticate_app_user(ned_stark_user)
332-
ned_client = Client(ned_auth)
326+
client_id='YOUR_CLIENT_ID',
327+
client_secret='YOUR_CLIENT_SECRET',
328+
enterprise_id='YOUR_ENTERPRISE_ID',
329+
jwt_key_id='YOUR_JWT_KEY_ID',
330+
rsa_private_key_file_sys_path='CERT.PEM',
331+
store_tokens=your_store_tokens_callback_method,
332+
)
333+
ned_auth.authenticate_app_user(ned_stark_user)
334+
ned_client = Client(ned_auth)
333335
334336
Requests made with ``ned_client`` (or objects returned from ``ned_client``'s methods)
335337
will be performed on behalf of the newly created app user.

boxsdk/exception.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ class BoxException(Exception):
99
Base class exception for all errors raised from the SDK.
1010
"""
1111
def __str__(self):
12+
# pylint:disable=no-member
13+
# <https://github.com/box/box-python-sdk/issues/117>
1214
return self.__unicode__().encode('utf-8') if PY2 else self.__unicode__()
1315

1416

setup.cfg

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@
22
# This flag says that the code is written to work on both Python 2 and Python
33
# 3. If at all possible, it is good practice to do this. If you cannot, you
44
# will need to generate wheels for each Python version that you support.
5-
universal=1
5+
universal=1
6+
7+
[metadata]
8+
license_file=LICENSE

setup.py

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
from __future__ import unicode_literals
44

5+
from codecs import open # pylint:disable=redefined-builtin
6+
from collections import defaultdict
57
from os.path import dirname, join
6-
import platform
78
import sys
8-
from sys import version_info
99

1010
from setuptools import setup, find_packages
1111
from setuptools.command.test import test as TestCommand
@@ -32,6 +32,8 @@
3232

3333

3434
class PyTest(TestCommand):
35+
# pylint:disable=attribute-defined-outside-init
36+
3537
user_options = [(b'pytest-args=', b'a', b"Arguments to pass to py.test")]
3638

3739
def initialize_options(self):
@@ -55,26 +57,45 @@ def main():
5557
install_requires = ['requests>=2.4.3', 'six>=1.4.0', 'requests-toolbelt>=0.4.0']
5658
redis_requires = ['redis>=2.10.3']
5759
jwt_requires = ['pyjwt>=1.3.0', 'cryptography>=0.9.2']
58-
if version_info < (3, 4):
59-
install_requires.append('enum34>=1.0.4')
60-
elif version_info < (2, 7):
61-
install_requires.append('ordereddict>=1.1')
60+
extra_requires = defaultdict(list)
61+
extra_requires.update({'jwt': jwt_requires, 'redis': redis_requires, 'all': jwt_requires + redis_requires})
62+
conditional_dependencies = {
63+
# Newer versions of pip and wheel, which support PEP 426, allow
64+
# environment markers for conditional dependencies to use operators
65+
# such as `<` and `<=` [1]. However, older versions of pip and wheel
66+
# only support PEP 345, which only allows operators `==` and `in` (and
67+
# their negations) along with string constants [2]. To get the widest
68+
# range of support, we'll only use the `==` operator, which means
69+
# explicitly listing all supported Python versions that need the extra
70+
# dependencies.
71+
#
72+
# [1] <https://www.python.org/dev/peps/pep-0426/#environment-markers>
73+
# [2] <https://www.python.org/dev/peps/pep-0345/#environment-markers>
74+
'enum34>=1.0.4': ['2.6', '2.7', '3.3'], # <'3.4'
75+
'ordereddict>=1.1': ['2.6'], # <'2.7'
76+
}
77+
for requirement, python_versions in conditional_dependencies.items():
78+
for python_version in python_versions:
79+
# <https://wheel.readthedocs.org/en/latest/#defining-conditional-dependencies>
80+
python_conditional = 'python_version=="{0}"'.format(python_version)
81+
key = ':{0}'.format(python_conditional)
82+
extra_requires[key].append(requirement)
6283
setup(
6384
name='boxsdk',
6485
version='1.4.2',
6586
description='Official Box Python SDK',
66-
long_description=open(join(base_dir, 'README.rst')).read(),
87+
long_description=open(join(base_dir, 'README.rst'), encoding='utf-8').read(),
6788
author='Box',
6889
author_email='[email protected]',
6990
url='http://opensource.box.com',
70-
packages=find_packages(exclude=['demo', 'docs', 'test']),
91+
packages=find_packages(exclude=['demo', 'docs', 'test', 'test*', '*test', '*test*']),
7192
install_requires=install_requires,
72-
extras_require={'jwt': jwt_requires, 'redis': redis_requires, 'all': jwt_requires + redis_requires},
93+
extras_require=extra_requires,
7394
tests_require=['pytest', 'pytest-xdist', 'mock', 'sqlalchemy', 'bottle', 'jsonpatch'],
7495
cmdclass={'test': PyTest},
7596
classifiers=CLASSIFIERS,
7697
keywords='box oauth2 sdk',
77-
license=open(join(base_dir, 'LICENSE')).read(),
98+
license='Apache Software License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0',
7899
)
79100

80101

test/functional/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import pytest
99
import requests
1010
import six
11-
from six.moves.urllib import parse # pylint:disable=import-error, no-name-in-module
11+
from six.moves.urllib import parse # pylint:disable=import-error, no-name-in-module,wrong-import-order
1212

1313
from boxsdk.auth.oauth2 import OAuth2
1414
from boxsdk.config import API

test/unit/auth/test_oauth2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from mock import Mock
1010
import pytest
11-
from six.moves.urllib import parse as urlparse # pylint:disable=import-error,no-name-in-module
11+
from six.moves.urllib import parse as urlparse # pylint:disable=import-error,no-name-in-module,wrong-import-order
1212

1313
from boxsdk.exception import BoxOAuthException
1414
from boxsdk.network.default_network import DefaultNetworkResponse

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ commands =
3333

3434
[testenv:pep8]
3535
commands =
36-
pep8 --ignore=E501,W292 boxsdk
36+
pep8 --ignore=E501,W292 boxsdk setup.py
3737
pep8 --ignore=E501,W292 test
3838
deps =
3939
pep8
4040

4141
[testenv:pylint]
4242
commands =
43-
pylint --rcfile=.pylintrc boxsdk
43+
pylint --rcfile=.pylintrc boxsdk setup.py
4444
# pylint:disable W0621(redefined-outer-name) - Using py.test fixtures always breaks this rule.
4545
pylint --rcfile=.pylintrc test -d W0621 --ignore=mock_box
4646
deps = -rrequirements-dev.txt

0 commit comments

Comments
 (0)