This is an automated email from the ASF dual-hosted git repository. hxb pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/flink-ml.git
commit 0166a4c28579fafb1e33e622758c74fcd90943a1 Author: yunfengzhou-hub <[email protected]> AuthorDate: Tue Aug 30 19:56:44 2022 +0800 [FLINK-29115] Improve Python installation process This closes #149. --- .github/workflows/java8-build.yml | 15 +++++++++++++++ .github/workflows/python-checks.yml | 15 +++++++++++++++ .../java/org/apache/flink/ml/util/StageAnalyzer.java | 4 ++-- flink-ml-python/MANIFEST.in | 1 + flink-ml-python/setup.py | 16 +++++++++++++--- 5 files changed, 46 insertions(+), 5 deletions(-) diff --git a/.github/workflows/java8-build.yml b/.github/workflows/java8-build.yml index 909c682..a593520 100644 --- a/.github/workflows/java8-build.yml +++ b/.github/workflows/java8-build.yml @@ -1,3 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + name: Java 8 Build on: [push, pull_request] diff --git a/.github/workflows/python-checks.yml b/.github/workflows/python-checks.yml index 57ec84b..b98644b 100644 --- a/.github/workflows/python-checks.yml +++ b/.github/workflows/python-checks.yml @@ -1,3 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + name: Python Checks on: diff --git a/flink-ml-lib/src/test/java/org/apache/flink/ml/util/StageAnalyzer.java b/flink-ml-lib/src/test/java/org/apache/flink/ml/util/StageAnalyzer.java index 374d5e3..34e7aef 100644 --- a/flink-ml-lib/src/test/java/org/apache/flink/ml/util/StageAnalyzer.java +++ b/flink-ml-lib/src/test/java/org/apache/flink/ml/util/StageAnalyzer.java @@ -113,8 +113,8 @@ public class StageAnalyzer { } catch (Throwable t) { System.err.println( String.format( - "Failed to load class {} while analyzing flink-ml-lib JAR because of %s.", - clazz.getCanonicalName())); + "Failed to load class %s while analyzing flink-ml-lib JAR because of %s.", + clazz.getCanonicalName(), t)); return false; } } diff --git a/flink-ml-python/MANIFEST.in b/flink-ml-python/MANIFEST.in index 2635bfb..b52c513 100644 --- a/flink-ml-python/MANIFEST.in +++ b/flink-ml-python/MANIFEST.in @@ -17,5 +17,6 @@ ################################################################################ global-exclude *.py[cod] __pycache__ .DS_Store +include deps/lib/*.jar recursive-include deps/examples *.py include README.md diff --git a/flink-ml-python/setup.py b/flink-ml-python/setup.py index b4047ab..5e0f7de 100644 --- a/flink-ml-python/setup.py +++ b/flink-ml-python/setup.py @@ -23,7 +23,7 @@ from shutil import copytree, rmtree from setuptools import setup -if sys.version_info < (3, 6) or sys.version_info > (3, 8): +if sys.version_info < (3, 6) or sys.version_info >= (3, 9): print("Only Python versions between 3.6 and 3.8 (inclusive) are supported for Flink ML. " "The current Python version is %s." % python_version(), file=sys.stderr) sys.exit(-1) @@ -55,6 +55,7 @@ with io.open(os.path.join(this_directory, 'README.md'), 'r', encoding='utf-8') a TEMP_PATH = "deps" +LIB_TEMP_PATH = os.path.join(TEMP_PATH, "lib") EXAMPLES_TEMP_PATH = os.path.join(TEMP_PATH, "examples") in_flink_ml_source = os.path.isfile("../flink-ml-core/src/main/java/org/apache/flink/ml/api/" @@ -69,13 +70,19 @@ try: file=sys.stderr) sys.exit(-1) flink_ml_version = VERSION.replace(".dev0", "-SNAPSHOT") + FLINK_ML_HOME = os.path.abspath( + "../flink-ml-dist/target/flink-ml-%s-bin/flink-ml-%s" + % (flink_ml_version, flink_ml_version)) FLINK_ML_ROOT = os.path.abspath("..") + LIB_PATH = os.path.join(FLINK_ML_HOME, "lib") EXAMPLES_PATH = os.path.join(this_directory, "pyflink/examples") - try: + if getattr(os, "symlink", None) is not None: + os.symlink(LIB_PATH, LIB_TEMP_PATH) os.symlink(EXAMPLES_PATH, EXAMPLES_TEMP_PATH) - except BaseException: # pylint: disable=broad-except + else: + copytree(LIB_PATH, LIB_TEMP_PATH) copytree(EXAMPLES_PATH, EXAMPLES_TEMP_PATH) PACKAGES = ['pyflink', @@ -88,12 +95,15 @@ try: 'pyflink.ml.lib.feature', 'pyflink.ml.lib', 'pyflink.ml.util', + 'pyflink.lib', 'pyflink.examples'] PACKAGE_DIR = { + 'pyflink.lib': TEMP_PATH + '/lib', 'pyflink.examples': TEMP_PATH + '/examples'} PACKAGE_DATA = { + 'pyflink.lib': ['*.jar'], 'pyflink.examples': ['*.py', '*/*.py']} setup(
