Port patches from 1.0.0 branch (#5336)

* Remove f-string, since it's not supported by Python 3.5 (#5330)

* Remove f-string, since it's not supported by Python 3.5

* Add Python 3.5 to CI, to ensure compatibility

* Remove duplicated matplotlib

* Show deprecation notice for Python 3.5

* Fix lint

* Fix lint

* Fix a unit test that mistook MINOR ver for PATCH ver

* Enforce only major version in JSON model schema

* Bump version to 1.1.0-SNAPSHOT
This commit is contained in:
Philip Hyunsu Cho 2020-02-21 13:13:21 -08:00 committed by GitHub
parent 8aa8ef1031
commit 7ac7e8778f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 81 additions and 43 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.12)
project(xgboost LANGUAGES CXX C VERSION 1.0.0) project(xgboost LANGUAGES CXX C VERSION 1.1.0)
include(cmake/Utils.cmake) include(cmake/Utils.cmake)
list(APPEND CMAKE_MODULE_PATH "${xgboost_SOURCE_DIR}/cmake/modules") list(APPEND CMAKE_MODULE_PATH "${xgboost_SOURCE_DIR}/cmake/modules")
cmake_policy(SET CMP0022 NEW) cmake_policy(SET CMP0022 NEW)

1
Jenkinsfile vendored
View File

@ -273,6 +273,7 @@ def TestPythonCPU() {
def docker_binary = "docker" def docker_binary = "docker"
sh """ sh """
${dockerRun} ${container_type} ${docker_binary} tests/ci_build/test_python.sh cpu ${dockerRun} ${container_type} ${docker_binary} tests/ci_build/test_python.sh cpu
${dockerRun} ${container_type} ${docker_binary} tests/ci_build/test_python.sh cpu-py35
""" """
deleteDir() deleteDir()
} }

View File

