You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by zh...@apache.org on 2022/08/11 15:39:51 UTC

[dolphinscheduler] branch dev updated: [python] Add support interpreter version 310 and 311-dev (#11170)

This is an automated email from the ASF dual-hosted git repository.

zhongjiajie pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 4d427ee215 [python] Add support interpreter version 310 and 311-dev (#11170)
4d427ee215 is described below

commit 4d427ee215427c3793a2f779b2ca69353e995fcd
Author: Jiajie Zhong <zh...@hotmail.com>
AuthorDate: Thu Aug 11 23:39:44 2022 +0800

    [python] Add support interpreter version 310 and 311-dev (#11170)
    
    * Change version of package
    * Fix tox error
    * Change dev status to beta
    * py4j not work on py{10,11} OS Windows
---
 .github/workflows/py-ci.yml                        | 22 +++++++++++++-------
 .../pydolphinscheduler/README.md                   |  5 ++++-
 .../pydolphinscheduler/setup.py                    |  6 ++++--
 .../src/pydolphinscheduler/cli/commands.py         |  6 +++---
 .../pydolphinscheduler/tests/cli/test_version.py   | 24 ++++++++++++++--------
 dolphinscheduler-python/pydolphinscheduler/tox.ini |  5 +++--
 6 files changed, 45 insertions(+), 23 deletions(-)

diff --git a/.github/workflows/py-ci.yml b/.github/workflows/py-ci.yml
index 99b79c7d11..7e0333efd8 100644
--- a/.github/workflows/py-ci.yml
+++ b/.github/workflows/py-ci.yml
@@ -61,7 +61,7 @@ jobs:
     steps:
       - uses: actions/checkout@v2
       - name: Set up Python 3.7
-        uses: actions/setup-python@v2
+        uses: actions/setup-python@v4
         with:
           python-version: 3.7
       - name: Install Dependences
@@ -78,12 +78,20 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: [3.6, 3.7, 3.8, 3.9]
-        os: [ubuntu-18.04, macOS-latest, windows-latest]
+        # YAML parse `3.10` to `3.1`, so we have to add quotes for `'3.10'`, see also:
+        # https://github.com/actions/setup-python/issues/160#issuecomment-724485470
+        python-version: [3.6, 3.7, 3.8, 3.9, '3.10', 3.11-dev]
+        os: [ubuntu-latest, macOS-latest, windows-latest]
+        # Skip because dependence [py4j](https://pypi.org/project/py4j/) not work on those environments
+        exclude:
+          - os: windows-latest
+            python-version: '3.10'
+          - os: windows-latest
+            python-version: 3.11-dev
     steps:
       - uses: actions/checkout@v2
       - name: Set up Python ${{ matrix.python-version }}
-        uses: actions/setup-python@v2
+        uses: actions/setup-python@v4
         with:
           python-version: ${{ matrix.python-version }}
       - name: Install Dependences
@@ -104,7 +112,7 @@ jobs:
     steps:
       - uses: actions/checkout@v2
       - name: Set up Python 3.7
-        uses: actions/setup-python@v2
+        uses: actions/setup-python@v4
         with:
           python-version: 3.7
       - name: Install Dependences
@@ -123,7 +131,7 @@ jobs:
     steps:
       - uses: actions/checkout@v2
       - name: Set up Python 3.7
-        uses: actions/setup-python@v2
+        uses: actions/setup-python@v4
         with:
           python-version: 3.7
       - name: Install Dependences
@@ -163,7 +171,7 @@ jobs:
           -Pdocker,release -Ddocker.tag=ci \
           -pl dolphinscheduler-standalone-server -am
       - name: Set up Python 3.7
-        uses: actions/setup-python@v2
+        uses: actions/setup-python@v4
         with:
           python-version: 3.7
       - name: Install Dependences
diff --git a/dolphinscheduler-python/pydolphinscheduler/README.md b/dolphinscheduler-python/pydolphinscheduler/README.md
index a487d5afb8..71119bdb2a 100644
--- a/dolphinscheduler-python/pydolphinscheduler/README.md
+++ b/dolphinscheduler-python/pydolphinscheduler/README.md
@@ -45,6 +45,9 @@ pydolphinscheduler version
 # 0.1.0
 ```
 
+> NOTE: package apache-dolphinscheduler not work on above Python version 3.10(including itself) in Window operating system
+> due to dependence [py4j](https://pypi.org/project/py4j/) not work on those environments.
+
 Here we show you how to install and run a simple example of pydolphinscheduler
 
 ### Start Server And Run Example
@@ -84,4 +87,4 @@ If you are interested in how to release **PyDolphinScheduler**, you could go and
 
 ## What's more
 
-For more detail information, please go to see **PyDolphinScheduler** [document](https://dolphinscheduler.apache.org/python/index.html)
+For more detail information, please go to see **PyDolphinScheduler** latest(unreleased) [document](https://dolphinscheduler.apache.org/python/dev/index.html)
diff --git a/dolphinscheduler-python/pydolphinscheduler/setup.py b/dolphinscheduler-python/pydolphinscheduler/setup.py
index 0edd24bd7b..d6228a7693 100644
--- a/dolphinscheduler-python/pydolphinscheduler/setup.py
+++ b/dolphinscheduler-python/pydolphinscheduler/setup.py
@@ -32,7 +32,7 @@ if sys.version_info[0] < 3:
 
 logger = logging.getLogger(__name__)
 
-version = "2.0.4"
+version = "dev"
 
 # Start package required
 prod = [
@@ -156,7 +156,7 @@ setup(
     platforms=["any"],
     classifiers=[
         # complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers
-        "Development Status :: 3 - Alpha",
+        "Development Status :: 4 - Beta",
         "Environment :: Console",
         "Intended Audience :: Developers",
         "License :: OSI Approved :: Apache Software License",
@@ -169,6 +169,8 @@ setup(
         "Programming Language :: Python :: 3.7",
         "Programming Language :: Python :: 3.8",
         "Programming Language :: Python :: 3.9",
+        "Programming Language :: Python :: 3.10",
+        "Programming Language :: Python :: 3.11",
         "Programming Language :: Python :: Implementation :: CPython",
         "Programming Language :: Python :: Implementation :: PyPy",
         "Topic :: Software Development :: User Interfaces",
diff --git a/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/cli/commands.py b/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/cli/commands.py
index 19f673e48f..d78e503dbb 100644
--- a/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/cli/commands.py
+++ b/dolphinscheduler-python/pydolphinscheduler/src/pydolphinscheduler/cli/commands.py
@@ -20,7 +20,7 @@
 import click
 from click import echo
 
-from pydolphinscheduler import __version__
+import pydolphinscheduler
 from pydolphinscheduler.configuration import (
     get_single_config,
     init_config_file,
@@ -48,9 +48,9 @@ def version(part: str) -> None:
     """Show current version of pydolphinscheduler."""
     if part:
         idx = version_option_val.index(part)
-        echo(f"{__version__.split('.')[idx]}")
+        echo(f"{pydolphinscheduler.__version__.split('.')[idx]}")
     else:
-        echo(f"{__version__}")
+        echo(f"{pydolphinscheduler.__version__}")
 
 
 @cli.command()
diff --git a/dolphinscheduler-python/pydolphinscheduler/tests/cli/test_version.py b/dolphinscheduler-python/pydolphinscheduler/tests/cli/test_version.py
index f0dcb0e063..b61d26da02 100644
--- a/dolphinscheduler-python/pydolphinscheduler/tests/cli/test_version.py
+++ b/dolphinscheduler-python/pydolphinscheduler/tests/cli/test_version.py
@@ -17,9 +17,11 @@
 
 """Test command line interface subcommand `version`."""
 
+from unittest.mock import patch
+
 import pytest
 
-from pydolphinscheduler import __version__
+import pydolphinscheduler
 from pydolphinscheduler.cli.commands import cli
 from tests.testing.cli import CliTestWrapper
 
@@ -27,21 +29,27 @@ from tests.testing.cli import CliTestWrapper
 def test_version():
     """Test whether subcommand `version` correct."""
     cli_test = CliTestWrapper(cli, ["version"])
-    cli_test.assert_success(output=f"{__version__}")
+    cli_test.assert_success(output=f"{pydolphinscheduler.__version__}")
 
 
 @pytest.mark.parametrize(
-    "part, idx",
+    "version, part, idx",
     [
-        ("major", 0),
-        ("minor", 1),
-        ("micro", 2),
+        ("1.2.3", "major", 0),
+        ("0.1.3", "minor", 1),
+        ("3.1.0", "micro", 2),
+        ("1.2.3-beta-1", "micro", 2),
+        ("1.2.3-alpha", "micro", 2),
+        ("1.2.3a2", "micro", 2),
+        ("1.2.3b1", "micro", 2),
     ],
 )
-def test_version_part(part: str, idx: int):
+@patch("pydolphinscheduler.__version__")
+def test_version_part(mock_version, version: str, part: str, idx: int):
     """Test subcommand `version` option `--part`."""
+    mock_version.return_value = version
     cli_test = CliTestWrapper(cli, ["version", "--part", part])
-    cli_test.assert_success(output=f"{__version__.split('.')[idx]}")
+    cli_test.assert_success(output=f"{pydolphinscheduler.__version__.split('.')[idx]}")
 
 
 @pytest.mark.parametrize(
diff --git a/dolphinscheduler-python/pydolphinscheduler/tox.ini b/dolphinscheduler-python/pydolphinscheduler/tox.ini
index 067412acee..4ce8043265 100644
--- a/dolphinscheduler-python/pydolphinscheduler/tox.ini
+++ b/dolphinscheduler-python/pydolphinscheduler/tox.ini
@@ -16,10 +16,10 @@
 # under the License.
 
 [tox]
-envlist = local-ci, auto-lint, lint, doc-build, doc-build-multi, code-test, integrate-test, local-integrate-test, py{36,37,38,39}
+envlist = local-ci, auto-lint, lint, doc-build, doc-build-multi, code-test, integrate-test, local-integrate-test, py{36,37,38,39,310,311}
 
 [testenv]
-allowlist_externals = 
+allowlist_externals =
     make
     git
 
@@ -70,6 +70,7 @@ setenv =
 commands =
     {[testenv:integrate-test]commands}
 
+# local-ci do not build `doc-build-multi`
 [testenv:local-ci]
 extras = dev
 commands =