-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Deprecate MovieWriterRegistry cache-dirtyness system. #13567
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
Conversation
MovieWriterRegistry has a fairly extensive system to cache whether movie writer classes are available or not. Deprecate it and always perform the check every time: for nearly all classes, the availability check is either an import check (Pillow), or checking for whether an executable is in the $PATH -- this is negligible compared to actually running the executable to encode the movie. The only exception is that ffmpeg actually checks whether it is actually ffmpeg or ubuntu's broken libav. In order to avoid performing that check (... which should still be not so slow) when Pillow is available (Pillow is registered first, so comes first :)), add `MovieWriterRegistry.__iter__` which allows to get the first available writer without checking the availability of the subsequent ones (this behavior is consistent with `MovieWriterRegistry.__getitem__` and `MovieWriterRegistry.list`).
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 to me like a good simplification, but @dopplershift should have the final say.
if self.is_available(name): | ||
yield name | ||
|
||
def list(self): |
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.
Is this really necessary? Isn't reg.list()
just the same as list(reg)
?
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.
Oh, I see. This preserves API.
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.
Well, I can deprecate it too if you don't mind the API change...
I was using 2.2.2 version and "import matplotlib.animation as animation" was stuck when executed in background. I updated to 3.2.2 which fixed that but now it get stuck at "Writer = animation.writers['ffmpeg']" My testcase is quite simple: When I run this file as python3 check.py & it is stuck forever, however when run in foreground it works well. Thanks |
@blusingh Can you open as a new issue rather than adding to this PR thread? |
MovieWriterRegistry has a fairly extensive system to cache whether movie
writer classes are available or not. Deprecate it and always perform
the check every time: for nearly all classes, the availability check is
either an import check (Pillow), or checking for whether an executable
is in the $PATH -- this is negligible compared to actually running the
executable to encode the movie.
The only exception is that ffmpeg actually checks whether it is
actually ffmpeg or ubuntu's broken libav. In order to avoid performing
that check (... which should still be not so slow) when Pillow is
available (Pillow is registered first, so comes first :)), add
MovieWriterRegistry.__iter__
which allows to get the first availablewriter without checking the availability of the subsequent ones (this
behavior is consistent with
MovieWriterRegistry.__getitem__
andMovieWriterRegistry.list
).PR Summary
PR Checklist