@ -1,8 +1,8 @@
Package: xgboost Package: xgboost
Type: Package Type: Package
Title: Extreme Gradient Boosting Title: Extreme Gradient Boosting
Version: 1.0.0.1 Version: 1.1.0.1
Date: 2019-07-23 Date: 2020-02-21
Authors@R: c( Authors@R: c(
person("Tianqi", "Chen", role = c("aut"), person("Tianqi", "Chen", role = c("aut"),
email = "tianqi.tchen@gmail.com"), email = "tianqi.tchen@gmail.com"),

View File

@ -195,12 +195,22 @@
"properties": { "properties": {
"version": { "version": {
"type": "array", "type": "array",
"const": [ "items": [
1, {
0, "type": "number",
0 "const": 1
},
{
"type": "number",
"minimum": 0
},
{
"type": "number",
"minimum": 0
}
], ],
"additionalItems": false "minItems": 3,
"maxItems": 3
}, },
"learner": { "learner": {
"type": "object", "type": "object",

View File

@ -5,7 +5,7 @@
#define XGBOOST_VERSION_CONFIG_H_ #define XGBOOST_VERSION_CONFIG_H_
#define XGBOOST_VER_MAJOR 1 #define XGBOOST_VER_MAJOR 1
#define XGBOOST_VER_MINOR 0 #define XGBOOST_VER_MINOR 1
#define XGBOOST_VER_PATCH 0 #define XGBOOST_VER_PATCH 0
#endif // XGBOOST_VERSION_CONFIG_H_ #endif // XGBOOST_VERSION_CONFIG_H_

View File

@ -6,7 +6,7 @@
<groupId>ml.dmlc</groupId> <groupId>ml.dmlc</groupId>
<artifactId>xgboost-jvm_2.12</artifactId> <artifactId>xgboost-jvm_2.12</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>XGBoost JVM Package</name> <name>XGBoost JVM Package</name>
<description>JVM Package for XGBoost</description> <description>JVM Package for XGBoost</description>

View File

@ -6,10 +6,10 @@
<parent> <parent>
<groupId>ml.dmlc</groupId> <groupId>ml.dmlc</groupId>
<artifactId>xgboost-jvm_2.12</artifactId> <artifactId>xgboost-jvm_2.12</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>xgboost4j-example_2.12</artifactId> <artifactId>xgboost4j-example_2.12</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>
<plugins> <plugins>
@ -26,7 +26,7 @@
<dependency> <dependency>
<groupId>ml.dmlc</groupId> <groupId>ml.dmlc</groupId>
<artifactId>xgboost4j-spark_${scala.binary.version}</artifactId> <artifactId>xgboost4j-spark_${scala.binary.version}</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.spark</groupId> <groupId>org.apache.spark</groupId>
@ -37,7 +37,7 @@
<dependency> <dependency>
<groupId>ml.dmlc</groupId> <groupId>ml.dmlc</groupId>
<artifactId>xgboost4j-flink_${scala.binary.version}</artifactId> <artifactId>xgboost4j-flink_${scala.binary.version}</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>

View File

@ -6,10 +6,10 @@
<parent> <parent>
<groupId>ml.dmlc</groupId> <groupId>ml.dmlc</groupId>
<artifactId>xgboost-jvm_2.12</artifactId> <artifactId>xgboost-jvm_2.12</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>xgboost4j-flink_2.12</artifactId> <artifactId>xgboost4j-flink_2.12</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
@ -26,7 +26,7 @@
<dependency> <dependency>
<groupId>ml.dmlc</groupId> <groupId>ml.dmlc</groupId>
<artifactId>xgboost4j_${scala.binary.version}</artifactId> <artifactId>xgboost4j_${scala.binary.version}</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ml.dmlc</groupId> <groupId>ml.dmlc</groupId>
<artifactId>xgboost-jvm_2.12</artifactId> <artifactId>xgboost-jvm_2.12</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>xgboost4j-spark_2.12</artifactId> <artifactId>xgboost4j-spark_2.12</artifactId>
<build> <build>
@ -24,7 +24,7 @@
<dependency> <dependency>
<groupId>ml.dmlc</groupId> <groupId>ml.dmlc</groupId>
<artifactId>xgboost4j_${scala.binary.version}</artifactId> <artifactId>xgboost4j_${scala.binary.version}</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.spark</groupId> <groupId>org.apache.spark</groupId>

View File

@ -6,10 +6,10 @@
<parent> <parent>
<groupId>ml.dmlc</groupId> <groupId>ml.dmlc</groupId>
<artifactId>xgboost-jvm_2.12</artifactId> <artifactId>xgboost-jvm_2.12</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>xgboost4j_2.12</artifactId> <artifactId>xgboost4j_2.12</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>1.1.0-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<dependencies> <dependencies>

View File

@ -1 +1 @@
1.0.0-SNAPSHOT 1.1.0-SNAPSHOT

View File

@ -5,6 +5,8 @@ Contributors: https://github.com/dmlc/xgboost/blob/master/CONTRIBUTORS.md
""" """
import os import os
import sys
import warnings
from .core import DMatrix, Booster from .core import DMatrix, Booster
from .training import train, cv from .training import train, cv
@ -19,6 +21,12 @@ try:
except ImportError: except ImportError:
pass pass
if sys.version_info[:2] == (3, 5):
warnings.warn(
'Python 3.5 support is deprecated; XGBoost will require Python 3.6+ in the near future. ' +
'Consider upgrading to Python 3.6+.',
FutureWarning)
VERSION_FILE = os.path.join(os.path.dirname(__file__), 'VERSION') VERSION_FILE = os.path.join(os.path.dirname(__file__), 'VERSION')
with open(VERSION_FILE) as f: with open(VERSION_FILE) as f:
__version__ = f.read().strip() __version__ = f.read().strip()

View File

@ -423,8 +423,8 @@ class XGBModel(XGBModelBase):
self.classes_ = np.array(v) self.classes_ = np.array(v)
continue continue
if k == 'type' and type(self).__name__ != v: if k == 'type' and type(self).__name__ != v:
msg = f'Current model type: {type(self).__name__}, ' + \ msg = 'Current model type: {}, '.format(type(self).__name__) + \
f'type of model in file: {v}' 'type of model in file: {}'.format(v)
raise TypeError(msg) raise TypeError(msg)
if k == 'type': if k == 'type':
continue continue

View File

@ -3,6 +3,7 @@ ARG CMAKE_VERSION=3.12
# Environment # Environment
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
SHELL ["/bin/bash", "-c"] # Use Bash as shell
# Install all basic requirements # Install all basic requirements
RUN \ RUN \
@ -19,10 +20,16 @@ ENV PATH=/opt/python/bin:$PATH
ENV GOSU_VERSION 1.10 ENV GOSU_VERSION 1.10
# Install Python packages # Create new Conda environment with Python 3.5
RUN conda create -n py35 python=3.5 && \
source activate py35 && \
pip install numpy pytest scipy scikit-learn pandas matplotlib wheel kubernetes urllib3 graphviz && \
source deactivate
# Install Python packages in default env
RUN \ RUN \
pip install pyyaml cpplint pylint astroid sphinx numpy scipy pandas matplotlib sh \ pip install pyyaml cpplint pylint astroid sphinx numpy scipy pandas matplotlib sh \
recommonmark guzzle_sphinx_theme mock breathe matplotlib graphviz \ recommonmark guzzle_sphinx_theme mock breathe graphviz \
pytest scikit-learn wheel kubernetes urllib3 jsonschema boto3 && \ pytest scikit-learn wheel kubernetes urllib3 jsonschema boto3 && \
pip install https://h2o-release.s3.amazonaws.com/datatable/stable/datatable-0.7.0/datatable-0.7.0-cp37-cp37m-linux_x86_64.whl && \ pip install https://h2o-release.s3.amazonaws.com/datatable/stable/datatable-0.7.0/datatable-0.7.0-cp37-cp37m-linux_x86_64.whl && \
pip install "dask[complete]" pip install "dask[complete]"

View File

@ -5,31 +5,35 @@ set -x
suite=$1 suite=$1
# Install XGBoost Python package # Install XGBoost Python package
wheel_found=0 function install_xgboost {
for file in python-package/dist/*.whl wheel_found=0
do for file in python-package/dist/*.whl
do
if [ -e "${file}" ] if [ -e "${file}" ]
then then
pip install --user "${file}" pip install --user "${file}"
wheel_found=1 wheel_found=1
break # need just one break # need just one
fi fi
done done
if [ "$wheel_found" -eq 0 ] if [ "$wheel_found" -eq 0 ]
then then
pushd . pushd .
cd python-package cd python-package
python setup.py install --user python setup.py install --user
popd popd
fi fi
}
# Run specified test suite # Run specified test suite
case "$suite" in case "$suite" in
gpu) gpu)
install_xgboost
pytest -v -s --fulltrace -m "not mgpu" tests/python-gpu pytest -v -s --fulltrace -m "not mgpu" tests/python-gpu
;; ;;
mgpu) mgpu)
install_xgboost
pytest -v -s --fulltrace -m "mgpu" tests/python-gpu pytest -v -s --fulltrace -m "mgpu" tests/python-gpu
cd tests/distributed cd tests/distributed
./runtests-gpu.sh ./runtests-gpu.sh
@ -39,17 +43,25 @@ case "$suite" in
cudf) cudf)
source activate cudf_test source activate cudf_test
install_xgboost
pytest -v -s --fulltrace -m "not mgpu" tests/python-gpu/test_from_columnar.py tests/python-gpu/test_from_cupy.py pytest -v -s --fulltrace -m "not mgpu" tests/python-gpu/test_from_columnar.py tests/python-gpu/test_from_cupy.py
;; ;;
cpu) cpu)
install_xgboost
pytest -v -s --fulltrace tests/python pytest -v -s --fulltrace tests/python
cd tests/distributed cd tests/distributed
./runtests.sh ./runtests.sh
;; ;;
cpu-py35)
source activate py35
install_xgboost
pytest -v -s --fulltrace tests/python
;;
*) *)
echo "Usage: $0 {gpu|mgpu|cudf|cpu}" echo "Usage: $0 {gpu|mgpu|cudf|cpu|cpu-py35}"
exit 1 exit 1
;; ;;
esac esac

View File

@ -54,7 +54,7 @@ TEST(Version, Basic) {
ptr = 0; ptr = 0;
v = std::stoi(str, &ptr); v = std::stoi(str, &ptr);
ASSERT_EQ(v, XGBOOST_VER_MINOR) << "patch: " << v;; ASSERT_EQ(v, XGBOOST_VER_PATCH) << "patch: " << v;;
str = str.substr(ptr); str = str.substr(ptr);
ASSERT_EQ(str.size(), 0); ASSERT_EQ(str.size(), 0);