Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Simplify extension setup. #11964

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 1 commit into from
Feb 27, 2019
Merged

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Aug 28, 2018

setupext currently has a complex machinery to define extension modules.
Essentially, the problem is that numpy may not be installed at the time
the extensions are declared, so we can't call np.get_include() to get
the include paths. So we use a DelayedExtension class and a hook
mechanism to inject the numpy include path later, once it becomes
available.

Instead, we can just declare a dummy extension (so that setuptools
doesn't elide the call to build_ext), then swap in the correct
extensions in build_ext.finalize_options(): at that point, numpy will
have been installed and we don't need any crazy machinery.

Also closes #6928 by not attempting to reload numpy anymore.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@anntzer anntzer added the Build label Aug 28, 2018
@anntzer
Copy link
Contributor Author

anntzer commented Dec 29, 2018

Rebased on top of #11983 which makes things a bit simpler.

@tacaswell
Copy link
Member

Tried to power cycled to see if it would simplify the diff now that #11983 is merged, @anntzer mind rebasing this again to make it easier to review?

@anntzer
Copy link
Contributor Author

anntzer commented Dec 30, 2018

Done.

@jklymak jklymak added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Feb 10, 2019
@jklymak
Copy link
Member

jklymak commented Feb 10, 2019

Marking release critical so it gets some love.. I'd review, but really don't grok whats going on here. But if someone more knowledgeable reviewed, I'd be comfortable approving as not doing anything dangerous.

@timhoffm
Copy link
Member

Sorry, can’t help either. Not experienced in setuptools.

Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

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

As discussed on call this simplifies the build process and we will not discover any edge cases until we try to build all of the wheels / packages.

@anntzer
Copy link
Contributor Author

anntzer commented Feb 26, 2019

@tacaswell do you want to entice a second reviewer? :)

Copy link
Member

@QuLogic QuLogic left a comment

Choose a reason for hiding this comment

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

Dunno if you want to change this one line.

setupext currently has a complex machinery to define extension modules.
Essentially, the problem is that numpy may not be installed at the time
the extensions are declared, so we can't call np.get_include() to get
the include paths.  So we use a DelayedExtension class and a hook
mechanism to inject the numpy include path later, once it becomes
available.

Instead, we can just declare a dummy extension (so that setuptools
doesn't elide the call to build_ext), then swap in the correct
extensions in build_ext.finalize_options(): at that point, numpy will
have been installed and we don't need any crazy machinery.
@dstansby
Copy link
Member

Going to merge based on two previous +ive reviews.

@dstansby dstansby merged commit 85eb5eb into matplotlib:master Feb 27, 2019
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Feb 27, 2019
@anntzer anntzer deleted the delayedextension branch February 27, 2019 12:38
dstansby added a commit that referenced this pull request Feb 27, 2019
…964-on-v3.1.x

Backport PR #11964 on branch v3.1.x (Simplify extension setup.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot run setup.py build with numpy master
6 participants