Skip to content

MAINT Require meson-python >= 0.16 and remove temporary work-arounds #29081

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
merged 8 commits into from
May 24, 2024

Conversation

lesteve
Copy link
Member

@lesteve lesteve commented May 22, 2024

In #28040 we used some work-arounds that are no longer necessary after meson-python 0.16 release (released 17 April 2024), in particular thanks to mesonbuild/meson-python#569.

I am undecided about removing sklearn._BUILT_WITH_MESON. It was previously used to skip a test due to a Meson editable install limitation. sklearn._BUILT_WITH_MESON is not used anymore in this PR, but you never know, it might be handy for troubleshooting user issues at least until we drop setuptools support?

For more details, the code for sklearn._BUILT_WITH_MESON is

# Write file in Meson build dir to be able to figure out from Python code
# whether scikit-learn was built with Meson. Adapted from pandas
# _version_meson.py.
custom_target('write_built_with_meson_file',
output: '_built_with_meson.py',
command: [
py, '-c', 'with open("sklearn/_built_with_meson.py", "w") as f: f.write("")'
],
install: true,
install_dir: py.get_install_dir() / 'sklearn'
)
and
_BUILT_WITH_MESON = False
try:
import sklearn._built_with_meson # noqa: F401
_BUILT_WITH_MESON = True
except ModuleNotFoundError:
pass
.

Copy link

github-actions bot commented May 22, 2024

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 0d7e4ca. Link to the linter CI: here

@lesteve
Copy link
Member Author

lesteve commented May 22, 2024

The failures are likely a behaviour change in Pytest 8, likely this one from https://docs.pytest.org/en/8.0.x/changelog.html#other-breaking-changes:

#9288: warns() now re-emits unmatched warnings when the context closes – previously it would consume all warnings, hiding those that were not matched by the function.

Similar Pytest 8 tweaks were already done in #28318, I need to remember what this was all about 😉.

@lesteve
Copy link
Member Author

lesteve commented May 23, 2024

Yet another instance of #28820 in the no-OpenMP build, I restarted the build:

FAILED: sklearn/metrics/_pairwise_distances_reduction/_datasets_pair.cpython-312-darwin.so.p/sklearn/metrics/_pairwise_distances_reduction/_datasets_pair.pyx.cpp
  cython -M --fast-fail -3 --cplus '-X language_level=3' '-X boundscheck=False' '-X wraparound=False' '-X initializedcheck=False' '-X nonecheck=False' '-X cdivision=True' '-X profile=False' --include-dir /Users/runner/work/1/s/build/cp312 sklearn/metrics/_pairwise_distances_reduction/_datasets_pair.pyx -o sklearn/metrics/_pairwise_distances_reduction/_datasets_pair.cpython-312-darwin.so.p/sklearn/metrics/_pairwise_distances_reduction/_datasets_pair.pyx.cpp

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
  from ...utils._typedefs cimport float64_t, float32_t, int32_t, intp_t
  ^
  ------------------------------------------------------------

  sklearn/metrics/_pairwise_distances_reduction/_datasets_pair.pxd:1:0: relative cimport beyond main package is not allowed

Copy link
Member

@jeremiedbb jeremiedbb left a comment

Choose a reason for hiding this comment

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

The changes in test_logistic seem unrelated

@lesteve
Copy link
Member Author

lesteve commented May 23, 2024

The changes in test_logistic seem unrelated

They are actually related in a slightly roundabout way, by updating meson-python we can use Pytest 8 (i.e. remove the pytest<8 pin). Some tests fail with Pytest 8 and I fixed them in this PR, see #29081 (comment).

@jeremiedbb
Copy link
Member

Weird that the CI didn't fail previously on the FutureWarning... To be consistent with other tests please decorate the test with the following instead

# TODO(1.7): remove filterwarnings after the deprecation of multi_class
@pytest.mark.filterwarnings("ignore:.*'multi_class' was deprecated.*:FutureWarning")

Comment on lines 1181 to 1182
assert lr.n_iter_[0] == max_iter

Copy link
Member

Choose a reason for hiding this comment

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

We should keep that though

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops indeed, fixed

Copy link
Member

@jeremiedbb jeremiedbb left a comment

Choose a reason for hiding this comment

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

LGTM

@jeremiedbb jeremiedbb merged commit a63b021 into scikit-learn:main May 24, 2024
30 checks passed
@lesteve lesteve deleted the meson-python-0.16 branch May 24, 2024 11:42
jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request Jul 2, 2024
@jeremiedbb jeremiedbb mentioned this pull request Jul 2, 2024
11 tasks
glemaitre added a commit to glemaitre/scikit-learn that referenced this pull request Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants