Skip to content

Commit 43743e6

Browse files
authored
Merge pull request #90 from akx/yeet-py27
Remove Python 2.7 support
2 parents 7e271e7 + c5213c8 commit 43743e6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+108
-353
lines changed

.editorconfig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ root = true
88
[*]
99
charset = utf-8
1010
end_of_line = lf
11-
indent_size = 2
11+
indent_size = 4
1212
indent_style = space
1313
insert_final_newline = true
1414
trim_trailing_whitespace = true
15-
16-
[*.md]
17-
trim_trailing_whitespace = false

README.md

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,13 @@ Alternatively, if you want the newest master or a devel branch - clone the proje
1616
python setup.py install
1717
```
1818

19-
**!! SSL security update for python 2 !!**
20-
* short story: `pip install requests[security]` should solve all of your problems.
21-
* long story:
22-
* upcloud-python-api uses [requests](http://docs.python-requests.org/en/latest/)
23-
for HTTP(S) that in turn uses [urllib3](https://urllib3.readthedocs.org/en/latest/)
24-
* urllib3 may detect that your python2.x's SSL is lacking as described
25-
[here](https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning) and
26-
[here](https://urllib3.readthedocs.org/en/latest/security.html#pyopenssl).
27-
* you may also be interested in (especially if `requests[security]` did not work for you on Ubuntu)
28-
[http://stackoverflow.com/questions/29099404/ssl-insecureplatform-error-when-using-requests-package]
29-
(http://stackoverflow.com/questions/29099404/ssl-insecureplatform-error-when-using-requests-package)
30-
31-
32-
**Supported versions in the next release** (offline tests pass with tox):
33-
34-
* <del>python 2.6</del> removed due to deprecation
35-
* python 2.7 supported but not recommended, especially when upcloud-ansible will be ported to python3
36-
* <del>python 3.2</del> removed due to python2/3 support
37-
* <del>python 3.3</del> removed due to python2/3 support
38-
* <del>python 3.4</del> removed due to python2/3 support
39-
* <del>python 3.5</del> removed due to python2/3 support
40-
* python 3.6
41-
* python 3.7
42-
* python 3.8
43-
* python 3.9
44-
* pypi3
19+
### Supported Python
20+
21+
* Python 3.6
22+
* Python 3.7
23+
* Python 3.8
24+
* Python 3.9
25+
* PyPy3
4526

4627
**Changelog:**
4728
* See the [Releases page](https://github.com/UpCloudLtd/upcloud-python-api/releases)

circle.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

setup.cfg

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ packages=['upcloud_api', 'upcloud_api.cloud_manager']
1111
license = MIT
1212

1313
[options]
14-
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4
14+
python_requires = >=3.6, <4
1515
setup_requires =
1616
setuptools
1717
pytest-runner
@@ -26,8 +26,5 @@ packages =
2626
upcloud_api
2727
upcloud_api.cloud_manager
2828

29-
[tox:tox]
30-
envlist = py27, py36, py37, py38, py39, pypy3
31-
3229
[bdist_wheel]
3330
universal = 1

test/conftest.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
from __future__ import unicode_literals
2-
from __future__ import print_function
3-
from __future__ import division
4-
from __future__ import absolute_import
51
import json
62
import os
73
import pytest
@@ -27,11 +23,11 @@ def manager():
2723
def read_from_file(filename):
2824
filename = filename.replace("/", "_")
2925
cwd = os.path.dirname(__file__)
30-
f = open(cwd + '/json_data/'+filename, 'r')
26+
f = open(cwd + '/json_data/'+filename)
3127
return f.read()
3228

3329

34-
class Mock(object):
30+
class Mock:
3531
base_url = 'https://api.upcloud.com/1.3'
3632

3733
@staticmethod

test/helpers/infra.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
from __future__ import print_function
2-
from __future__ import unicode_literals
3-
from __future__ import division
4-
from __future__ import absolute_import
5-
61
from upcloud_api import CloudManager, Storage, FirewallRule, Tag, IPAddress
72
from upcloud_api.server import Server, login_user_block
83

test/helpers/infra_helpers.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
from __future__ import print_function
2-
from __future__ import unicode_literals
3-
from __future__ import division
4-
from __future__ import absolute_import
5-
61
from upcloud_api import Tag
72

83

test/test_apidoc/test_10_ip_addresses.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
from __future__ import unicode_literals
2-
from __future__ import print_function
3-
from __future__ import division
4-
from __future__ import absolute_import
5-
6-
71
from upcloud_api import IPAddress, Server
82
from conftest import Mock, read_from_file
93
import json
104
import responses
115

12-
class TestIP(object):
6+
class TestIP:
137

148
def test_ip_in_server_creation(self):
159
"""IPAddress in server creation.
@@ -36,7 +30,7 @@ def test_ip_in_server_details(self):
3630
data = read_from_file('server_00798b85-efdc-41ca-8021-f6ef457b8531.json')
3731
s = Server(**json.loads(data))
3832
for ip in s.ip_addresses:
39-
assert set(ip.to_dict().keys()) == set(['address', 'family', 'access'])
33+
assert set(ip.to_dict().keys()) == {'address', 'family', 'access'}
4034

4135
def test_ip_details(self):
4236
"""IPAdress LIST/GET.

test/test_cloud_manager.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
from __future__ import unicode_literals
2-
from __future__ import print_function
3-
from __future__ import division
4-
from __future__ import absolute_import
5-
61
from conftest import Mock
72
import json
83
import responses
94

105

11-
class TestCloudManagerBasic(object):
6+
class TestCloudManagerBasic:
127
@responses.activate
138
def test_get_account(self, manager):
149
data = Mock.mock_get("account")

test/test_firewall.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
from __future__ import unicode_literals
2-
from __future__ import print_function
3-
from __future__ import division
4-
from __future__ import absolute_import
5-
61
from upcloud_api import FirewallRule
72

83
from conftest import Mock
@@ -30,7 +25,7 @@ def check_fields(body):
3025
"""
3126
for field in required_fields:
3227
if field not in request_body['firewall_rule']:
33-
raise Exception('missing required field: {0}. Body was:{1}'.format(field, request_body))
28+
raise Exception(f'missing required field: {field}. Body was:{request_body}')
3429

3530
if isinstance(request_body, list):
3631
for body in request_body:
@@ -42,7 +37,7 @@ def check_fields(body):
4237

4338

4439

45-
class TestFirewall(object):
40+
class TestFirewall:
4641
@responses.activate
4742
def test_add_firewall_rule(self, manager):
4843
Mock.mock_get('server/00798b85-efdc-41ca-8021-f6ef457b8531')

0 commit comments

Comments
 (0)