Skip to content

Defer matplotlib imports - #2281

Closed
mdboom wants to merge 1 commit into
scikit-image:masterfrom
mdboom:reduce-matplotlib-dependency
Closed

mdboom wants to merge 1 commit into
scikit-image:masterfrom
mdboom:reduce-matplotlib-dependency

Conversation

@mdboom

@mdboom mdboom commented Sep 1, 2016

Copy link
Copy Markdown
Contributor

Description

I have a new project that for various reasons I won't get into must be delivered as a standalone PyInstaller .exe.

With skimage importing matplotlib at the top level, all of matplotlib, and thus all of Qt and a bunch of other stuff gets pulled in.

Maybe it's weird getting a PR to reduce the use of matplotlib from me of all people... ;) But this particular app doesn't use matplotlib at all.

Checklist

  • Unit tests

I'm a little unsure about how to write a unit test for this -- the test suite still rightly and understandably imports matplotlib, so we can't just assert that it wasn't imported.

@@ -469,6 +466,9 @@ def show_rag(labels, rag, img, border_color='black', edge_width=1.5,
>>> lc = graph.show_rag(labels, g, img)
>>> cbar = plt.colorbar(lc)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the doctest here is failing (see travis build), please import matplotlib as plt

@emmanuelle

Copy link
Copy Markdown
Member

Please correct the doctest, otherwise LGTM.

@sciunto

sciunto commented Sep 2, 2016

Copy link
Copy Markdown
Member

Once @emmanuelle 's comment is addressed, I'm +1.

@soupault

soupault commented Sep 2, 2016

Copy link
Copy Markdown
Member

I'm actually 👎 on this. I remember there was a huge amount of discussions on how to treat matplotlib.
This PR decreases the code clarity and performance, and I don't think we have to do this as skimage is not in the first place a library to deploy image processing solutions.

@mdboom have you tried to "play" with a list of ignored [sub]packages in PyInstaller build config to exclude Qt-related parts?

@sciunto

sciunto commented Sep 2, 2016 •

Copy link
Copy Markdown
Member

The discussion I have in mind is there: #2103

@emmanuelle

Copy link
Copy Markdown
Member

So, if I understand well, the discussion in #2103 was rather in favor of limiting the matplotlib dependency. Since scikit-image is a library and not a tool for the end-user only, if other projects can use it for a different purpose than interactive image processing, good for them.

@sciunto sciunto added 🔧 type: Maintenance Refactoring and maintenance of internals ⚖️ Needs decision labels Sep 3, 2016
@emmanuelle

Copy link
Copy Markdown
Member

Since some maintainers had contradicting views on this PR, can we get another opinion? @stefanv @ahojnnes @JDWarner

@ahojnnes

ahojnnes commented Sep 4, 2016 •

Copy link
Copy Markdown
Member

I am fine with the proposed change in this PR. No strong opinion either way.

@sciunto

sciunto commented Nov 20, 2016

Copy link
Copy Markdown
Member

Gentle ping to @stefanv @JDWarner What do you think?

@jni

jni commented Nov 28, 2016

Copy link
Copy Markdown
Member

@mdboom Could you update the PR to fix the doctest? I'm with @emmanuelle and @ahojnnes on this.

@stefanv

stefanv commented Apr 6, 2017

Copy link
Copy Markdown
Member

I think we should merge this. I've done a rebase and pushed to #2596

@stefanv stefanv closed this Apr 6, 2017
@stefanv

stefanv commented Apr 6, 2017

Copy link
Copy Markdown
Member

I'm actually not sure what the correct "protocol" is in this case. Keep the PR open and annoy the original author by further requests? Enable Travis-CI on my own branch, run the test suite on a commit there, and verify it works before merging? Make a new PR?

@sciunto

sciunto commented Apr 7, 2017

Copy link
Copy Markdown
Member

@stefanv +1 I think that should be discussed on the ML.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚖️ Needs decision 🔧 type: Maintenance Refactoring and maintenance of internals

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants