8000 Merge pull request #82 from dahlia/py36 · nirum-lang/nirum-python@a207230 · GitHub
[go: up one dir, main page]

Skip to content

Commit a207230

Browse files
authored
Merge pull request #82 from dahlia/py36
Python 3.6 support
2 parents 1d445a4 + e6548c7 commit a207230

14 files changed

+61
-51
lines changed

.travis.yml

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
11
language: python
2-
python:
3-
- 2.7
4-
- 3.4
5-
- 3.5
6-
install:
7-
- pip install -U pip setuptools docutils
8-
- pip install -e .[tests]
2+
python: [2.7, 3.4, 3.5, 3.6]
3+
install: pip install tox-travis
94
script:
10-
- py.test tests -v
11-
- pip install 'typing<3.5.2' && py.test tests -v
12-
- rst2html.py --strict CHANGES.rst
13-
- rst2html.py --strict README.rst
14-
- python setup.py --long-description | rst2html.py --strict
15-
- |
16-
if [ -z "$(git diff --name-only "$TRAVIS_COMMIT_RANGE" | grep CHANGES\.rst)" ]; then
17-
exit 1
18-
fi
5+
- tox
6+
- tox -e docs
7+
- git diff --name-only "$TRAVIS_COMMIT_RANGE" | grep CHANGES\.rst

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Version 0.5.1
66

77
To be released.
88

9+
- Added Python 3.6 support.
910
- Wheel distributions (``nirum-*.whl``) are now universal between Python 2
1011
and 3. [`#78`_]
1112
- ``nirum.rpc.Client`` and its subtype became to raise ``TypeError`` with

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
nirum-python
22
============
33

4-
Python rumtime for Nirum_ IDL. Distributed under MIT license.
4+
The Nirum_ runtime library for Python. Distributed under MIT license.
55

66
(You probably don't need directly use this package.)
77

lint.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,3 @@
22
set -e
33

44
flake8 .
5-
6-
if [[ "$(python -c "import sys;print(sys.version[0])")" != "2" ]]; then
7-
import-order nirum ./nirum
8-
fi

nirum/deserialize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
from iso8601 import iso8601, parse_date
1414
from six import text_type
1515

16-
from .datastructures import Map
1716
from ._compat import get_tuple_param_types, get_union_types, is_union_type
17+
from .datastructures import Map
1818

1919
__all__ = (
2020
'deserialize_abstract_type',

setup.py

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import re
33
import sys
44

5-
from setuptools import find_packages, setup, __version__ as setuptools_version
5+
from setuptools import find_packages, setup, __version__ as setuptools_version
66

77

88
def readme(name='README.rst'):
@@ -39,10 +39,10 @@ def get_version():
3939
'six', 'iso8601',
4040
] + service_requires
4141
tests_require = [
42-
'pytest >= 2.9.0',
43-
'import-order',
44-
'flake8',
45-
'tox',
42+
'pytest >= 3.1.2, < 4.0.0',
43+
'pytest-flake8 >= 0.8.1, < 1.0.0',
44+
'flake8-import-order >= 0.12, < 1.0',
45+
'flake8-import-order-spoqa >= 1.0.0, < 2.0.0',
4646
]
4747
docs_require = [
4848
'Sphinx',
@@ -77,7 +77,7 @@ def get_version():
7777
setup(
7878
name='nirum',
7979
version=get_version(),
80-
description='',
80+
description='The Nirum runtime library for Python',
8181
long_description=readme(),
8282
url='https://github.com/spoqa/nirum-python',
8383
author='Kang Hyojun',
@@ -92,5 +92,18 @@ def get_version():
9292
},
9393
setup_requires=setup_requires,
9494
extras_require=extras_require,
95-
classifiers=[]
95+
classifiers=[
96+
'Development Status :: 4 - Beta',
97+
'Intended Audience :: Developers',
98+
'License :: OSI Approved :: MIT License',
99+
'Operating System :: OS Independent',
100+
'Programming Language :: Python :: 2.7',
101+
'Programming Language :: Python :: 3.4',
102+
'Programming Language :: Python :: 3.5',
103+
'Programming Language :: Python :: 3.6',
104+
'Topic :: Internet :: WWW/HTTP :: WSGI :: Application',
105+
'Topic :: Software Development :: Code Generators',
106+
'Topic :: Software Development :: Libraries :: Python Modules',
107+
'Topic :: Software Development :: Object Brokering',
108+
]
96109
)

tests/compat_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from pytest import mark
55
from six import text_type
6+
67
from nirum._compat import (get_abstract_param_types,
78
get_tuple_param_types,
89
get_union_types,

tests/deserialize_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
import datetime
33
import decimal
44
import numbers
5-
import uuid
65
import typing
6+
import uuid
77

88
from pytest import raises, mark
99
from six import PY3, text_type
1010

1111
from nirum._compat import utc
12-
from nirum.serialize import serialize_record_type
1312
from nirum.deserialize import (deserialize_unboxed_type, deserialize_meta,
1413
deserialize_tuple_type,
1514
deserialize_record_type, deserialize_union_type,
1615
deserialize_optional, deserialize_primitive)
16+
from nirum.serialize import serialize_record_type
1717

1818

1919
def test_deserialize_unboxed_type(fx_unboxed_type, fx_token_type):

tests/func_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
def test_import_string():
99
assert import_string('collections:OrderedDict') == collections.OrderedDict
10-
assert import_string('collections:OrderedDict({"a": 1})') == \
11-
collections.OrderedDict({"a": 1})
10+
assert (import_string('collections:OrderedDict({"a": 1})') ==
11+
collections.OrderedDict({"a": 1}))
1212
with raises(ValueError):
1313
# malformed
1414
import_string('world')

tests/py2_nirum.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
import enum
2-
import typing
31
import decimal
2+
import enum
43
import json
4+
import typing
55
import uuid
66

77
from six import text_type
88

9-
from nirum.serialize import (serialize_record_type, serialize_unboxed_type,
10-
serialize_meta, serialize_union_type)
9+
from nirum.constructs import NameDict, name_dict_type
1110
from nirum.deserialize import (deserialize_record_type,
1211
deserialize_unboxed_type,
1312
deserialize_meta,
1413
deserialize_union_type)
14+
from nirum.rpc import Client, Service
15+
from nirum.serialize import (serialize_record_type, serialize_unboxed_type,
16+
serialize_meta, serialize_union_type)
1517
from nirum.validate import (validate_unboxed_type, validate_record_type,
1618
validate_union_type)
17-
from nirum.constructs import NameDict, name_dict_type
18-
from nirum.rpc import Client, Service
1919

2020

2121
class Offset(object):

tests/py3_nirum.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
import enum
2-
import typing
31
import decimal
2+
import enum
43
import json
4+
import typing
55
import uuid
66

7-
from nirum.serialize import (serialize_record_type, serialize_unboxed_type,
8-
serialize_meta, serialize_union_type)
7+
from nirum.constructs import NameDict, name_dict_type
98
from nirum.deserialize import (deserialize_record_type,
109
deserialize_unboxed_type,
1110
deserialize_meta,
1211
deserialize_union_type)
12+
from nirum.rpc import Client, Service
13+
from nirum.serialize import (serialize_record_type, serialize_unboxed_type,
14+
serialize_meta, serialize_union_type)
1315
from nirum.validate import (validate_unboxed_type, validate_record_type,
1416
validate_union_type)
15-
from nirum.constructs import NameDict, name_dict_type
16-
from nirum.rpc import Client, Service
1717

1818

1919
class Offset:

tests/rpc_test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
from werkzeug.test import Client as TestClient
77
from werkzeug.wrappers import Response
88

9+
from .nirum_schema import import_nirum_fixture
910
from nirum.exc import (InvalidNirumServiceMethodTypeError,
1011
InvalidNirumServiceMethodNameError,
1112
UnexpectedNirumResponseError)
1213
from nirum.rpc import Client, WsgiApp
1314
from nirum.test import MockOpener
1415

15-
from .nirum_schema import import_nirum_fixture
16-
1716

1817
nf = import_nirum_fixture()
1918

tests/serialize_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
from pytest import mark
66

7+
from .nirum_schema import import_nirum_fixture
78
from nirum._compat import utc
89
from nirum.serialize import (serialize_unboxed_type, serialize_record_type,
910
serialize_meta, serialize_union_type)
10-
from .nirum_schema import import_nirum_fixture
1111

1212

1313
nirum_fixture = import_nirum_fixture()

tox.ini

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
[tox]
2-
envlist = py27,py34,py35,docs
2+
envlist = {py27,py34,py35,py36}-{typing351,typing352},docs
33

44
[testenv]
5-
deps = -e.[tests]
5+
deps =
6+
-e.[tests]
7+
typing351: typing<3.5.2
8+
typing352: typing>=3.5.2
69
commands=
7-
py.test -v tests
10+
pytest -v
811

912
[testenv:docs]
1013
basepython = python3
@@ -13,3 +16,11 @@ commands =
1316
rst2html.py --strict CHANGES.rst
1417
rst2html.py --strict README.rst
1518
python3 setup.py --long-description | rst2html.py --strict
19+
20+
[pytest]
21+
addopts = --ff --flake8
22+
23+
[flake8]
24+
exclude = .env, .tox, tests/py2_nirum.py, tests/py3_nirum.py
25+
import-order-style = spoqa
26+
application-import-names = nirum, tests

0 commit comments

Comments
 (0)
0