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

Build wheels with numpy 1.25+ #4198

Merged
merged 17 commits into from
Aug 15, 2023
Merged

Build wheels with numpy 1.25+ #4198

merged 17 commits into from
Aug 15, 2023

Conversation

IAlibay
Copy link
Member

@IAlibay IAlibay commented Jul 14, 2023

Fixes #4183

This will likely (silently) break all of CI since the order of things changes.

Things to check

  • azure pipelines
  • gh actions
  • cirrus (all good we don't have a specific numpy install)
  • deployment

PR Checklist

  • Tests?
  • Docs?
  • CHANGELOG updated?
  • Issue raised/referenced?

📚 Documentation preview 📚: https://mdanalysis--4198.org.readthedocs.build/en/4198/

@github-actions
Copy link

github-actions bot commented Jul 14, 2023

Linter Bot Results:

Hi @IAlibay! Thanks for making this PR. We linted your code and found the following:

There are currently no issues detected! 🎉

@codecov
Copy link

codecov bot commented Jul 14, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.21% ⚠️

Comparison is base (b21478f) 93.62% compared to head (a33cbd9) 93.41%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4198      +/-   ##
===========================================
- Coverage    93.62%   93.41%   -0.21%     
===========================================
  Files          179      183       +4     
  Lines        24199    23306     -893     
  Branches      4064     4064              
===========================================
- Hits         22657    21772     -885     
+ Misses        1026     1018       -8     
  Partials       516      516              

see 24 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@hmacdope hmacdope left a comment

Choose a reason for hiding this comment

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

Looks good to me @IAlibay

@IAlibay
Copy link
Member Author

IAlibay commented Aug 9, 2023

Looks good to me @IAlibay

I mean it still needs a lot of changes / work.. I wouldn't prematurely approve it.

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

I don't feel knowledgeable to approve here — all I would do is look if the CI is still green. I assume that NEP29 allows us to depend on numpy >= 1.25?

@IAlibay
Copy link
Member Author

IAlibay commented Aug 9, 2023

I don't feel knowledgeable to approve here — all I would do is look if the CI is still green. I assume that NEP29 allows us to depend on numpy >= 1.25?

numpy 1.25 offers backwards compatibility all the way through to numpy 1.19 (which more than covers nep29).

What's left to do here in this PR is to go back and rework CI to do the right install order for wheel generation where necessary - i.e. install with 1.25 and then downgrade to 1.22 and see if it still works. I'll have a stab at it later this week probably.

@IAlibay
Copy link
Member Author

IAlibay commented Aug 14, 2023

Cron CI issue is elsewhere see #4238

Copy link
Member Author

@IAlibay IAlibay left a comment

Choose a reason for hiding this comment

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

Some comments for when folks get to review so it makes more sense what I'm doing here.

@@ -9,6 +9,10 @@ inputs:
description: 'build MDA docs'
required: true
default: false
isolation:
Copy link
Member Author

Choose a reason for hiding this comment

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

We're adding an option to trigger the pip --no-build-isolation flag. This will allow us to avoid pip trying to have its own isolated build & overidding already installed dependencies.

Copy link
Member

Choose a reason for hiding this comment

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

It took me a couple readings of this comment and the pip documentation to understand (if I have this correctly) that:

  • default (i.e. isolate) installs new build-time dependencies that can be separate from runtime dependencies or previously installed packages
  • --no-build-isolation does not override previously installed packages (I think?) but makes use of what is currently installed, which is why we added this flag here to test different build package versions

If that's right, could you please add that to the description of this flag, so later maintainers understand the use of the flag in our CI?

Copy link
Member Author

Choose a reason for hiding this comment

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

Honestly I'm not really 100% sure I know exactly how build isolation works, my take is that it creates an isolated environment with brand new everything to create wheels and then it gives you the wheels back in the world you first started in.

I'll try to add something sensible here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok I've added a longer explanation and justification for how build isolation works, why we need it, etc...

I'm going to go ahead with the merge, but if you have the time to review what I wrote here and call out anything that's unclear in an issue that'd be great.

- name: install_min_deps
if: "matrix.type == 'MIN'"
run: |
pip install pytest-xdist pytest-timeout
Copy link
Member Author

Choose a reason for hiding this comment

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

Moving this here because pip installing MDAnalysisTests should have already gotten pytest, you just need ot add pytest-xdist and pytest-timeout

.github/workflows/gh-ci-cron.yaml Outdated Show resolved Hide resolved
@@ -69,6 +72,7 @@ jobs:
with:
build-tests: true
build-docs: false
isolation: false
Copy link
Member Author

Choose a reason for hiding this comment

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

turn off isolation here because we want to build with the nightly wheels

- name: build_srcs
uses: ./.github/actions/build-src
with:
build-tests: true
build-docs: false
isolation: false
Copy link
Member Author

Choose a reason for hiding this comment

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

build with the deps you have installed

.github/workflows/gh-ci.yaml Show resolved Hide resolved
@@ -152,6 +158,7 @@ jobs:
with:
build-tests: true
build-docs: true
isolation: false
Copy link
Member Author

Choose a reason for hiding this comment

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

no need for isolation if we have all the dependencies here

azure-pipelines.yml Show resolved Hide resolved
displayName: 'Build MDAnalysis'
condition: and(succeeded(), eq(variables['BUILD_TYPE'], 'normal'))
- powershell: pip list
displayName: 'Check installed packages'
Copy link
Member Author

Choose a reason for hiding this comment

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

Keeping this around so we can get an idea of what's in the environment ahead of testing

# than NEP29 (see: https://numpy.org/doc/stable/dev/depending_on_numpy.html#adding-a-dependency-on-numpy)
# We pin our wheel installation to that and a maximum of numpy 2.0 since
# this will likely involve several breaking changes
"numpy>=1.25,<2.0; python_version>='3.9'",
Copy link
Member Author

Choose a reason for hiding this comment

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

NumPy 1.25+ is backwards compatible with its C/C++ API, so (as shown in the CI tests) we can build with it and then use an older version of NumPy at runtime and things just work.

@IAlibay IAlibay marked this pull request as ready for review August 15, 2023 03:54
@IAlibay
Copy link
Member Author

IAlibay commented Aug 15, 2023

Alright can I ask for a priority re-review & merge here @MDAnalysis/coredevs ? I would like to get this merged to get the 2.6.0 release out.

@IAlibay IAlibay changed the title [wip] build wheels with numpy 1.25+ Build wheels with numpy 1.25+ Aug 15, 2023
Copy link
Member

@lilyminium lilyminium left a comment

Choose a reason for hiding this comment

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

LGTM but IMO more documentation would be a huge help for future maintenance. Thanks for this @IAlibay

.github/workflows/gh-ci.yaml Show resolved Hide resolved
@@ -9,6 +9,10 @@ inputs:
description: 'build MDA docs'
required: true
default: false
isolation:
Copy link
Member

Choose a reason for hiding this comment

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

It took me a couple readings of this comment and the pip documentation to understand (if I have this correctly) that:

  • default (i.e. isolate) installs new build-time dependencies that can be separate from runtime dependencies or previously installed packages
  • --no-build-isolation does not override previously installed packages (I think?) but makes use of what is currently installed, which is why we added this flag here to test different build package versions

If that's right, could you please add that to the description of this flag, so later maintainers understand the use of the flag in our CI?

@IAlibay
Copy link
Member Author

IAlibay commented Aug 15, 2023

Thanks for the quick review @lilyminium ! I'll go ahead and merge when CI returns green so we can move ahead with the release.

@IAlibay
Copy link
Member Author

IAlibay commented Aug 15, 2023

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@IAlibay IAlibay merged commit fa0fb82 into develop Aug 15, 2023
22 of 23 checks passed
@IAlibay IAlibay deleted the numpy-1.25 branch August 15, 2023 15:41
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.

[CI/CD] Switch wheel deployment pins to 1.25+
4 participants