Skip to content

Commit 164dcc3

Browse files
hugovkrobzajac
authored andcommitted
Add Python 3.7 and remove old versions (#34)
* Remove old Python versions * Upgrade Python syntax with pyupgrade --py3-plus * Drop the dot https://twitter.com/pytestdotorg/status/753767547866972160 * Add support for Python 3.7
1 parent ed0b90e commit 164dcc3

File tree

9 files changed

+29
-44
lines changed

9 files changed

+29
-44
lines changed

.travis.yml

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,15 @@
1-
sudo: false
21
language: python
32
matrix:
43
include:
5-
- python: 2.6
6-
env: TOXENV=py26
7-
- python: 2.7
8-
env: TOXENV=py27
9-
- python: 3.3
10-
env: TOXENV=py33
114
- python: 3.4
125
env: TOXENV=py34
136
- python: 3.5
147
env: TOXENV=py35
158
- python: 3.6
169
env: TOXENV=py36
17-
- python: pypy
18-
env: TOXENV=pypy
19-
allow_failures:
20-
- python: 2.6
21-
env: TOXENV=py26
22-
- python: 2.7
23-
env: TOXENV=py27
24-
- python: 3.3
25-
env: TOXENV=py33
26-
- python: pypy
27-
env: TOXENV=pypy
10+
- python: 3.7
11+
env: TOXENV=py37
12+
dist: xenial
2813

2914
install:
3015
- pip install tox

CONTRIBUTING.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Before you submit a pull request, check that it meets these guidelines:
101101
2. If the pull request adds functionality, the docs should be updated. Put
102102
your new functionality into a function with a docstring, and add the
103103
feature to the list in README.rst.
104-
3. The pull request should work for Python 2.6, 2.7, 3.3, 3.4 and 3.5, and for PyPy. Check
104+
3. The pull request should work for Python 3.4+ and PyPy. Check
105105
https://travis-ci.org/multiformats/py-multiaddr/pull_requests
106106
and make sure that the tests pass for all supported Python versions.
107107

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ lint:
5252
flake8 multiaddr/* tests/*
5353

5454
test:
55-
TOXENV=py27 tox
55+
TOXENV=py37 tox
5656

5757
test-all:
5858
tox

docs/conf.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
master_doc = 'index'
5656

5757
# General information about the project.
58-
project = u'Multiaddr'
59-
copyright = u'2016, Steven Buss'
58+
project = 'Multiaddr'
59+
copyright = '2016, Steven Buss'
6060

6161
# The version info for the project you're documenting, acts as replacement
6262
# for |version| and |release|, also used in various other places throughout
@@ -209,8 +209,8 @@
209209
# [howto/manual]).
210210
latex_documents = [
211211
('index', 'multiaddr.tex',
212-
u'Multiaddr Documentation',
213-
u'Steven Buss', 'manual'),
212+
'Multiaddr Documentation',
213+
'Steven Buss', 'manual'),
214214
]
215215

216216
# The name of an image file (relative to this directory) to place at
@@ -240,8 +240,8 @@
240240
# (source start file, name, description, authors, manual section).
241241
man_pages = [
242242
('index', 'multiaddr',
243-
u'Multiaddr Documentation',
244-
[u'Steven Buss'], 1)
243+
'Multiaddr Documentation',
244+
['Steven Buss'], 1)
245245
]
246246

247247
# If true, show URL addresses after external links.
@@ -255,8 +255,8 @@
255255
# dir menu entry, description, category)
256256
texinfo_documents = [
257257
('index', 'multiaddr',
258-
u'Multiaddr Documentation',
259-
u'Steven Buss',
258+
'Multiaddr Documentation',
259+
'Steven Buss',
260260
'multiaddr',
261261
'One line description of project.',
262262
'Miscellaneous'),

multiaddr/multiaddr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ProtocolNotFoundException(Exception):
1313
pass
1414

1515

16-
class Multiaddr(object):
16+
class Multiaddr:
1717
"""Multiaddr is a representation of multiple nested internet addresses.
1818
1919
Multiaddr is a cross-protocol, cross-platform format for representing

multiaddr/protocols.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
LENGTH_PREFIXED_VAR_SIZE = -1
6868

6969

70-
class Protocol(object):
70+
class Protocol:
7171
__slots__ = [
7272
"code", # int
7373
"size", # int (-1 indicates a length-prefixed variable size)
@@ -77,13 +77,13 @@ class Protocol(object):
7777
]
7878

7979
def __init__(self, code, size, name, vcode, path=False):
80-
if not isinstance(code, six.integer_types):
80+
if not isinstance(code, int):
8181
raise ValueError("code must be an integer")
82-
if not isinstance(size, six.integer_types):
82+
if not isinstance(size, int):
8383
raise ValueError("size must be an integer")
84-
if not isinstance(name, six.string_types):
84+
if not isinstance(name, str):
8585
raise ValueError("name must be a string")
86-
if not isinstance(vcode, six.binary_type):
86+
if not isinstance(vcode, bytes):
8787
raise ValueError("vcode must be binary")
8888
if not isinstance(path, bool):
8989
raise ValueError("path must be a boolean")
@@ -179,8 +179,8 @@ def read_varint_code(buf):
179179
Protocol(P_UNIX, LENGTH_PREFIXED_VAR_SIZE, 'unix', code_to_varint(P_UNIX), path=True),
180180
]
181181

182-
_names_to_protocols = dict((proto.name, proto) for proto in PROTOCOLS)
183-
_codes_to_protocols = dict((proto.code, proto) for proto in PROTOCOLS)
182+
_names_to_protocols = {proto.name: proto for proto in PROTOCOLS}
183+
_codes_to_protocols = {proto.code: proto for proto in PROTOCOLS}
184184

185185

186186
def add_protocol(proto):

setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,18 @@
3636
license='MIT License',
3737
zip_safe=False,
3838
keywords='multiaddr',
39+
python_requires='>=3.4',
3940
classifiers=[
4041
'Development Status :: 2 - Pre-Alpha',
4142
'Intended Audience :: Developers',
4243
'License :: OSI Approved :: MIT License',
4344
'Natural Language :: English',
44-
'Programming Language :: Python :: 2',
45-
'Programming Language :: Python :: 2.6',
46-
'Programming Language :: Python :: 2.7',
4745
'Programming Language :: Python :: 3',
48-
'Programming Language :: Python :: 3.3',
4946
'Programming Language :: Python :: 3.4',
5047
'Programming Language :: Python :: 3.5',
48+
'Programming Language :: Python :: 3.6',
49+
'Programming Language :: Python :: 3.7',
50+
'Programming Language :: Python :: 3 :: Only',
5151
],
5252
setup_requires=[
5353
'pytest-runner',

tests/test_protocols.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def test_invalid_name(valid_params, invalid_name):
5353
protocols.Protocol(**valid_params)
5454

5555

56-
@pytest.mark.parametrize("invalid_vcode", [3, u'a3'])
56+
@pytest.mark.parametrize("invalid_vcode", [3, 'a3'])
5757
def test_invalid_vcode(valid_params, invalid_vcode):
5858
valid_params['vcode'] = invalid_vcode
5959
with pytest.raises(ValueError):
@@ -67,7 +67,7 @@ def test_invalid_path(valid_params, invalid_path):
6767
protocols.Protocol(**valid_params)
6868

6969

70-
@pytest.mark.parametrize("name", ["foo-str", u"foo-u"])
70+
@pytest.mark.parametrize("name", ["foo-str", "foo-u"])
7171
def test_valid_names(valid_params, name):
7272
valid_params['name'] = name
7373
test_valid(valid_params)

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[tox]
2-
envlist = py26, py27, py33, py34, py35, py36, pypy
2+
envlist = py34, py35, py36, py37
33

44
[testenv]
55
setenv =
66
PYTHONPATH = {toxinidir}:{toxinidir}/multiaddr
7-
commands = py.test --cov=./
7+
commands = pytest --cov=./
88

99
; If you want to make tox run the tests with the same versions, create a
1010
; requirements.txt with the pinned versions and uncomment the following lines:

0 commit comments

Comments
 (0)