Skip to content

Commit 1e4e8ca

Browse files
authored
[PUBDEV-9081] Remove Support for Python 2.7 and 3.5 (#6835)
* [PUBDEV-9081] Remove Support for Python 2.7 and 3.5 * [PUBDEV-9081] Return h2o_meta back to connection.py * [PUBDEV-9081] Re-generate bindings * [PUBDEV-9081] Fix h2o meta * [PUBDEV-9081] Replace viewitems, viewvalues, viewkeys * [PUBDEV-9081] Replace iteritems * [PUBDEV-9081] Fix print and replace basestring * [PUBDEV-9081] Fix glrm_cosensus large test * [PUBDEV-9081] Fix python demo tests * [PUBDEV-9081] Update makefile * [PUBDEV-9081] fix print statements * [PUBDEV-9081] dict merge * [PUBDEV-9081] Upgrade pandas for demos * [PUBDEV-9081] Set Url3lib in demo tests * [PUBDEV-9081] Set Url3lib in demo tests * [PUBDEV-9081] Set Url3lib in demo tests * [PUBDEV-9081] makefile 139 * [PUBDEV-9081] Fixes * [PUBDEV-9081] Update merge of dictionaries * [PUBDEV-9081] Update california_housing import * install graphviz * fix booklet * Remove extra __future__ imports * Fix Makefile * remove graphviz * [PUBDEV-9081] Fix pybooklet.gbm.vignette * [PUBDEV-9081] Replace from_items * [PUBDEV-9081] Use Python 3.6 for tests * [PUBDEV-9081] Use Python 3.7 for demo tests * [PUBDEV-9081] Upgrade causalml * [PUBDEV-9081] fix tutorial gbm monotonicity * [PUBDEV-9081] downgrade causalml * [PUBDEV-9081] install grapviz * [PUBDEV-9081] fix formatting * [PUBDEV-9081] fix xboost demo * [PUBDEV-9081] install graphviz * [PUBDEV-9081] Update xgboost demo * [PUBDEV-9081] Split demo tests to more stages * [PUBDEV-9081] Catch various types of exception in demo * [PUBDEV-9081] change numpy version * [PUBDEV-9081] fix Makefile.jenkins * [PUBDEV-9081] Upgrade numpy * [PUBDEV-9081] Downgrade numpy * [PUBDEV-9081] Upgrade pandas * [PUBDEV-9081] Update test requirements * [PUBDEV-9081] Remove image for java 16 * [PUBDEV-9081] Comment out extra packages for py demos * [PUBDEV-9081] Revert unneeded xgboost changes * [PUBDEV-9081] Revert unneeded xgboost changes * [PUBDEV-9081] Revert unneeded xgboost changes * [PUBDEV-9081] Add comments and fix xgboost
1 parent 5dde029 commit 1e4e8ca

File tree

1,014 files changed

+388
-1879
lines changed

Some content is hidden

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

1,014 files changed

+388
-1879
lines changed

README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ Building `h2o` requires a properly set up R environment with [required packages]
149149

150150
```
151151
grip
152-
future
153152
tabulate
154153
requests
155154
wheel
@@ -259,7 +258,7 @@ dependencies (like Hadoop) and using it saves build time as well as need to down
259258
260259
##### Step 2: Install required Python packages:
261260
262-
pip install grip future tabulate wheel
261+
pip install grip tabulate wheel
263262
264263
##### Step 3: Install JDK
265264
@@ -384,7 +383,7 @@ Install pip package manager:
384383

385384
Next install required packages:
386385

387-
sudo pip install wheel requests future tabulate
386+
sudo pip install wheel requests tabulate
388387

389388
##### Step 5. Git Clone [h2o-3](https://github.com/h2oai/h2o-3.git)
390389

docker/Jenkinsfile-build-docker

+1-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ IMAGE_NAME_PREFIX = 'harbor.h2o.ai/opsh2oai/h2o-3'
2121

2222
JDK_VERSIONS = ['8', '10', '11', '12', '13', '14', '15', '16', '17']
2323
JDK_VERSIONS_PY_R = ['8', '11', '17'] // stable, last-supported, latest
24-
PYTHON_VERSIONS = ['2.7', '3.5', '3.6', '3.7', '3.8', '3.9']
24+
PYTHON_VERSIONS = ['3.6', '3.7', '3.8', '3.9']
2525
R_VERSION = ['3.3.3', '3.4.1', '3.5.3', '3.6.2', '4.0.2']
2626

2727
def pipelineContext
@@ -103,9 +103,6 @@ ansiColor('xterm') {
103103
componentJdkImages += "dev-r-${version}-jdk-${jdkVersion}"
104104
}
105105
}
106-
// add python 16 manually, we dont need all JAVA_16xPYTHON_VERSIONS and JAVA_16xR_VERSION images
107-
// to be able run Java 16 on nightly
108-
componentJdkImages += "dev-python-2.7-jdk-16" // FIXME can be deleted when Java 16 not run in NIGHTLY_REPEATED_STAGES
109106
buildInParallel(pipelineContext, componentJdkImages)
110107
}
111108
}

docker/Makefile

-32
Original file line numberDiff line numberDiff line change
@@ -71,38 +71,6 @@ ifeq ($(shell echo $(PUSH) | tr [:upper:] [:lower:] ),true)
7171
docker push harbor.h2o.ai/opsh2oai/h2o-3/dev-r-base:$(VERSION)
7272
endif
7373

74-
ifneq ($(CI), 1)
75-
dev-python-2.7-jdk-%: dev-python-2.7
76-
endif
77-
dev-python-2.7-jdk-%:
78-
docker build -t harbor.h2o.ai/opsh2oai/h2o-3/dev-python-2.7-jdk-$*:$(VERSION) \
79-
$(NO_CACHE) \
80-
-f jenkins-images/Dockerfile-jdk-others \
81-
--build-arg FROM_VERSION=$(VERSION) \
82-
--build-arg FROM_IMAGE=harbor.h2o.ai/opsh2oai/h2o-3/dev-python-2.7 \
83-
--build-arg INSTALL_JAVA_VERSION=$* \
84-
--build-arg H2O_BRANCH=$(H2O_BRANCH) \
85-
.
86-
ifeq ($(shell echo $(PUSH) | tr [:upper:] [:lower:] ),true)
87-
docker push harbor.h2o.ai/opsh2oai/h2o-3/dev-python-2.7-jdk-$*:$(VERSION)
88-
endif
89-
90-
ifneq ($(CI), 1)
91-
dev-python-3.5-jdk-%: dev-python-3.5
92-
endif
93-
dev-python-3.5-jdk-%:
94-
docker build -t harbor.h2o.ai/opsh2oai/h2o-3/dev-python-3.5-jdk-$*:$(VERSION) \
95-
$(NO_CACHE) \
96-
-f jenkins-images/Dockerfile-jdk-others \
97-
--build-arg FROM_VERSION=$(VERSION) \
98-
--build-arg FROM_IMAGE=harbor.h2o.ai/opsh2oai/h2o-3/dev-python-3.5 \
99-
--build-arg INSTALL_JAVA_VERSION=$* \
100-
--build-arg H2O_BRANCH=$(H2O_BRANCH) \
101-
.
102-
ifeq ($(shell echo $(PUSH) | tr [:upper:] [:lower:] ),true)
103-
docker push harbor.h2o.ai/opsh2oai/h2o-3/dev-python-3.5-jdk-$*:$(VERSION)
104-
endif
105-
10674
ifneq ($(CI), 1)
10775
dev-python-3.6-jdk-%: dev-python-3.6
10876
endif

docker/hadoop/cdh/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ RUN if [ -z $VERSION ]; then \
1616
REPO_VERSION=$VERSION; \
1717
fi
1818
ARG PATH_PREFIX='.'
19-
ARG PYTHON_VERSIONS='2.7,3.6'
19+
ARG PYTHON_VERSIONS='3.6'
2020
ARG AWS_ACCESS_KEY
2121
ARG AWS_SECRET_ACCESS_KEY
2222
ARG HIVE_PACKAGE='hive'

docker/hadoop/hdp/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ MAINTAINER h2oai "h2o.ai"
66

77
ARG VERSION
88
ARG PATH_PREFIX='.'
9-
ARG PYTHON_VERSIONS='2.7,3.6'
9+
ARG PYTHON_VERSIONS='3.6'
1010
ARG HIVE_PACKAGE='hive'
1111
ARG APT_USERNAME
1212
ARG APT_PASSWORD

docker/xgb_build/Dockerfile-gpu-centos

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ MAINTAINER h2oai "h2o.ai"
44
ARG JENKINS_UID='2117'
55
ARG JENKINS_GID='2117'
66
ARG H2O_BRANCH='h2o3'
7-
ARG PYTHON_VERSIONS='3.5,3.6'
7+
ARG PYTHON_VERSIONS='3.6'
88

99
RUN \
1010
curl -s https://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo | sed 's/\$releasever/7/g' > /etc/yum.repos.d/epel-apache-maven.repo && \

ec2/h2o-cluster-launch-instances.py

+31-31
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,21 @@
7070

7171
# Note: this python script was initially developed with boto 2.13.3.
7272
def botoVersionMismatch():
73-
print 'WARNING: Unsupported boto version. Please upgrade boto to at least 2.13.x and try again.'
74-
print 'Comment this out to run anyway.'
75-
print 'Exiting.'
73+
print('WARNING: Unsupported boto version. Please upgrade boto to at least 2.13.x and try again.')
74+
print('Comment this out to run anyway.')
75+
print('Exiting.')
7676
sys.exit(1)
7777

7878
if not 'AWS_ACCESS_KEY_ID' in os.environ:
79-
print 'ERROR: You must set AWS_ACCESS_KEY_ID in the environment.'
79+
print('ERROR: You must set AWS_ACCESS_KEY_ID in the environment.')
8080
sys.exit(1)
8181

8282
if not 'AWS_SECRET_ACCESS_KEY' in os.environ:
83-
print 'ERROR: You must set AWS_SECRET_ACCESS_KEY in the environment.'
83+
print('ERROR: You must set AWS_SECRET_ACCESS_KEY in the environment.')
8484
sys.exit(1)
8585

8686
if not 'AWS_SSH_PRIVATE_KEY_FILE' in os.environ:
87-
print 'ERROR: You must set AWS_SSH_PRIVATE_KEY_FILE in the environment.'
87+
print('ERROR: You must set AWS_SSH_PRIVATE_KEY_FILE in the environment.')
8888
sys.exit(1)
8989

9090
publicFileName = 'nodes-public'
@@ -94,7 +94,7 @@ def botoVersionMismatch():
9494
fpublic = open(publicFileName, 'w')
9595
fprivate = open(privateFileName, 'w')
9696

97-
print 'Using boto version', boto.Version
97+
print('Using boto version', boto.Version)
9898
if True:
9999
botoVersionArr = boto.Version.split(".")
100100
if (botoVersionArr[0] != 2):
@@ -106,7 +106,7 @@ def botoVersionMismatch():
106106
boto.set_stream_logger('h2o-ec2')
107107
ec2 = boto.ec2.connect_to_region(regionName, debug=debug)
108108

109-
print 'Launching', numInstancesToLaunch, 'instances.'
109+
print('Launching', numInstancesToLaunch, 'instances.')
110110

111111
if spotBid is None:
112112
reservation = ec2.run_instances(
@@ -148,22 +148,22 @@ def botoVersionMismatch():
148148

149149
# unrecoverable error without increasing the spot bid
150150
elif request.status.code == u'price-too-low':
151-
print request.status.message
152-
print 'Cancelling Spot requests...'
151+
print(request.status.message)
152+
print('Cancelling Spot requests...')
153153
# get original request ids since some requests may have already been fulfilled
154154
ec2.cancel_spot_instance_requests(
155155
request_ids=[request.id for request in spotRequests],
156156
)
157157

158-
print 'Exiting...'
158+
print('Exiting...')
159159
sys.exit(1)
160160

161-
print request.id, request.status.message
161+
print(request.id, request.status.message)
162162

163-
print '%s/%s requests fulfilled' % (len(fulfilled), numInstancesToLaunch)
163+
print('%s/%s requests fulfilled' % (len(fulfilled), numInstancesToLaunch))
164164

165165
if requestIDs:
166-
print 'Waiting for remaining requests to be fulfilled...'
166+
print('Waiting for remaining requests to be fulfilled...')
167167
time.sleep(5)
168168

169169
reservation = ec2.get_all_instances(
@@ -173,51 +173,51 @@ def botoVersionMismatch():
173173
instances = reservation.instances
174174

175175
for i, instance in enumerate(instances):
176-
print 'Waiting for instance', i+1, 'of', numInstancesToLaunch, '...'
176+
print('Waiting for instance', i+1, 'of', numInstancesToLaunch, '...')
177177
instance.update()
178178
while instance.state != 'running':
179-
print ' .'
179+
print(' .')
180180
time.sleep(1)
181181
instance.update()
182-
print ' instance', i+1, 'of', numInstancesToLaunch, 'is up.'
182+
print(' instance', i+1, 'of', numInstancesToLaunch, 'is up.')
183183
name = instanceNameRoot + str(i)
184184
instance.add_tag('Name', value=name)
185185

186-
print
187-
print 'Creating output files: ', publicFileName, privateFileName
188-
print
186+
print("")
187+
print('Creating output files: ', publicFileName, privateFileName)
188+
print("")
189189

190190
for i, instance in enumerate(instances):
191191
instanceName = instance.tags.get('Name', '')
192192

193-
print 'Instance', i+1, 'of', numInstancesToLaunch
194-
print ' Name: ', instanceName
195-
print ' PUBLIC: ', instance.public_dns_name
196-
print ' PRIVATE:', instance.private_ip_address
197-
print
193+
print('Instance', i+1, 'of', numInstancesToLaunch)
194+
print(' Name: ', instanceName)
195+
print(' PUBLIC: ', instance.public_dns_name)
196+
print(' PRIVATE:', instance.private_ip_address)
197+
print("")
198198
fpublic.write(instance.public_dns_name + '\n')
199199
fprivate.write(instance.private_ip_address + '\n')
200200

201201
fpublic.close()
202202
fprivate.close()
203203

204-
print 'Sleeping for 60 seconds for ssh to be available...'
204+
print('Sleeping for 60 seconds for ssh to be available...')
205205
time.sleep(60)
206206

207207
d = os.path.dirname(os.path.realpath(__file__))
208208

209-
print 'Testing ssh access...'
209+
print('Testing ssh access...')
210210
cmd = d + '/' + 'h2o-cluster-test-ssh.sh'
211211
rv = os.system(cmd)
212212
if rv != 0:
213-
print 'Failed.'
213+
print('Failed.')
214214
sys.exit(1)
215215

216-
print
217-
print 'Distributing flatfile...'
216+
print("")
217+
print('Distributing flatfile...')
218218
cmd = d + '/' + 'h2o-cluster-distribute-flatfile.sh'
219219
rv = os.system(cmd)
220220
if rv != 0:
221-
print 'Failed.'
221+
print('Failed.')
222222
sys.exit(1)
223223
# Distribute flatfile script already prints success when it completes.

ec2/h2o-cluster-print-info.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
# No need to change anything below here.
3737
#--------------------------------------------------------------------------
3838

39-
print 'Using boto version', boto.Version
39+
print('Using boto version', boto.Version)
4040
if (debug):
4141
boto.set_stream_logger('h2o-ec2')
4242
ec2 = boto.ec2.connect_to_region(regionName, debug=debug)
@@ -49,9 +49,9 @@
4949
if 'Name' in instance.tags:
5050
instanceName = instance.tags['Name'];
5151
if instanceName.startswith(instanceNameRoot):
52-
print ' ', instance
53-
print ' ', instanceName
54-
print ' ', instance.public_dns_name
55-
print ' ', instance.ip_address
56-
print ' ', instance.private_dns_name
57-
print ' ', instance.private_ip_address
52+
print(' ', instance)
53+
print(' ', instanceName)
54+
print(' ', instance.public_dns_name)
55+
print(' ', instance.ip_address)
56+
print(' ', instance.private_dns_name)
57+
print(' ', instance.private_ip_address)

h2o-bindings/bin/bindings.py

-5
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@
1010
name = schema["name"]
1111
b.write_to_file("schemas/%s.cs" % name, gen_file_from_schema(schema))
1212
"""
13-
from __future__ import print_function
14-
from __future__ import division
15-
from __future__ import unicode_literals
16-
from __future__ import absolute_import
17-
1813
import argparse
1914
import atexit
2015
import codecs

h2o-bindings/bin/custom/python/gen_drf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@
280280
... y=response,
281281
... training_frame=train)
282282
>>> perf = drf.model_performance(valid)
283-
>>> print perf.auc()
283+
>>> print(perf.auc())
284284
""",
285285
min_rows="""
286286
>>> cars = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/junit/cars_20mpg.csv")

h2o-bindings/bin/custom/python/gen_xgboost.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ def convert_H2OXGBoostParams_2_XGBoostParams(self):
543543
... y=response,
544544
... training_frame=train)
545545
>>> perf = xgb.model_performance(valid)
546-
>>> print perf.auc()
546+
>>> print(perf.auc())
547547
""",
548548
min_rows="""
549549
>>> titanic = h2o.import_file("https://s3.amazonaws.com/h2o-public-test-data/smalldata/gbm_test/titanic.csv")

h2o-bindings/bin/gen_R.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
#!/usr/bin/env python
22
# -*- encoding: utf-8 -*-
3-
from __future__ import unicode_literals
43
from collections import OrderedDict as odict
54
from copy import deepcopy
65
from functools import partial
7-
import sys
86

97
import bindings as bi
108
from custom import get_customizations_for, reformat_block
119

12-
PY3 = sys.version_info[0] == 3
13-
str_type = str if PY3 else (str, unicode)
10+
str_type = str
1411
get_customizations_for = partial(get_customizations_for, 'R')
1512

1613

h2o-bindings/bin/gen_all.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env python
22
# -*- encoding: utf-8 -*-
33
# This script must run from its own directory
4-
from __future__ import print_function
54
import gen_csharp
65
import gen_docs_json
76
import gen_java

h2o-bindings/bin/gen_csharp.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env python
22
# -*- encoding: utf-8 -*-
3-
from __future__ import unicode_literals
43
import bindings as bi
54

65

h2o-bindings/bin/gen_docs_json.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env python
22
# -*- encoding: utf-8 -*-
3-
from __future__ import unicode_literals
43
import json
54
import bindings as bi
65

h2o-bindings/bin/gen_java.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env python
22
# -*- encoding: utf-8 -*-
3-
from __future__ import unicode_literals
43
import re
54
import textwrap
65
import bindings as bi

h2o-bindings/bin/gen_python.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env python
22
# -*- encoding: utf-8 -*-
3-
from __future__ import unicode_literals
43
from copy import deepcopy
54
from functools import partial
65
from io import StringIO
@@ -11,8 +10,7 @@
1110
import bindings as bi
1211
from custom import get_customizations_for, reformat_block
1312

14-
PY3 = sys.version_info[0] == 3
15-
str_type = str if PY3 else (str, unicode)
13+
str_type = str
1614
get_customizations_for = partial(get_customizations_for, 'python')
1715

1816

@@ -202,7 +200,6 @@ def extend_schema_params(param):
202200
yield "# This file is auto-generated by h2o-3/h2o-bindings/bin/gen_python.py"
203201
yield "# Copyright 2016 H2O.ai; Apache License Version 2.0 (see LICENSE for details)"
204202
yield "#"
205-
yield "from __future__ import absolute_import, division, print_function, unicode_literals"
206203
yield ""
207204
if deprecated_params:
208205
yield "from h2o.utils.metaclass import deprecated_params, deprecated_property"

h2o-bindings/bin/gen_thrift.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env python
22
# -*- encoding: utf-8 -*-
3-
from __future__ import unicode_literals
43
from collections import OrderedDict
54
import bindings as bi
65

0 commit comments

Comments
 (0)