GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — BLD, TST: refactor test to use meson not setup.py, improve spin test -m ... by mattip · Pull Request #24153 · numpy/numpy

Conversation

@mattip

@mattip mattip commented Jul 10, 2023

Copy link
Copy Markdown
Member

This PR has two parts:

  • Add spin test -m full which will run the full test suite
  • Refactor random/tests/test_extending.py to use meson

Marking as draft to also refactor numpy.testing.extbuild to use meson as well.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions github-actions Bot added the 36 - Build Build related PR label Jul 10, 2023
@mattip
mattip marked this pull request as draft July 10, 2023 10:39
@mattip
mattip force-pushed the cpp-random branch from acb8224 to d86576c Compare July 11, 2023 09:30
@mattip

mattip commented Jul 11, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

Hmm. meson can be installed by pip, but what do we do about ninja? It is a hard requirement to run meson. I guess we should skip the build-a-module tests if ninja is not installed.

Edit: nvrmind: ninja can be pip installed too!

HaoZeke reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip
mattip force-pushed the cpp-random branch 2 times, most recently from c74cfaa to b15a55f Compare July 12, 2023 08:29
@mattip

mattip commented Jul 12, 2023

Copy link
Copy Markdown
Member Author

Any ideas how to avoid pip installing a package in a requirements file on pyodide? This works (will skip installing ninja) on ubuntu

ninja ; sys_platform != "linux"

but this seems to not work on pyodide

ninja ; sys_platform != "emscripten"

even though the sys.platform is emscripten

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rgommers

rgommers commented Jul 13, 2023

Copy link
Copy Markdown
Member

I think ninja should be packaged in Pyodide, and until that happens I'd just skip the tests for IS_WASM. Cc @hoodmane for visibility/opinion.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip

mattip commented Jul 13, 2023

Copy link
Copy Markdown
Member Author

The relevant tests are skipped. The problem is that pip install -r test_requirements.txt is failing on pyodide (before testing begins), since ninja cannot be installed. I could remove it from test_requirements.txt and install manually in all the other CI runs, but that seems wrong.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rgommers

rgommers commented Jul 13, 2023

Copy link
Copy Markdown
Member

Ah, that makes sense. It should already be present in most all CI runs (except for the ones with build isolation perhaps), because it's needed for building. It falls in the same category as compilers, pkg-config, etc. - I'd say it should not be in test_requirements.txt because ninja is not a Python package and you'd preferably get it from your system package manager (it being packaged on PyPI is a hack; meson-python has an elaborate workaround to only install it if it's not already present on the system).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rgommers

rgommers commented Jul 13, 2023

Copy link
Copy Markdown
Member

tl;dr this is an Ubuntu job, so just install it with apt?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mattip added 5 commits July 13, 2023 16:44
@mattip
BLD: add spin -m full and document it
dac0135
@mattip
refactor test_extending to use meson
2e00441
@mattip
TST: refactor testing/extbuild to use meson on-the-fly
0a14016
@mattip
TST: fix: using meson with windows, MSVC
e290d1c
@mattip
TST: refactor to add a cython build that uses cpp
bedeacf
@mattip
mattip force-pushed the cpp-random branch from b15a55f to bedeacf Compare July 13, 2023 13:49
@mattip

mattip commented Jul 13, 2023

Copy link
Copy Markdown
Member Author

this is an Ubuntu job, so just install it with apt?

Kind of. "this" is also all wheel builds, which build in an isolated environment and then test.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip
mattip force-pushed the cpp-random branch from d45e845 to b4e0713 Compare July 13, 2023 14:55
mattip
mattip commented Jul 13, 2023
View reviewed changes
Comment thread azure-pipelines.yml Resolved

Uh oh!

There was an error while loading. Please reload this page.

@mattip
mattip force-pushed the cpp-random branch from b4e0713 to 110c79a Compare July 13, 2023 15:05
@mattip

mattip commented Jul 13, 2023

Copy link
Copy Markdown
Member Author

ninja is needed a bit everywhere. While it can be installed by apt and choco, it is not clear how to install it on macOS. Apparently there is no yum package of that name available in the manylinux2014_i386 image. So I still did pip install in places where I was too lazy to work out an alternative.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rgommers

rgommers commented Jul 13, 2023

Copy link
Copy Markdown
Member

So I still did pip install in places where I was too lazy to work out an alternative.

That sounds fine to me.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip

mattip commented Jul 13, 2023

Copy link
Copy Markdown
Member Author

Looking more closely at the ninja PyPI package, it seems like a valid wheel solution to provide a binary for all platforms. It is a shame I needed to add it everywhere pip install -r test_requirements.txt is used instead of putting this inside test_requirements.txt

