From 3fd1abc8717cbaff0c838d0b07b12ef8f869aefd Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 20 Jun 2023 23:17:58 -0500 Subject: [PATCH 01/12] more changes --- .ci/test-python-oldest.sh | 34 +++++++++++++++ .github/workflows/python_package.yml | 64 ++++++++++++++++++++++++++++ build-python.sh | 2 +- 3 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 .ci/test-python-oldest.sh diff --git a/.ci/test-python-oldest.sh b/.ci/test-python-oldest.sh new file mode 100644 index 000000000000..506a36a56ccb --- /dev/null +++ b/.ci/test-python-oldest.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# downgrade to oldest versions of dependencies published after +# minimum supported Python version's first release +echo "installing lightgbm's dependencies" +pip install \ + 'numpy==1.12.0' \ + 'pandas==0.19.2' \ + 'scikit-learn==0.18.2' \ + 'scipy==0.19.0' \ +|| exit -1 +echo "done installing lightgbm's dependencies" + +echo "installing lightgbm" +pip install dist/*.whl || exit -1 +echo "done installing lightgbm" + +echo "installed package versions:" +pip freeze + +echo "" +echo "checking that examples run without error" + +# run a few examples to test that Python package minimally works +echo "--- simple_example.py" +#python ./examples/python-guide/simple_example.py || exit -1 + +echo "--- sklearn_example.py" +python ./examples/python-guide/sklearn_example.py || exit -1 + +echo "--- advanced_example.py" +python ./examples/python-guide/advanced_example.py || exit -1 + +echo "done testing on oldest supported Python version" diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml index f046aecc1d9d..151710728be4 100644 --- a/.github/workflows/python_package.yml +++ b/.github/workflows/python_package.yml @@ -76,6 +76,70 @@ jobs: export PATH=${CONDA}/bin:${PATH} $GITHUB_WORKSPACE/.ci/setup.sh || exit -1 $GITHUB_WORKSPACE/.ci/test.sh || exit -1 + test-oldest-versions: + name: Python - oldest supported versions (${{ matrix.os }}) + runs-on: ubuntu-latest + container: 'python:3.6' + timeout-minutes: 60 + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 5 + submodules: true + - name: Create wheel + run: | + docker run \ + --rm \ + -v $(pwd):/opt/lgb-build \ + -w /opt/lgb-build \ + lightgbm/vsts-agent:manylinux_2_28_x86_64 \ + /bin/bash -c 'PATH=/opt/miniforge/bin:$PATH sh ./build-python.sh bdist_wheel --nomp' + - name: Test compatibility + run: | + cat > docker-script.sh <=0.10.0' +pip install --prefer-binary 'build>=0.9.0' # create a new directory that just contains the files needed # to build the Python package From 92e239be5be4a147126ba161c259ba41fb5fc8c3 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 20 Jun 2023 23:32:29 -0500 Subject: [PATCH 02/12] add CI job --- .ci/test-python-oldest.sh | 26 ++++++++++++------- .github/workflows/python_package.yml | 39 +--------------------------- python-package/setup.cfg | 4 +-- 3 files changed, 20 insertions(+), 49 deletions(-) diff --git a/.ci/test-python-oldest.sh b/.ci/test-python-oldest.sh index 506a36a56ccb..6c3ee28ba4d2 100644 --- a/.ci/test-python-oldest.sh +++ b/.ci/test-python-oldest.sh @@ -4,15 +4,15 @@ # minimum supported Python version's first release echo "installing lightgbm's dependencies" pip install \ - 'numpy==1.12.0' \ - 'pandas==0.19.2' \ + 'numpy==1.13.3' \ + 'pandas==1.0.0' \ 'scikit-learn==0.18.2' \ 'scipy==0.19.0' \ || exit -1 echo "done installing lightgbm's dependencies" echo "installing lightgbm" -pip install dist/*.whl || exit -1 +pip install --no-deps dist/*.whl || exit -1 echo "done installing lightgbm" echo "installed package versions:" @@ -22,13 +22,21 @@ echo "" echo "checking that examples run without error" # run a few examples to test that Python package minimally works -echo "--- simple_example.py" -#python ./examples/python-guide/simple_example.py || exit -1 +echo "" +echo "--- advanced_example.py ---" +echo "" +python ./examples/python-guide/advanced_example.py || exit -1 -echo "--- sklearn_example.py" -python ./examples/python-guide/sklearn_example.py || exit -1 +echo "" +echo "--- simple_example.py ---" +echo "" +python ./examples/python-guide/simple_example.py || exit -1 -echo "--- advanced_example.py" -python ./examples/python-guide/advanced_example.py || exit -1 +echo "" +echo "--- sklearn_example.py ---" +echo "" +python ./examples/python-guide/sklearn_example.py || exit -1 + +echo "" echo "done testing on oldest supported Python version" diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml index 151710728be4..30e30fc70e52 100644 --- a/.github/workflows/python_package.yml +++ b/.github/workflows/python_package.yml @@ -97,53 +97,16 @@ jobs: /bin/bash -c 'PATH=/opt/miniforge/bin:$PATH sh ./build-python.sh bdist_wheel --nomp' - name: Test compatibility run: | - cat > docker-script.sh <=1.13.3 scikit-learn!=0.22.0 scipy @@ -10,7 +10,7 @@ dask = dask[array]>=2.0.0 dask[dataframe]>=2.0.0 dask[distributed]>=2.0.0 - pandas + pandas>=1.0.0 [options.packages.find] where = lightgbm From 7427793e277b1167ced8b209e2cfaba39603468e Mon Sep 17 00:00:00 2001 From: James Lamb Date: Tue, 20 Jun 2023 23:41:56 -0500 Subject: [PATCH 03/12] revert build-python change --- .github/workflows/python_package.yml | 2 +- build-python.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml index 30e30fc70e52..9acdd679c677 100644 --- a/.github/workflows/python_package.yml +++ b/.github/workflows/python_package.yml @@ -77,7 +77,7 @@ jobs: $GITHUB_WORKSPACE/.ci/setup.sh || exit -1 $GITHUB_WORKSPACE/.ci/test.sh || exit -1 test-oldest-versions: - name: Python - oldest supported versions (${{ matrix.os }}) + name: Python - oldest supported versions (ubuntu-latest) runs-on: ubuntu-latest container: 'python:3.6' timeout-minutes: 60 diff --git a/build-python.sh b/build-python.sh index e9fd37b921eb..a60c3b5e831a 100755 --- a/build-python.sh +++ b/build-python.sh @@ -179,7 +179,7 @@ while [ $# -gt 0 ]; do shift done -pip install --prefer-binary 'build>=0.9.0' +pip install --prefer-binary 'build>=0.10.0' # create a new directory that just contains the files needed # to build the Python package From af94ad9d80106a570284534473f231d96c83b3ad Mon Sep 17 00:00:00 2001 From: James Lamb Date: Thu, 22 Jun 2023 20:03:53 -0500 Subject: [PATCH 04/12] install docker --- .github/workflows/python_package.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml index 9acdd679c677..a31fcbc08fde 100644 --- a/.github/workflows/python_package.yml +++ b/.github/workflows/python_package.yml @@ -87,6 +87,22 @@ jobs: with: fetch-depth: 5 submodules: true + - name: Set up docker + run: | + sudo install -m 0755 -d /etc/apt/keyrings + curl -fsSL https://download.docker.com/linux/ubuntu/gpg \ + | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg + sudo chmod a+r /etc/apt/keyrings/docker.gpg + + echo \ + "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + + apt-get install -y --no-install-recommends \ + docker-ce \ + docker-ce-cli \ + containerd.io - name: Create wheel run: | docker run \ From 9df09cdac20e80bd06550176b93511c6df6e9117 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Thu, 22 Jun 2023 20:14:44 -0500 Subject: [PATCH 05/12] no sudo --- .github/workflows/python_package.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml index a31fcbc08fde..d798e72fc83e 100644 --- a/.github/workflows/python_package.yml +++ b/.github/workflows/python_package.yml @@ -89,15 +89,15 @@ jobs: submodules: true - name: Set up docker run: | - sudo install -m 0755 -d /etc/apt/keyrings + install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg \ - | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg - sudo chmod a+r /etc/apt/keyrings/docker.gpg + | gpg --dearmor -o /etc/apt/keyrings/docker.gpg + chmod a+r /etc/apt/keyrings/docker.gpg echo \ "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ - sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + tee /etc/apt/sources.list.d/docker.list > /dev/null apt-get install -y --no-install-recommends \ docker-ce \ From f41796702990d33be56f54f43d4677e63790862f Mon Sep 17 00:00:00 2001 From: James Lamb Date: Thu, 22 Jun 2023 20:24:22 -0500 Subject: [PATCH 06/12] apt-get update --- .github/workflows/python_package.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml index d798e72fc83e..0e50aae2167b 100644 --- a/.github/workflows/python_package.yml +++ b/.github/workflows/python_package.yml @@ -99,6 +99,7 @@ jobs: "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ tee /etc/apt/sources.list.d/docker.list > /dev/null + apt-get update apt-get install -y --no-install-recommends \ docker-ce \ docker-ce-cli \ From 3dd2c896fa4828a2accc9f1939bf638b48fbc5a7 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Thu, 22 Jun 2023 20:32:14 -0500 Subject: [PATCH 07/12] hmmmmm --- .github/workflows/python_package.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml index 0e50aae2167b..01e288699dda 100644 --- a/.github/workflows/python_package.yml +++ b/.github/workflows/python_package.yml @@ -89,15 +89,15 @@ jobs: submodules: true - name: Set up docker run: | - install -m 0755 -d /etc/apt/keyrings - curl -fsSL https://download.docker.com/linux/ubuntu/gpg \ - | gpg --dearmor -o /etc/apt/keyrings/docker.gpg - chmod a+r /etc/apt/keyrings/docker.gpg + # install -m 0755 -d /etc/apt/keyrings + # curl -fsSL https://download.docker.com/linux/ubuntu/gpg \ + # | gpg --dearmor -o /etc/apt/keyrings/docker.gpg + # chmod a+r /etc/apt/keyrings/docker.gpg - echo \ - "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ - "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ - tee /etc/apt/sources.list.d/docker.list > /dev/null + # echo \ + # "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + # "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ + # tee /etc/apt/sources.list.d/docker.list > /dev/null apt-get update apt-get install -y --no-install-recommends \ From be647832294045f2dc659ba2fd0cf63ebe4eab48 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Thu, 22 Jun 2023 20:39:52 -0500 Subject: [PATCH 08/12] run directly on VM --- .github/workflows/python_package.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml index 01e288699dda..bb2e9bdcccaf 100644 --- a/.github/workflows/python_package.yml +++ b/.github/workflows/python_package.yml @@ -79,7 +79,6 @@ jobs: test-oldest-versions: name: Python - oldest supported versions (ubuntu-latest) runs-on: ubuntu-latest - container: 'python:3.6' timeout-minutes: 60 steps: - name: Checkout repository @@ -99,11 +98,12 @@ jobs: # "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ # tee /etc/apt/sources.list.d/docker.list > /dev/null - apt-get update - apt-get install -y --no-install-recommends \ - docker-ce \ - docker-ce-cli \ - containerd.io + # apt-get update + # apt-get install -y --no-install-recommends \ + # docker-ce \ + # docker-ce-cli \ + # containerd.io + echo "this is unnecessary" - name: Create wheel run: | docker run \ From 634d337940f815f516ad97afa90c8ebd41ffac8a Mon Sep 17 00:00:00 2001 From: James Lamb Date: Thu, 22 Jun 2023 20:50:09 -0500 Subject: [PATCH 09/12] no -it --- .github/workflows/python_package.yml | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/.github/workflows/python_package.yml b/.github/workflows/python_package.yml index bb2e9bdcccaf..e05821443627 100644 --- a/.github/workflows/python_package.yml +++ b/.github/workflows/python_package.yml @@ -86,24 +86,6 @@ jobs: with: fetch-depth: 5 submodules: true - - name: Set up docker - run: | - # install -m 0755 -d /etc/apt/keyrings - # curl -fsSL https://download.docker.com/linux/ubuntu/gpg \ - # | gpg --dearmor -o /etc/apt/keyrings/docker.gpg - # chmod a+r /etc/apt/keyrings/docker.gpg - - # echo \ - # "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ - # "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ - # tee /etc/apt/sources.list.d/docker.list > /dev/null - - # apt-get update - # apt-get install -y --no-install-recommends \ - # docker-ce \ - # docker-ce-cli \ - # containerd.io - echo "this is unnecessary" - name: Create wheel run: | docker run \ @@ -118,7 +100,7 @@ jobs: --rm \ -v $(pwd):/opt/lgb-build \ -w /opt/lgb-build \ - -it python:3.6 \ + python:3.6 \ /bin/bash ./.ci/test-python-oldest.sh all-python-package-jobs-successful: if: always() From c2d16029126d9deb87a583240ffaed42d962a4fe Mon Sep 17 00:00:00 2001 From: James Lamb Date: Thu, 22 Jun 2023 22:02:01 -0500 Subject: [PATCH 10/12] more changes --- .ci/test-python-oldest.sh | 15 +++++++++++---- python-package/setup.cfg | 4 ++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.ci/test-python-oldest.sh b/.ci/test-python-oldest.sh index 6c3ee28ba4d2..09cc24633e15 100644 --- a/.ci/test-python-oldest.sh +++ b/.ci/test-python-oldest.sh @@ -1,11 +1,14 @@ #!/bin/bash -# downgrade to oldest versions of dependencies published after +# oldest versions of dependencies published after # minimum supported Python version's first release +# +# see https://devguide.python.org/versions/ +# echo "installing lightgbm's dependencies" pip install \ - 'numpy==1.13.3' \ - 'pandas==1.0.0' \ + 'numpy==1.12.0' \ + 'pandas==0.24.0' \ 'scikit-learn==0.18.2' \ 'scipy==0.19.0' \ || exit -1 @@ -27,12 +30,16 @@ echo "--- advanced_example.py ---" echo "" python ./examples/python-guide/advanced_example.py || exit -1 +echo "" +echo "--- logistic_regression.py ---" +echo "" +python ./examples/python-guide/logistic_regression.py || exit -1 + echo "" echo "--- simple_example.py ---" echo "" python ./examples/python-guide/simple_example.py || exit -1 - echo "" echo "--- sklearn_example.py ---" echo "" diff --git a/python-package/setup.cfg b/python-package/setup.cfg index 8ee489b676d8..4c9b6a014a54 100644 --- a/python-package/setup.cfg +++ b/python-package/setup.cfg @@ -1,7 +1,7 @@ [options] include_package_data = True install_requires = - numpy>=1.13.3 + numpy scikit-learn!=0.22.0 scipy @@ -10,7 +10,7 @@ dask = dask[array]>=2.0.0 dask[dataframe]>=2.0.0 dask[distributed]>=2.0.0 - pandas>=1.0.0 + pandas>=0.21.0 [options.packages.find] where = lightgbm From 16d67a2206ec7060bb56a1fb23ff7e3a5996252c Mon Sep 17 00:00:00 2001 From: James Lamb Date: Thu, 22 Jun 2023 23:14:31 -0500 Subject: [PATCH 11/12] revert setup.cfg changes --- python-package/setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-package/setup.cfg b/python-package/setup.cfg index 4c9b6a014a54..2b583a0cf24e 100644 --- a/python-package/setup.cfg +++ b/python-package/setup.cfg @@ -10,7 +10,7 @@ dask = dask[array]>=2.0.0 dask[dataframe]>=2.0.0 dask[distributed]>=2.0.0 - pandas>=0.21.0 + pandas [options.packages.find] where = lightgbm From e56b022f4596be2ec15eb837c8813df11c2d466f Mon Sep 17 00:00:00 2001 From: James Lamb Date: Fri, 23 Jun 2023 13:46:03 -0500 Subject: [PATCH 12/12] empty commit