Skip to content

CI Use Python 3.12 in scipy-dev #28383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
a494222
wip
lesteve Feb 5, 2024
600246d
Remove Python 3.12 warnings
lesteve Feb 6, 2024
ac4e4aa
Add common function to use in tests and doc build
lesteve Feb 6, 2024
1adc9e1
Remove pytest_addoption
lesteve Feb 6, 2024
bd995fc
tweak
lesteve Feb 6, 2024
2fefea7
[scipy-dev]
lesteve Feb 6, 2024
416678d
Adapt environment variables + tweaks
lesteve Feb 6, 2024
d80ab81
[scipy-dev]
lesteve Feb 6, 2024
be8b69c
[scipy-dev] fix for scipy dev attr renaming
lesteve Feb 6, 2024
5db0b99
[scipy-dev] [doc build] make sure full doc build works
lesteve Feb 6, 2024
0e76426
[scipy-dev] [doc build] make sure full doc build works take 2
lesteve Feb 6, 2024
213e686
[scipy-dev] [doc build] make sure full doc build works take 2
lesteve Feb 6, 2024
35dac82
[azure parallel] [doc build] Revert "scipy-dev fix for scipy dev attr…
lesteve Feb 6, 2024
8d27ed7
Use _inicache approach to change pytest config filterwarnings.
lesteve Feb 7, 2024
20ebe68
[doc build]
lesteve Feb 7, 2024
fb7fd6f
[azure parallel] [doc build]
lesteve Feb 7, 2024
226c619
[scipy-dev] remove debug code
lesteve Feb 7, 2024
0a702f4
Add test
lesteve Feb 8, 2024
1f47260
Fix
lesteve Feb 8, 2024
cefa1ce
Use addinivalue_line
lesteve Feb 8, 2024
b5dad1c
[azure parallel] [doc build]
lesteve Feb 8, 2024
f08f380
Add ignored warnings for Python 3.12
lesteve Feb 7, 2024
8ac97a4
Update scipy-dev to Python 3.12
lesteve Feb 8, 2024
cea7144
[scipy-dev]
lesteve Feb 8, 2024
520722e
[scipy-dev] make sure this is due to dataset download
lesteve Feb 8, 2024
737453d
Disable pytest-xdist and add debug
lesteve Feb 8, 2024
1051f88
[scipy-dev]
lesteve Feb 8, 2024
7de34fb
Merge branch 'main' of https://github.com/scikit-learn/scikit-learn i…
lesteve Feb 8, 2024
369bdb7
Put back network stuff
lesteve Feb 8, 2024
4bd6c4f
[scipy-dev]
lesteve Feb 8, 2024
8d16d88
debug rcv1 and covtype
lesteve Feb 8, 2024
6ad8eec
[scipy-dev] [azure parallel]
lesteve Feb 8, 2024
0abff76
[scipy-dev] [azure parallel] no cd
lesteve Feb 8, 2024
177df9f
[scipy-dev] [azure parallel] tweak
lesteve Feb 8, 2024
56f27f3
[scipy-dev] [azure parallel] tweak
lesteve Feb 8, 2024
ed20d55
[scipy-dev] [azure parallel] tweak
lesteve Feb 8, 2024
4108ed9
[scipy-dev] [azure parallel] tweak
lesteve Feb 8, 2024
df917ec
[scipy-dev] [azure parallel] tweak
lesteve Feb 8, 2024
c319bdc
[scipy-dev] [azure parallel] tweak
lesteve Feb 8, 2024
e805fb5
[scipy-dev] [azure parallel] tweak
lesteve Feb 8, 2024
c2831d2
[scipy-dev] [azure parallel] tweak
lesteve Feb 8, 2024
a9a78f0
Move network tests to pip_latest_openblas_pandas
lesteve Feb 9, 2024
c17ece2
[scipy-dev] [azure parallel] move network tests to conda_forge_mkl
lesteve Feb 9, 2024
45fac8f
[scipy-dev] clean-up
lesteve Feb 9, 2024
089cb4d
[scipy-dev] trigger CI
lesteve Feb 9, 2024
0a03efa
[scipy-dev] Add tarfile_extractall to utils.fixes
lesteve Feb 10, 2024
2e01bc6
[scipy-dev] Only run network tests on scheduled run
lesteve Feb 10, 2024
f19f527
[doc build] Use filter="all" in example rather than utils.fixes function
lesteve Feb 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ jobs:
LOCK_FILE: './build_tools/azure/pylatest_pip_scipy_dev_linux-64_conda.lock'
SKLEARN_WARNINGS_AS_ERRORS: '1'
CHECK_PYTEST_SOFT_DEPENDENCY: 'true'
# Tests that require large downloads over the networks are skipped in CI.
# Here we make sure, that they are still run on a regular basis.
SKLEARN_SKIP_NETWORK_TESTS: '0'

