Skip to content
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

TST: Use meson for testing f2py #25111

Merged
merged 26 commits into from
Nov 24, 2023
Merged

TST: Use meson for testing f2py #25111

merged 26 commits into from
Nov 24, 2023

Conversation

HaoZeke
Copy link
Member

@HaoZeke HaoZeke commented Nov 11, 2023

Do not merge before #25073 and #25181.


Closes #25109.

Essentially:

Also reworked test_docs to run with spin.

image

Additionally (features added):

  • The compile() call will now use the meson backend as well
    • Ideally I'd like this command to go away completely..

Note: It is now the users' responsibility to ensure a compatible toolchain is present. However, this does mean that on the CI there are more failure modes e.g. without distutils it is hard to figure out if the CI has msvc or not, so conditional skipping is harder than it used to be. Conversely, GFortran and MSVC simply do not mix in the meson world-view. So, there is a catch-all skip for those. However, the tests are run fully on the CI as well, just not all flavors, e.g. FreeBSD fails the fortran compiler check, some of the Windows CI variants only find cl by default.

Note II: It is worth remembering that most (compiled) Windows tests were skipped even under distutils since 2017 due to #9673, perhaps with the notable exception of the (non-Fortran) test_array_from_pyobj. This is more of a status quo PR, to ensure F2PY is tested beyond its parser on Linux and MacOS (and to whatever extent Windows was tested before as well).

@HaoZeke HaoZeke added 05 - Testing component: numpy.f2py component: CI Meson Items related to the introduction of Meson as the new build system for NumPy labels Nov 11, 2023
numpy/f2py/f2py2e.py Outdated Show resolved Hide resolved
@mattip
Copy link
Member

mattip commented Nov 15, 2023

Could we do the merging the other way around: get this PR to work first and then revisit #25114?

@HaoZeke
Copy link
Member Author

HaoZeke commented Nov 19, 2023

Could we do the merging the other way around: get this PR to work first and then revisit #25114?

Unfortunately not, see #25181 (comment)

@HaoZeke HaoZeke marked this pull request as ready for review November 19, 2023 05:59
Copy link
Member

@mattip mattip left a comment

Choose a reason for hiding this comment

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

LGTM. A few nits.

numpy/distutils/tests/test_build_ext.py Outdated Show resolved Hide resolved
@@ -92,17 +92,16 @@ def compile(source,
with open(fname, 'w') as f:
f.write(source)

args = ['-c', '-m', modulename, f.name]
args = ['-c', '--backend', 'meson', '-m',
modulename, f.name]
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't meson be made the default?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not yet, for python<3.12 the default (with a warning) is still distutils. >=3.12 it automatically (and noisily) switches to meson

Copy link
Member Author

Choose a reason for hiding this comment

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

However, in terms of the testing infrastructure, there's no point keeping the distutils build and test routines, so we just default to using meson explicitly here.

@charris
Copy link
Member

charris commented Nov 21, 2023

Please squash this when it gets merged.

@rgommers
Copy link
Member

@HaoZeke and I just discussed that we plan to fix the speed issue in stages: add some slow markers in this PR, merge this PR, switch to pytest fixtures to speed up the tests after, and then deal with some CI sanitation to run compile tests less often.

@HaoZeke
Copy link
Member Author

HaoZeke commented Nov 23, 2023

The tests (after annotating with slow) will finish in less than a minute now, further speed up needs #25239, so perhaps this is ready for now @rgommers :)

Copy link
Member

@rgommers rgommers left a comment

Choose a reason for hiding this comment

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

Thanks Rohit, LGTM now - let's give this a go!

@rgommers rgommers merged commit 8ac314f into numpy:main Nov 24, 2023
60 checks passed
@HaoZeke HaoZeke deleted the testf2py312 branch November 24, 2023 13:39
stefanor added a commit to stefanor/numpy that referenced this pull request Dec 6, 2023
The user of this import was removed in the cleanup in numpy#25111, post-2.26.
charris pushed a commit to charris/numpy that referenced this pull request Dec 19, 2023
* MAINT,TST: Use meson for compiler checks [f2py]

* MAINT: Cache the compiler checks [f2py]

* MAINT,TST: Always use meson [f2py]

* TST: Rework to have a build_meson [f2py]

* MAINT,TST: Simplify the meson backend [f2py]

* TST: Use the build_meson function [f2py]

* MAINT,TST: Minor cleanup [f2py]

* TST: Ensure TestDocAdvanced runs with spin [f2py]

* TST: Use cleanup meson backend [f2py]

* MAINT,TST: Generalize build_meson [f2py]

* TST: Use a helper for spin tests [f2py]

* MAINT: Simplify meson backend [f2py]

* TST: Handle unsupported compilers [f2py]

* TST: Fix gibberish in [f2py] documentation test

* CI: Add meson for cygwin runs

* TST: Skips for 32-bit errors [f2py]

* TST: Skip for cygwin since meson is old [f2py]

* CI: Revert grabbing meson on cygwin

The version is too old to be of use

* TST: Cleanup old distutils builder [f2py]

* TST: Skip cygwin better [f2py]

* TST: Don't touch distutils

* MAINT: Vendor in distutils testing requirement

* TST: Try removing cygwin restrictions

* MAINT: Cleanup some tests [f2py]

* TST: Try to use concurrency for i/o bounds [f2py]

* TST: Mark slow tests [f2py]

Should finish in around a minute now
@charris charris changed the title TST: Use meson for testing f2py TST: Use meson for testing f2py Dec 19, 2023
@charris charris mentioned this pull request Dec 19, 2023
7 tasks
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Dec 19, 2023
charris pushed a commit to charris/numpy that referenced this pull request Dec 23, 2023
* MAINT,TST: Use meson for compiler checks [f2py]

* MAINT: Cache the compiler checks [f2py]

* MAINT,TST: Always use meson [f2py]

* TST: Rework to have a build_meson [f2py]

* MAINT,TST: Simplify the meson backend [f2py]

* TST: Use the build_meson function [f2py]

* MAINT,TST: Minor cleanup [f2py]

* TST: Ensure TestDocAdvanced runs with spin [f2py]

* TST: Use cleanup meson backend [f2py]

* MAINT,TST: Generalize build_meson [f2py]

* TST: Use a helper for spin tests [f2py]

* MAINT: Simplify meson backend [f2py]

* TST: Handle unsupported compilers [f2py]

* TST: Fix gibberish in [f2py] documentation test

* CI: Add meson for cygwin runs

* TST: Skips for 32-bit errors [f2py]

* TST: Skip for cygwin since meson is old [f2py]

* CI: Revert grabbing meson on cygwin

The version is too old to be of use

* TST: Cleanup old distutils builder [f2py]

* TST: Skip cygwin better [f2py]

* TST: Don't touch distutils

* MAINT: Vendor in distutils testing requirement

* TST: Try removing cygwin restrictions

* MAINT: Cleanup some tests [f2py]

* TST: Try to use concurrency for i/o bounds [f2py]

* TST: Mark slow tests [f2py]

Should finish in around a minute now
charris pushed a commit to charris/numpy that referenced this pull request Dec 24, 2023
* MAINT,TST: Use meson for compiler checks [f2py]

* MAINT: Cache the compiler checks [f2py]

* MAINT,TST: Always use meson [f2py]

* TST: Rework to have a build_meson [f2py]

* MAINT,TST: Simplify the meson backend [f2py]

* TST: Use the build_meson function [f2py]

* MAINT,TST: Minor cleanup [f2py]

* TST: Ensure TestDocAdvanced runs with spin [f2py]

* TST: Use cleanup meson backend [f2py]

* MAINT,TST: Generalize build_meson [f2py]

* TST: Use a helper for spin tests [f2py]

* MAINT: Simplify meson backend [f2py]

* TST: Handle unsupported compilers [f2py]

* TST: Fix gibberish in [f2py] documentation test

* CI: Add meson for cygwin runs

* TST: Skips for 32-bit errors [f2py]

* TST: Skip for cygwin since meson is old [f2py]

* CI: Revert grabbing meson on cygwin

The version is too old to be of use

* TST: Cleanup old distutils builder [f2py]

* TST: Skip cygwin better [f2py]

* TST: Don't touch distutils

* MAINT: Vendor in distutils testing requirement

* TST: Try removing cygwin restrictions

* MAINT: Cleanup some tests [f2py]

* TST: Try to use concurrency for i/o bounds [f2py]

* TST: Mark slow tests [f2py]

Should finish in around a minute now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
05 - Testing component: CI component: numpy.f2py Meson Items related to the introduction of Meson as the new build system for NumPy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TST: Run f2py compilation tests on 3.12
4 participants