ninja ; sys_platform != "emscripten"
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip
TST: work around pyodide and ninja
9236be9
@mattip
mattip force-pushed the cpp-random branch from 110c79a to 9236be9 Compare July 13, 2023 16:13
@mattip
mattip marked this pull request as ready for review July 13, 2023 17:24
@mattip

mattip commented Jul 13, 2023

Copy link
Copy Markdown
Member Author

This is ready for review:

  • move cython and c-extension compilation to meson
  • add a c++ cython build test to the existing ones using the nprandom static library
  • remove a python3.9 azure job
  • add a spin -m full command to run slow tests
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hoodmane

hoodmane commented Jul 13, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

On the topic of

ninja ; sys_platform != "emscripten"

I've run into the same problem while working on pypa/cibuildwheel#1456 and I would like to fix it soon. There's a lot of complexity involved in convincing pip to behave correctly since it needs to run on the host linux Python but install stuff for emscripten Python. I think the correct way to fix this is to use PYTHONPATH to add customized versions of the standard library modules platform.py and sysconfig.py but it is a bit tricky to get right.

rgommers reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rgommers
rgommers reviewed Jul 14, 2023
View reviewed changes

@rgommers rgommers left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This looks quite good, thanks Matti. I have only one significant comment.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread tools/travis-test.sh Outdated

run_test()
{
# meson has a hard dependency on ninja, and we need meson to build

@rgommers rgommers Jul 14, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

minor: it'd be good not to repeat the same comment multiple times; can you either remove this or change to something like "see note in pyproject.toml for why ninja is installed as a test requirement"?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread numpy/random/tests/test_extending.py Outdated
cwd=str(build_dir),
)
# We don't want a wheel build, so do the steps in a controlled way
# The meson.build file is not copied as part of the build, so generate it

@rgommers rgommers Jul 14, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This should not be necessary, you can install any file you want/need. Can you commit a regular meson.build file in random/_examples/cython/ and edit random/meson.build to install it rather than the _examples/cython/setup.py file that's installed now?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rgommers

rgommers commented Jul 14, 2023

Copy link
Copy Markdown
Member

time spin test shows that the default test suite run goes from 7min03 to 2min47, which is nice for usability.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip

mattip commented Jul 14, 2023

Copy link
Copy Markdown
Member Author

I addressed the review comments, CI is passing.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rgommers

rgommers commented Jul 14, 2023

Copy link
Copy Markdown
Member

CI is passing.

It looks very red to me.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rgommers

rgommers commented Jul 14, 2023

Copy link
Copy Markdown
Member

I think you forgot to commit the new meson.build file?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip
fixes from review
43c32e6
@mattip
mattip force-pushed the cpp-random branch from b60d9fa to 43c32e6 Compare July 14, 2023 14:39
@mattip

mattip commented Jul 14, 2023

Copy link
Copy Markdown
Member Author

I think you forgot to commit the new meson.build file?

Thanks. Committed now, I guess I should refresh (f5) before jumping to conclusions.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rgommers
rgommers approved these changes Jul 14, 2023
View reviewed changes

@rgommers rgommers left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM now, in it goes. Thanks Matti!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rgommers
rgommers merged commit 308b348 into numpy:main Jul 14, 2023
@rgommers rgommers added the 09 - Backport-Candidate PRs tagged should be backported label Jul 16, 2023
@rgommers rgommers mentioned this pull request Jul 16, 2023
MAINT: Update meson.build files from main branch #24186
Merged
@charris charris added this to the 1.26.0 release milestone Jul 23, 2023
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Aug 3, 2023
@charris charris removed this from the 1.26.0 release milestone Aug 3, 2023
@charris charris added the 09 - Backport-Candidate PRs tagged should be backported label Aug 4, 2023
@charris

charris commented Aug 4, 2023

Copy link
Copy Markdown
Member

We may want to backport some of this to 1.26, so marking.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Aug 4, 2023
@charris

charris commented Aug 4, 2023

Copy link
Copy Markdown
Member

We may want to backport some of this to 1.26, so marking.

Seems we don't need it, so removing label.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@charris charris mentioned this pull request Aug 7, 2023
MAINT: Update extbuild.py from main. #24353
Merged
This was referenced Aug 15, 2023
BUG: test_mem_policy failing without ninja #24418
Open
ENH: Meson build system support for F2PY's f2py -c command #22225
Closed
@mattip mattip mentioned this pull request Nov 23, 2024
CI: add windows free-threaded CI #27819
Merged
@mattip
mattip deleted the cpp-random branch May 5, 2025 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@rgommers rgommers rgommers approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

36 - Build Build related PR

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@mattip @rgommers @hoodmane @charris
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.