Skip to content

Commit f0a2563

Browse files
authored
[EDPOPS 229] Python version compatibility update (#502)
1 parent 98a9a92 commit f0a2563

55 files changed

Lines changed: 84 additions & 224 deletions

Some content is hidden

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

recipes/sync_recipe_utils.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def export_recipes_to_yaml(recipes, yml_file):
8686
class RecipeDumper(yaml.Dumper):
8787
pass
8888

89-
class literal(unicode):
89+
class literal(str):
9090
pass
9191

9292
def _dict_representer(dumper, data):
@@ -100,17 +100,9 @@ def _literal_representer(dumper, data):
100100
RecipeDumper.add_representer(dict, _dict_representer)
101101
RecipeDumper.add_representer(literal, _literal_representer)
102102

103-
# Needed for python2,
104-
# otherwise: 'item': !!python/unicode "some string" is dumped
105-
if sys.version_info < (3,0):
106-
def represent_unicode(dumper, data):
107-
return dumper.represent_scalar(u'tag:yaml.org,2002:str', data)
108-
109-
RecipeDumper.add_representer(unicode, represent_unicode)
110-
111103
yaml_recipes = []
112104
for r in recipes:
113-
recipe_expression = literal(unicode(dict(r)['fields'][0]['expression']))
105+
recipe_expression = literal(str(dict(r)['fields'][0]['expression']))
114106
dict(r)['fields'][0]['expression'] = recipe_expression
115107
recipe_details = {
116108
"name": dict(r)['name'],

recipes/tests/test_recipes_sync.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ def retrieve(*args, **kwargs):
3434
return usr
3535
monkeypatch.setattr(sync_recipes.sb.User, "retrieve", retrieve)
3636

37-
@pytest.mark.skipif(sys.version_info < (3,0), reason="requires python3")
3837
def test_sync_recipe(mock_dataset_template_retrieve,
3938
mock_user_retrieve):
4039
with pytest.raises(SystemExit) as e:

requirements-dev.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
flake8
22
mock
33
requests[security]
4-
six
4+
urllib3>=1.26.0
55
flask
66
percy
77
selenium
8-
dash==1.19.0
9-
dash_auth==1.4.1
10-
dash_core_components==1.15.0
11-
dash_html_components==1.1.2
12-
dash_renderer==1.9.0
8+
dash>=2.14.0
9+
dash_auth>=2.0.0
10+
dash_core_components>=2.0.0
11+
dash_html_components>=2.0.0
12+
dash_renderer>=1.9.1
1313
Werkzeug<=2.0.3
1414
solvebio==2.12.0
1515
pyyaml==5.3.1

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[metadata]
2-
description-file = README.md
2+
description_file = README.md

setup.py

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,18 @@
11
# -*- coding: utf-8 -*-
2-
from __future__ import absolute_import, print_function
32
from setuptools import setup, find_packages
43

54
import sys
65
import warnings
76

87
VERSION = 'undefined'
9-
install_requires = ['six', 'pyprind']
8+
install_requires = ['pyprind', 'requests>=2.0.0', 'urllib3>=1.26.0']
109
extra = {}
1110

1211
with open('solvebio/version.py') as f:
1312
for row in f.readlines():
1413
if row.startswith('VERSION'):
1514
exec(row)
1615

17-
if sys.version_info < (2, 6):
18-
warnings.warn(
19-
'Python 2.5 is no longer officially supported by SolveBio. '
20-
'If you have any questions, please file an issue on GitHub or '
21-
'contact us at support@solvebio.com.',
22-
DeprecationWarning)
23-
install_requires.append('requests >= 0.8.8, < 0.10.1')
24-
install_requires.append('ssl')
25-
elif sys.version_info < (2, 7):
26-
install_requires.append('ordereddict')
27-
else:
28-
install_requires.append('requests>=2.0.0')
29-
30-
3116
# solvebio-recipes requires additional packages
3217
recipes_requires = [
3318
'pyyaml==5.3.1',
@@ -38,17 +23,6 @@
3823
"recipes": recipes_requires
3924
}
4025

41-
# Adjustments for Python 2 vs 3
42-
if sys.version_info < (3, 0):
43-
# Get simplejson if we don't already have json
44-
try:
45-
import json # noqa
46-
except ImportError:
47-
install_requires.append('simplejson')
48-
49-
# solvebio-recipes only available in python3
50-
extras_requires = {}
51-
5226
with open('README.md') as f:
5327
long_description = f.read()
5428

solvebio/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
88
Have questions or comments? email us at: support@solvebio.com
99
"""
10-
from __future__ import absolute_import
11-
from __future__ import print_function
1210
__docformat__ = 'restructuredtext'
1311

1412
import os as _os
13+
import errno
1514
import logging as _logging
1615
from typing import Literal
1716
from .help import open_help as _open_help
@@ -61,7 +60,7 @@ def _init_logging():
6160
_os.makedirs(logdir)
6261
except OSError as err:
6362
# Re-raise anything other than 'File exists'.
64-
if err[1] != 'File exists':
63+
if err.errno != errno.EEXIST:
6564
raise err
6665

6766
file_handler = _logging.FileHandler(logfile_path)
@@ -74,7 +73,6 @@ def _init_logging():
7473
try:
7574
base_logger.addHandler(_logging.NullHandler())
7675
except:
77-
# supports Python < 2.7
7876
class NullHandler(_logging.Handler):
7977
def emit(self, record):
8078
pass

solvebio/annotate.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
from __future__ import absolute_import
32

43
from .client import client
54

solvebio/auth.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
from __future__ import absolute_import
2-
31
import os
42
from typing import Literal, Tuple
53

6-
from six.moves.urllib.parse import urlparse
4+
from urllib.parse import urlparse
75

86
import logging
97

solvebio/cli/auth.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
from __future__ import absolute_import
3-
from __future__ import print_function
42

53
import solvebio
64
from ..client import client

solvebio/cli/credentials.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
3-
from __future__ import absolute_import
42
from collections import namedtuple
5-
import six
63

74
import solvebio
85

@@ -55,11 +52,11 @@ def save(self, path):
5552
for host in self.hosts.keys():
5653
attrs = self.hosts[host]
5754
rep = (
58-
rep + "machine " + host + "\n\tlogin " + six.text_type(attrs[0]) + "\n"
55+
rep + "machine " + host + "\n\tlogin " + str(attrs[0]) + "\n"
5956
)
6057
if attrs[1]:
61-
rep = rep + "\taccount " + six.text_type(attrs[1]) + "\n"
62-
rep = rep + "\tpassword " + six.text_type(attrs[2]) + "\n"
58+
rep = rep + "\taccount " + str(attrs[1]) + "\n"
59+
rep = rep + "\tpassword " + str(attrs[2]) + "\n"
6360

6461
f = open(path, "w")
6562
f.write(rep)

0 commit comments

Comments
 (0)