- template: build_tools/azure/posix-docker.yml
# Experimental CPython branch without the Global Interpreter Lock:
Expand Down Expand Up @@ -173,6 +170,10 @@ jobs:
COVERAGE: 'true'
BUILD_WITH_MESON: 'true'
SKLEARN_TESTS_GLOBAL_RANDOM_SEED: '42' # default global random seed
# Tests that require large downloads over the networks are skipped in CI.
# Here we make sure, that they are still run on a regular basis.
${{ if eq(variables['Build.Reason'], 'Schedule') }}:
SKLEARN_SKIP_NETWORK_TESTS: '0'

# Check compilation with Ubuntu 22.04 LTS (Jammy Jellyfish) and scipy from conda-forge
# By default the CI is sequential, where `Ubuntu_Jammy_Jellyfish` runs first and
Expand Down
2 changes: 1 addition & 1 deletion build_tools/azure/pylatest_pip_scipy_dev_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
channels:
- defaults
dependencies:
- python=3.11
- python
- ccache
- pip
- pip:
Expand Down
21 changes: 11 additions & 10 deletions build_tools/azure/pylatest_pip_scipy_dev_linux-64_conda.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by conda-lock.
# platform: linux-64
# input_hash: 59b4d4fe8122e6492fa6cfc3335df94220a6171ff4a4777870abf6ccd777b95f
# input_hash: 27a1efb8abe6e773d34fe986b9e184f65a477ca629dde18d905f18e20537e026
@EXPLICIT
https://repo.anaconda.com/pkgs/main/linux-64/_libgcc_mutex-0.1-main.conda#c3473ff8bdb3d124ed5ff11ec380d6f9
https://repo.anaconda.com/pkgs/main/linux-64/ca-certificates-2023.12.12-h06a4308_0.conda#12bf7315c3f5ca50300e8b48d1b4ef2e
Expand All @@ -11,31 +11,32 @@ https://repo.anaconda.com/pkgs/main/linux-64/libstdcxx-ng-11.2.0-h1234567_1.cond
https://repo.anaconda.com/pkgs/main/linux-64/_openmp_mutex-5.1-1_gnu.conda#71d281e9c2192cb3fa425655a8defb85
https://repo.anaconda.com/pkgs/main/linux-64/libgcc-ng-11.2.0-h1234567_1.conda#a87728dabf3151fb9cfa990bd2eb0464
https://repo.anaconda.com/pkgs/main/linux-64/bzip2-1.0.8-h7b6447c_0.conda#9303f4af7c004e069bae22bde8d800ee
https://repo.anaconda.com/pkgs/main/linux-64/expat-2.5.0-h6a678d5_0.conda#9a21d99d49a0a556cf9590430dec8ec0
https://repo.anaconda.com/pkgs/main/linux-64/libffi-3.4.4-h6a678d5_0.conda#06e288f9250abef59b9a367d151fc339
https://repo.anaconda.com/pkgs/main/linux-64/libuuid-1.41.5-h5eee18b_0.conda#4a6a2354414c9080327274aa514e5299
https://repo.anaconda.com/pkgs/main/linux-64/ncurses-6.4-h6a678d5_0.conda#5558eec6e2191741a92f832ea826251c
https://repo.anaconda.com/pkgs/main/linux-64/openssl-3.0.12-h7f8727e_0.conda#48caaebab690276acf1bc1f3b56febf4
https://repo.anaconda.com/pkgs/main/linux-64/openssl-3.0.13-h7f8727e_0.conda#c73d46a4d666da0ae3dcd3fd8f805122
https://repo.anaconda.com/pkgs/main/linux-64/xz-5.4.5-h5eee18b_0.conda#fb0f709ab3eb6ad3538677c327646581
https://repo.anaconda.com/pkgs/main/linux-64/zlib-1.2.13-h5eee18b_0.conda#333e31fbfbb5057c92fa845ad6adef93
https://repo.anaconda.com/pkgs/main/linux-64/ccache-3.7.9-hfe4627d_0.conda#bef6fc681c273bb7bd0c67d1a591365e
https://repo.anaconda.com/pkgs/main/linux-64/readline-8.2-h5eee18b_0.conda#be42180685cce6e6b0329201d9f48efb
https://repo.anaconda.com/pkgs/main/linux-64/tk-8.6.12-h1ccaba5_0.conda#fa10ff4aa631fa4aa090a6234d7770b9
https://repo.anaconda.com/pkgs/main/linux-64/sqlite-3.41.2-h5eee18b_0.conda#c7086c9ceb6cfe1c4c729a774a2d88a5
https://repo.anaconda.com/pkgs/main/linux-64/python-3.11.7-h955ad1f_0.conda#721e0e84035214979d06e677d5afa9f4
https://repo.anaconda.com/pkgs/main/linux-64/setuptools-68.2.2-py311h06a4308_0.conda#264aaac990aa82ff86442ad8249787a3
https://repo.anaconda.com/pkgs/main/linux-64/wheel-0.41.2-py311h06a4308_0.conda#2d4ff85d3dfb7749ae0485ee148d4ea5
https://repo.anaconda.com/pkgs/main/linux-64/pip-23.3.1-py311h06a4308_0.conda#6fdb2a3c731f093b0014450a071c7f7f
https://repo.anaconda.com/pkgs/main/linux-64/python-3.12.1-h996f2a0_0.conda#5455a3a81e47bad947aa99db795d241a
https://repo.anaconda.com/pkgs/main/linux-64/setuptools-68.2.2-py312h06a4308_0.conda#83ba634cde4f30d9e0b88e4ac9716ca4
https://repo.anaconda.com/pkgs/main/linux-64/wheel-0.41.2-py312h06a4308_0.conda#b2c4f82880d58d679f3982370d80c0e2
https://repo.anaconda.com/pkgs/main/linux-64/pip-23.3.1-py312h06a4308_0.conda#e1d44bca4a257e84af33503233491107
# pip alabaster @ https://files.pythonhosted.org/packages/32/34/d4e1c02d3bee589efb5dfa17f88ea08bdb3e3eac12bc475462aec52ed223/alabaster-0.7.16-py3-none-any.whl#sha256=b46733c07dce03ae4e150330b975c75737fa60f0a7c591b6c8bf4928a28e2c92
# pip babel @ https://files.pythonhosted.org/packages/0d/35/4196b21041e29a42dc4f05866d0c94fa26c9da88ce12c38c2265e42c82fb/Babel-2.14.0-py3-none-any.whl#sha256=efb1a25b7118e67ce3a259bed20545c29cb68be8ad2c784c83689981b7a57287
# pip certifi @ https://files.pythonhosted.org/packages/64/62/428ef076be88fa93716b576e4a01f919d25968913e817077a386fcbe4f42/certifi-2023.11.17-py3-none-any.whl#sha256=e036ab49d5b79556f99cfc2d9320b34cfbe5be05c5871b51de9329f0603b0474
# pip charset-normalizer @ https://files.pythonhosted.org/packages/40/26/f35951c45070edc957ba40a5b1db3cf60a9dbb1b350c2d5bef03e01e61de/charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=753f10e867343b4511128c6ed8c82f7bec3bd026875576dfd88483c5c73b2fd8
# pip coverage @ https://files.pythonhosted.org/packages/d5/a7/36bd1c439fab5d450c69b7cdf4be4291d56885ae8be11ebed9ec240b919f/coverage-7.4.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=dfd1e1b9f0898817babf840b77ce9fe655ecbe8b1b327983df485b30df8cc011
# pip certifi @ https://files.pythonhosted.org/packages/ba/06/a07f096c664aeb9f01624f858c3add0a4e913d6c96257acb4fce61e7de14/certifi-2024.2.2-py3-none-any.whl#sha256=dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1
# pip charset-normalizer @ https://files.pythonhosted.org/packages/ee/fb/14d30eb4956408ee3ae09ad34299131fb383c47df355ddb428a7331cfa1e/charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=90d558489962fd4918143277a773316e56c72da56ec7aa3dc3dbbe20fdfed15b
# pip coverage @ https://files.pythonhosted.org/packages/c3/92/f2d89715c3397e76fe365b1ecbb861d1279ff8d47d23635040a358bc75dc/coverage-7.4.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=fe558371c1bdf3b8fa03e097c523fb9645b8730399c14fe7721ee9c9e2a545d3
# pip docutils @ https://files.pythonhosted.org/packages/26/87/f238c0670b94533ac0353a4e2a1a771a0cc73277b88bff23d3ae35a256c1/docutils-0.20.1-py3-none-any.whl#sha256=96f387a2c5562db4476f09f13bbab2192e764cac08ebbf3a34a95d9b1e4a59d6
# pip execnet @ https://files.pythonhosted.org/packages/e8/9c/a079946da30fac4924d92dbc617e5367d454954494cf1e71567bcc4e00ee/execnet-2.0.2-py3-none-any.whl#sha256=88256416ae766bc9e8895c76a87928c0012183da3cc4fc18016e6f050e025f41
# pip idna @ https://files.pythonhosted.org/packages/c2/e7/a82b05cf63a603df6e68d59ae6a68bf5064484a0718ea5033660af4b54a9/idna-3.6-py3-none-any.whl#sha256=c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f
# pip imagesize @ https://files.pythonhosted.org/packages/ff/62/85c4c919272577931d407be5ba5d71c20f0b616d31a0befe0ae45bb79abd/imagesize-1.4.1-py2.py3-none-any.whl#sha256=0d8d18d08f840c19d0ee7ca1fd82490fdc3729b7ac93f49870406ddde8ef8d8b
# pip iniconfig @ https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl#sha256=b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374
# pip markupsafe @ https://files.pythonhosted.org/packages/d3/0a/c6dfffacc5a9a17c97019cb7cbec67e5abfb65c59a58ecba270fa224f88d/MarkupSafe-2.1.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=3ab3a886a237f6e9c9f4f7d272067e712cdb4efa774bef494dccad08f39d8ae6
# pip markupsafe @ https://files.pythonhosted.org/packages/0a/0d/2454f072fae3b5a137c119abf15465d1771319dfe9e4acbb31722a0fff91/MarkupSafe-2.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl#sha256=f5dfb42c4604dddc8e4305050aa6deb084540643ed5804d7455b5df8fe16f5e5
# pip packaging @ https://files.pythonhosted.org/packages/ec/1a/610693ac4ee14fcdf2d9bf3c493370e4f2ef7ae2e19217d7a237ff42367d/packaging-23.2-py3-none-any.whl#sha256=8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7
# pip platformdirs @ https://files.pythonhosted.org/packages/55/72/4898c44ee9ea6f43396fbc23d9bfaf3d06e01b83698bdf2e4c919deceb7c/platformdirs-4.2.0-py3-none-any.whl#sha256=0614df2a2f37e1a662acbd8e2b25b92ccf8632929bc6d43467e17fe89c75e068
# pip pluggy @ https://files.pythonhosted.org/packages/a5/5b/0cc789b59e8cc1bf288b38111d002d8c5917123194d45b29dcdac64723cc/pluggy-1.4.0-py3-none-any.whl#sha256=7db9f7b503d67d1c5b95f59773ebb58a8c1c288129a88665838012cfb07b8981
Expand Down
5 changes: 0 additions & 5 deletions build_tools/update_environments_and_lock_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,6 @@ def remove_from(alist, to_remove):
# the environment.yml. Adding python-dateutil so it is pinned
+ ["python-dateutil"]
),
"package_constraints": {
# Temporary pin for other dependencies to be able with deprecation
# warnings introduced by Python 3.12.
"python": "3.11",
},
},
{
"name": "pypy3",
Expand Down
3 changes: 2 additions & 1 deletion examples/applications/plot_out_of_core_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ def progress(blocknum, bs, size):
assert sha256(archive_path.read_bytes()).hexdigest() == ARCHIVE_SHA256

print("untarring Reuters dataset...")
tarfile.open(archive_path, "r:gz").extractall(data_path)
with tarfile.open(archive_path, "r:gz") as fp:
fp.extractall(data_path, filter="data")
print("done.")

parser = ReutersParser()
Expand Down
4 changes: 3 additions & 1 deletion sklearn/datasets/_lfw.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from ..utils import Bunch
from ..utils._param_validation import Hidden, Interval, StrOptions, validate_params
from ..utils.fixes import tarfile_extractall
from ._base import (
RemoteFileMetadata,
_fetch_remote,
Expand Down Expand Up @@ -109,7 +110,8 @@ def _check_fetch_lfw(data_home=None, funneled=True, download_if_missing=True):
import tarfile

logger.debug("Decompressing the data archive to %s", data_folder_path)
tarfile.open(archive_path, "r:gz").extractall(path=lfw_home)
with tarfile.open(archive_path, "r:gz") as fp:
tarfile_extractall(fp, path=lfw_home)
Copy link
Member Author

@lesteve lesteve Feb 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line was not covered before either in a PR (unless you triggered a scipy-dev build).

Any issues will be caught in a scheduled CI run on main

remove(archive_path)

return lfw_home, data_folder_path
Expand Down
4 changes: 3 additions & 1 deletion sklearn/datasets/_twenty_newsgroups.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
from ..feature_extraction.text import CountVectorizer
from ..utils import Bunch, check_random_state
from ..utils._param_validation import StrOptions, validate_params
from ..utils.fixes import tarfile_extractall
from . import get_data_home, load_files
from ._base import (
RemoteFileMetadata,
Expand Down Expand Up @@ -76,7 +77,8 @@ def _download_20newsgroups(target_dir, cache_path):
archive_path = _fetch_remote(ARCHIVE, dirname=target_dir)

logger.debug("Decompressing %s", archive_path)
tarfile.open(archive_path, "r:gz").extractall(path=target_dir)
with tarfile.open(archive_path, "r:gz") as fp:
tarfile_extractall(fp, path=target_dir)
Copy link
Member Author

@lesteve lesteve Feb 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line was not covered before either in a PR (unless you triggered a scipy-dev build).

Any issues will be caught in a scheduled CI run on main


with suppress(FileNotFoundError):
os.remove(archive_path)
Expand Down
24 changes: 24 additions & 0 deletions sklearn/utils/_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,30 @@ def to_filterwarning_str(self):
message=r"\s*Pyarrow will become a required dependency",
category=DeprecationWarning,
),
# warnings has been fixed from dateutil main but not released yet, see
# https://github.com/dateutil/dateutil/issues/1314
WarningInfo(
"ignore",
message="datetime.datetime.utcfromtimestamp",
category=DeprecationWarning,
),
# Python 3.12 warnings from joblib fixed in master but not released yet,
# see https://github.com/joblib/joblib/pull/1518
WarningInfo(
"ignore", message="ast.Num is deprecated", category=DeprecationWarning
),
WarningInfo(
"ignore", message="Attribute n is deprecated", category=DeprecationWarning
),
# Python 3.12 warnings from sphinx-gallery fixed in master but not
# released yet, see
# https://github.com/sphinx-gallery/sphinx-gallery/pull/1242
WarningInfo(
"ignore", message="ast.Str is deprecated", category=DeprecationWarning
),
WarningInfo(
"ignore", message="Attribute s is deprecated", category=DeprecationWarning
),
]


Expand Down
12 changes: 12 additions & 0 deletions sklearn/utils/fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,3 +389,15 @@ def _smallest_admissible_index_dtype(arrays=(), maxval=None, check_contents=Fals
from ..externals._scipy.sparse.csgraph import laplacian # type: ignore # noqa
else:
from scipy.sparse.csgraph import laplacian # type: ignore # noqa # pragma: no cover


# TODO: Remove when we drop support for Python 3.9. Note the filter argument has
# been back-ported in 3.9.17 but we can not assume anything about the micro
# version, see
# https://docs.python.org/3.9/library/tarfile.html#tarfile.TarFile.extractall
# for more details
def tarfile_extractall(tarfile, path):
try:
tarfile.extractall(path, filter="data")
except TypeError:
tarfile.extractall(path)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line being not covered because it seems like in all our Python 3.9 builds we are using Python >= 3.9.17