From 09efd9e589e639908563588fb47cfbd7039c7ba4 Mon Sep 17 00:00:00 2001 From: Hong Minhee Date: Wed, 21 Jun 2017 15:11:38 +0900 Subject: [PATCH 1/9] Upgrade pytest --- .travis.yml | 4 ++-- setup.py | 2 +- tox.ini | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index b85ce1f..446fad2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,8 +7,8 @@ install: - pip install -U pip setuptools docutils - pip install -e .[tests] script: - - py.test tests -v - - pip install 'typing<3.5.2' && py.test tests -v + - pytest tests -v + - pip install 'typing<3.5.2' && pytest tests -v - rst2html.py --strict CHANGES.rst - rst2html.py --strict README.rst - python setup.py --long-description | rst2html.py --strict diff --git a/setup.py b/setup.py index b6f78bb..83e56c0 100644 --- a/setup.py +++ b/setup.py @@ -39,7 +39,7 @@ def get_version(): 'six', 'iso8601', ] + service_requires tests_require = [ - 'pytest >= 2.9.0', + 'pytest >= 3.1.2, < 4.0.0', 'import-order', 'flake8', 'tox', diff --git a/tox.ini b/tox.ini index 314a28d..a81ccc3 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ envlist = py27,py34,py35,docs [testenv] deps = -e.[tests] commands= - py.test -v tests + pytest -v tests [testenv:docs] basepython = python3 From f977194e60ffa4a63b7983c67a0d0feb43200b87 Mon Sep 17 00:00:00 2001 From: Hong Minhee Date: Wed, 21 Jun 2017 15:17:42 +0900 Subject: [PATCH 2/9] Use pytest-flake8 --- .travis.yml | 4 ++-- setup.py | 3 +-- tests/func_test.py | 4 ++-- tox.ini | 8 +++++++- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 446fad2..de4e60b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,8 +7,8 @@ install: - pip install -U pip setuptools docutils - pip install -e .[tests] script: - - pytest tests -v - - pip install 'typing<3.5.2' && pytest tests -v + - pytest -v + - pip install 'typing<3.5.2' && pytest -v - rst2html.py --strict CHANGES.rst - rst2html.py --strict README.rst - python setup.py --long-description | rst2html.py --strict diff --git a/setup.py b/setup.py index 83e56c0..4a712cd 100644 --- a/setup.py +++ b/setup.py @@ -40,9 +40,8 @@ def get_version(): ] + service_requires tests_require = [ 'pytest >= 3.1.2, < 4.0.0', + 'pytest-flake8 >= 0.8.1, < 1.0.0', 'import-order', - 'flake8', - 'tox', ] docs_require = [ 'Sphinx', diff --git a/tests/func_test.py b/tests/func_test.py index c11f0d9..a212e9e 100644 --- a/tests/func_test.py +++ b/tests/func_test.py @@ -7,8 +7,8 @@ def test_import_string(): assert import_string('collections:OrderedDict') == collections.OrderedDict - assert import_string('collections:OrderedDict({"a": 1})') == \ - collections.OrderedDict({"a": 1}) + assert (import_string('collections:OrderedDict({"a": 1})') == + collections.OrderedDict({"a": 1})) with raises(ValueError): # malformed import_string('world') diff --git a/tox.ini b/tox.ini index a81ccc3..9a59a02 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ envlist = py27,py34,py35,docs [testenv] deps = -e.[tests] commands= - pytest -v tests + pytest -v [testenv:docs] basepython = python3 @@ -13,3 +13,9 @@ commands = rst2html.py --strict CHANGES.rst rst2html.py --strict README.rst python3 setup.py --long-description | rst2html.py --strict + +[pytest] +addopts = --ff --flake8 + +[flake8] +exclude = .env, .tox, tests/py2_nirum.py, tests/py3_nirum.py From 9c7cbf78ecc9776b1929303f85d56fcc88468a95 Mon Sep 17 00:00:00 2001 From: Hong Minhee Date: Wed, 21 Jun 2017 16:34:31 +0900 Subject: [PATCH 3/9] Make the source tree to pass flake8-import-order --- nirum/deserialize.py | 2 +- setup.py | 2 +- tests/compat_test.py | 1 + tests/deserialize_test.py | 4 ++-- tests/py2_nirum.py | 12 ++++++------ tests/py3_nirum.py | 12 ++++++------ tests/rpc_test.py | 3 +-- tests/serialize_test.py | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/nirum/deserialize.py b/nirum/deserialize.py index 607f579..fe2173d 100644 --- a/nirum/deserialize.py +++ b/nirum/deserialize.py @@ -13,8 +13,8 @@ from iso8601 import iso8601, parse_date from six import text_type -from .datastructures import Map from ._compat import get_tuple_param_types, get_union_types, is_union_type +from .datastructures import Map __all__ = ( 'deserialize_abstract_type', diff --git a/setup.py b/setup.py index 4a712cd..330d60a 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ import re import sys -from setuptools import find_packages, setup, __version__ as setuptools_version +from setuptools import find_packages, setup, __version__ as setuptools_version def readme(name='README.rst'): diff --git a/tests/compat_test.py b/tests/compat_test.py index a3079c6..c5bc921 100644 --- a/tests/compat_test.py +++ b/tests/compat_test.py @@ -3,6 +3,7 @@ from pytest import mark from six import text_type + from nirum._compat import (get_abstract_param_types, get_tuple_param_types, get_union_types, diff --git a/tests/deserialize_test.py b/tests/deserialize_test.py index 2951a3c..5261273 100644 --- a/tests/deserialize_test.py +++ b/tests/deserialize_test.py @@ -2,18 +2,18 @@ import datetime import decimal import numbers -import uuid import typing +import uuid from pytest import raises, mark from six import PY3, text_type from nirum._compat import utc -from nirum.serialize import serialize_record_type from nirum.deserialize import (deserialize_unboxed_type, deserialize_meta, deserialize_tuple_type, deserialize_record_type, deserialize_union_type, deserialize_optional, deserialize_primitive) +from nirum.serialize import serialize_record_type def test_deserialize_unboxed_type(fx_unboxed_type, fx_token_type): diff --git a/tests/py2_nirum.py b/tests/py2_nirum.py index aebada4..a12d0ff 100644 --- a/tests/py2_nirum.py +++ b/tests/py2_nirum.py @@ -1,21 +1,21 @@ -import enum -import typing import decimal +import enum import json +import typing import uuid from six import text_type -from nirum.serialize import (serialize_record_type, serialize_unboxed_type, - serialize_meta, serialize_union_type) +from nirum.constructs import NameDict, name_dict_type from nirum.deserialize import (deserialize_record_type, deserialize_unboxed_type, deserialize_meta, deserialize_union_type) +from nirum.rpc import Client, Service +from nirum.serialize import (serialize_record_type, serialize_unboxed_type, + serialize_meta, serialize_union_type) from nirum.validate import (validate_unboxed_type, validate_record_type, validate_union_type) -from nirum.constructs import NameDict, name_dict_type -from nirum.rpc import Client, Service class Offset(object): diff --git a/tests/py3_nirum.py b/tests/py3_nirum.py index 236957b..ee0b10d 100644 --- a/tests/py3_nirum.py +++ b/tests/py3_nirum.py @@ -1,19 +1,19 @@ -import enum -import typing import decimal +import enum import json +import typing import uuid -from nirum.serialize import (serialize_record_type, serialize_unboxed_type, - serialize_meta, serialize_union_type) +from nirum.constructs import NameDict, name_dict_type from nirum.deserialize import (deserialize_record_type, deserialize_unboxed_type, deserialize_meta, deserialize_union_type) +from nirum.rpc import Client, Service +from nirum.serialize import (serialize_record_type, serialize_unboxed_type, + serialize_meta, serialize_union_type) from nirum.validate import (validate_unboxed_type, validate_record_type, validate_union_type) -from nirum.constructs import NameDict, name_dict_type -from nirum.rpc import Client, Service class Offset: diff --git a/tests/rpc_test.py b/tests/rpc_test.py index 5da754a..fc67841 100644 --- a/tests/rpc_test.py +++ b/tests/rpc_test.py @@ -6,14 +6,13 @@ from werkzeug.test import Client as TestClient from werkzeug.wrappers import Response +from .nirum_schema import import_nirum_fixture from nirum.exc import (InvalidNirumServiceMethodTypeError, InvalidNirumServiceMethodNameError, UnexpectedNirumResponseError) from nirum.rpc import Client, WsgiApp from nirum.test import MockOpener -from .nirum_schema import import_nirum_fixture - nf = import_nirum_fixture() diff --git a/tests/serialize_test.py b/tests/serialize_test.py index d9f742d..b4a4b60 100644 --- a/tests/serialize_test.py +++ b/tests/serialize_test.py @@ -4,10 +4,10 @@ from pytest import mark +from .nirum_schema import import_nirum_fixture from nirum._compat import utc from nirum.serialize import (serialize_unboxed_type, serialize_record_type, serialize_meta, serialize_union_type) -from .nirum_schema import import_nirum_fixture nirum_fixture = import_nirum_fixture() From 156b7c6a0027a57beafc0dbbb387773bfb251735 Mon Sep 17 00:00:00 2001 From: Hong Minhee Date: Wed, 21 Jun 2017 15:22:24 +0900 Subject: [PATCH 4/9] Use flake8-import-order instead of import-order --- lint.sh | 4 ---- setup.py | 3 ++- tox.ini | 2 ++ 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lint.sh b/lint.sh index 181fa0c..a6f63dd 100755 --- a/lint.sh +++ b/lint.sh @@ -2,7 +2,3 @@ set -e flake8 . - -if [[ "$(python -c "import sys;print(sys.version[0])")" != "2" ]]; then - import-order nirum ./nirum -fi diff --git a/setup.py b/setup.py index 330d60a..9825e00 100644 --- a/setup.py +++ b/setup.py @@ -41,7 +41,8 @@ def get_version(): tests_require = [ 'pytest >= 3.1.2, < 4.0.0', 'pytest-flake8 >= 0.8.1, < 1.0.0', - 'import-order', + 'flake8-import-order >= 0.12, < 1.0', + 'flake8-import-order-spoqa >= 1.0.0, < 2.0.0', ] docs_require = [ 'Sphinx', diff --git a/tox.ini b/tox.ini index 9a59a02..a0a6004 100644 --- a/tox.ini +++ b/tox.ini @@ -19,3 +19,5 @@ addopts = --ff --flake8 [flake8] exclude = .env, .tox, tests/py2_nirum.py, tests/py3_nirum.py +import-order-style = spoqa +application-import-names = nirum, tests From 2bc1c9cc703fa14b34393512c39a06fc4acd4b63 Mon Sep 17 00:00:00 2001 From: Hong Minhee Date: Wed, 21 Jun 2017 15:27:41 +0900 Subject: [PATCH 5/9] Test against multiple typing versions on tox --- tox.ini | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index a0a6004..2b3e91b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,11 @@ [tox] -envlist = py27,py34,py35,docs +envlist = {py27,py34,py35}-{typing351,typing352},docs [testenv] -deps = -e.[tests] +deps = + -e.[tests] + typing351: typing<3.5.2 + typing352: typing>=3.5.2 commands= pytest -v From 028462a6230685a5f120c2c208ef4b367a1ee423 Mon Sep 17 00:00:00 2001 From: Hong Minhee Date: Wed, 21 Jun 2017 15:31:18 +0900 Subject: [PATCH 6/9] Simplified .travis.yml using tox-travis --- .travis.yml | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index de4e60b..ea731a2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,16 +3,8 @@ python: - 2.7 - 3.4 - 3.5 -install: - - pip install -U pip setuptools docutils - - pip install -e .[tests] +install: pip install tox-travis script: - - pytest -v - - pip install 'typing<3.5.2' && pytest -v - - rst2html.py --strict CHANGES.rst - - rst2html.py --strict README.rst - - python setup.py --long-description | rst2html.py --strict - - | - if [ -z "$(git diff --name-only "$TRAVIS_COMMIT_RANGE" | grep CHANGES\.rst)" ]; then - exit 1 - fi +- tox +- tox -e docs +- git diff --name-only "$TRAVIS_COMMIT_RANGE" | grep CHANGES\.rst From 9a5115a6eb1d3f20fee86cf3f631b16e534ee298 Mon Sep 17 00:00:00 2001 From: Hong Minhee Date: Wed, 21 Jun 2017 15:36:42 +0900 Subject: [PATCH 7/9] PyPI classifiers --- setup.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9825e00..38c39c2 100644 --- a/setup.py +++ b/setup.py @@ -92,5 +92,17 @@ def get_version(): }, setup_requires=setup_requires, extras_require=extras_require, - classifiers=[] + classifiers=[ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: MIT License', + 'Operating System :: OS Independent', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Topic :: Internet :: WWW/HTTP :: WSGI :: Application', + 'Topic :: Software Development :: Code Generators', + 'Topic :: Software Development :: Libraries :: Python Modules', + 'Topic :: Software Development :: Object Brokering', + ] ) From c9860c34ec0cfac943043592eea4692689dd4d96 Mon Sep 17 00:00:00 2001 From: Hong Minhee Date: Wed, 21 Jun 2017 15:37:29 +0900 Subject: [PATCH 8/9] Support Python 3.6 --- .travis.yml | 5 +---- CHANGES.rst | 1 + setup.py | 1 + tox.ini | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index ea731a2..8082c5f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,5 @@ language: python -python: - - 2.7 - - 3.4 - - 3.5 +python: [2.7, 3.4, 3.5, 3.6] install: pip install tox-travis script: - tox diff --git a/CHANGES.rst b/CHANGES.rst index cd40322..c4aadaa 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,6 +6,7 @@ Version 0.5.1 To be released. +- Added Python 3.6 support. - Wheel distributions (``nirum-*.whl``) are now universal between Python 2 and 3. [`#78`_] - ``nirum.rpc.Client`` and its subtype became to raise ``TypeError`` with diff --git a/setup.py b/setup.py index 38c39c2..160af07 100644 --- a/setup.py +++ b/setup.py @@ -100,6 +100,7 @@ def get_version(): 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', 'Topic :: Internet :: WWW/HTTP :: WSGI :: Application', 'Topic :: Software Development :: Code Generators', 'Topic :: Software Development :: Libraries :: Python Modules', diff --git a/tox.ini b/tox.ini index 2b3e91b..ed1bd1b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = {py27,py34,py35}-{typing351,typing352},docs +envlist = {py27,py34,py35,py36}-{typing351,typing352},docs [testenv] deps = From e6548c77e33897a02be23094c7e0c24129294527 Mon Sep 17 00:00:00 2001 From: Hong Minhee Date: Wed, 21 Jun 2017 16:16:32 +0900 Subject: [PATCH 9/9] Description on PyPI metadata --- README.rst | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index e39c25a..d0df5dc 100644 --- a/README.rst +++ b/README.rst @@ -1,7 +1,7 @@ nirum-python ============ -Python rumtime for Nirum_ IDL. Distributed under MIT license. +The Nirum_ runtime library for Python. Distributed under MIT license. (You probably don't need directly use this package.) diff --git a/setup.py b/setup.py index 160af07..bbea91b 100644 --- a/setup.py +++ b/setup.py @@ -77,7 +77,7 @@ def get_version(): setup( name='nirum', version=get_version(), - description='', + description='The Nirum runtime library for Python', long_description=readme(), url='https://github.com/spoqa/nirum-python', author='Kang Hyojun',