Skip to content

pillow-dependency update #11132

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

Conversation

ImportanceOfBeingErnest
Copy link
Member

PR Summary

Document the minimum optional Pillow version.
Fixes #10633.

PR Checklist

  • Code is PEP 8 compliant
  • Documentation is sphinx and numpydoc compliant

@dstansby
Copy link
Member

It really annoys me that the string "3.4" is hardcoded in several places in the code, instead of being in one place that it is pulled from, but I guess there's no easy way to do that?

@ImportanceOfBeingErnest
Copy link
Member Author

This PR changes the code to have that number appear only once in the code, namely in backend_bases.py. Any descendent backend can import _has_pil.

Or are you saying the documentation should pull it from the code?

@dstansby
Copy link
Member

Yeah, ideally. Presumably it's also defined in a pip requirements file somewhere too.

_has_pil = True
del Image
except ImportError:
except (ImportError, AssertionError):
Copy link
Member

Choose a reason for hiding this comment

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

Instead of catching an AssertionError, I think it would be better to have an if block that checks the version.

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, changed that now. Any reason for this? Is it bad style or does it have any side effects?

Copy link
Member

Choose a reason for hiding this comment

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

It's just more specific than catching a general error, that might be raised by other bits of code that aren't the specific assertion line you added.

@ImportanceOfBeingErnest
Copy link
Member Author

Yeah, ideally.

I'd agree, but I don't know how that would be done with Sphinx.

Presumably it's also defined in a pip requirements file somewhere too.

I don't think so because Pillow is not actually a requirement, just an optional thing, which, if present, allows to have further functionality included.

@timhoffm
Copy link
Member

Don‘t know either how it could be done with Sphinx. But since we‘ll rarely change the version dependency, it’s ok to hard code in the docs.

@timhoffm timhoffm merged commit 9b3ac28 into matplotlib:master Apr 28, 2018
@tacaswell tacaswell added this to the v3.0 milestone Apr 29, 2018
@ImportanceOfBeingErnest ImportanceOfBeingErnest deleted the pillow-dependency branch May 10, 2018 15:52
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.

4 participants