Skip to content

Commit b2667e8

Browse files
committed
Remove animation bits deprecated in 3.3.
1 parent 60d4906 commit b2667e8

File tree

4 files changed

+28
-102
lines changed

4 files changed

+28
-102
lines changed

doc/api/animation_api.rst

+1-4
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ on all systems.
186186

187187
FFMpegWriter
188188
ImageMagickWriter
189-
AVConvWriter
190189

191190
The file-based writers save temporary files for each frame which are stitched
192191
into a single file at the end. Although slower, these writers can be easier to
@@ -198,7 +197,6 @@ debug.
198197

199198
FFMpegFileWriter
200199
ImageMagickFileWriter
201-
AVConvFileWriter
202200

203201
Fundamentally, a `MovieWriter` provides a way to grab sequential frames
204202
from the same underlying `~matplotlib.figure.Figure` object. The base
@@ -283,7 +281,6 @@ and mixins
283281
:toctree: _as_gen
284282
:nosignatures:
285283

286-
AVConvBase
287284
FFMpegBase
288285
ImageMagickBase
289286

@@ -298,6 +295,6 @@ Inheritance Diagrams
298295
:private-bases:
299296
:parts: 1
300297

301-
.. inheritance-diagram:: matplotlib.animation.AVConvFileWriter matplotlib.animation.AVConvWriter matplotlib.animation.FFMpegFileWriter matplotlib.animation.FFMpegWriter matplotlib.animation.ImageMagickFileWriter matplotlib.animation.ImageMagickWriter
298+
.. inheritance-diagram:: matplotlib.animation.FFMpegFileWriter matplotlib.animation.FFMpegWriter matplotlib.animation.ImageMagickFileWriter matplotlib.animation.ImageMagickWriter
302299
:private-bases:
303300
:parts: 1

doc/api/next_api_changes/removals/20465-ES.rst

+20
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,23 @@ Case-insensitive capstyles and joinstyles
88
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
99
Please pass capstyles ("miter", "round", "bevel") and joinstyles ("butt",
1010
"round", "projecting") as lowercase.
11+
12+
AVConv animation writers removed
13+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
14+
The ``AVConvBase``, ``AVConvWriter`` and ``AVConvFileWriter`` classes, and the
15+
associated ``animation.avconv_path`` and ``animation.avconv_args`` rcParams
16+
have been removed.
17+
18+
Debian 8 (2015, EOL 06/2020) and Ubuntu 14.04 (EOL 04/2019) were the
19+
last versions of Debian and Ubuntu to ship avconv. It remains possible
20+
to force the use of avconv by using the FFmpeg-based writers with
21+
:rc:`animation.ffmpeg_path` set to "avconv".
22+
23+
``MovieWriter`` attributes
24+
~~~~~~~~~~~~~~~~~~~~~~~~~~
25+
* ``animation.html_args`` rcParam
26+
* ``HTMLWriter.args_key`` attribute
27+
* ``MovieWriter.args_key`` and ``MovieWriter.exec_key`` attributes
28+
* *clear_temp* parameter and attribute of `.FileMovieWriter`; files placed in a
29+
temporary directory (using ``frame_prefix=None``, the default) will be
30+
cleared; files placed elsewhere will not.

lib/matplotlib/animation.py

+6-89
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,6 @@ class MovieWriter(AbstractMovieWriter):
261261
# stored. Third-party writers cannot meaningfully set these as they cannot
262262
# extend rcParams with new keys.
263263

264-
exec_key = _api.deprecate_privatize_attribute("3.3")
265-
args_key = _api.deprecate_privatize_attribute("3.3")
266-
267264
# Pipe-based writers only support RGBA, but file-based ones support more
268265
# formats.
269266
supported_formats = ["rgba"]
@@ -407,9 +404,7 @@ def __init__(self, *args, **kwargs):
407404
super().__init__(*args, **kwargs)
408405
self.frame_format = mpl.rcParams['animation.frame_format']
409406

410-
@_api.delete_parameter("3.3", "clear_temp")
411-
def setup(self, fig, outfile, dpi=None, frame_prefix=None,
412-
clear_temp=True):
407+
def setup(self, fig, outfile, dpi=None, frame_prefix=None):
413408
"""
414409
Setup for writing the movie file.
415410
@@ -423,13 +418,10 @@ def setup(self, fig, outfile, dpi=None, frame_prefix=None,
423418
The dpi of the output file. This, with the figure size,
424419
controls the size in pixels of the resulting movie file.
425420
frame_prefix : str, optional
426-
The filename prefix to use for temporary files. If None (the
421+
The filename prefix to use for temporary files. If *None* (the
427422
default), files are written to a temporary directory which is
428-
deleted by `cleanup` (regardless of the value of *clear_temp*).
429-
clear_temp : bool, optional
430-
If the temporary files should be deleted after stitching
431-
the final result. Setting this to ``False`` can be useful for
432-
debugging. Defaults to ``True``.
423+
deleted by `cleanup`; if not *None*, no temporary files are
424+
deleted.
433425
"""
434426
self.fig = fig
435427
self.outfile = outfile
@@ -444,7 +436,6 @@ def setup(self, fig, outfile, dpi=None, frame_prefix=None,
444436
else:
445437
self._tmpdir = None
446438
self.temp_prefix = frame_prefix
447-
self._clear_temp = clear_temp
448439
self._frame_counter = 0 # used for generating sequential file names
449440
self._temp_paths = list()
450441
self.fname_format_str = '%s%%07d.%s'
@@ -453,15 +444,6 @@ def __del__(self):
453444
if self._tmpdir:
454445
self._tmpdir.cleanup()
455446

456-
@_api.deprecated("3.3")
457-
@property
458-
def clear_temp(self):
459-
return self._clear_temp
460-
461-
@clear_temp.setter
462-
def clear_temp(self, value):
463-
self._clear_temp = value
464-
465447
@property
466448
def frame_format(self):
467449
"""
@@ -488,10 +470,9 @@ def _base_temp_name(self):
488470

489471
def grab_frame(self, **savefig_kwargs):
490472
# docstring inherited
491-
# Overloaded to explicitly close temp file.
492473
# Creates a filename for saving using basename and counter.
493474
path = Path(self._base_temp_name() % self._frame_counter)
494-
self._temp_paths.append(path) # Record the filename for later cleanup.
475+
self._temp_paths.append(path) # Record the filename for later use.
495476
self._frame_counter += 1 # Ensures each created name is unique.
496477
_log.debug('FileMovieWriter.grab_frame: Grabbing frame %d to path=%s',
497478
self._frame_counter, path)
@@ -510,12 +491,6 @@ def _cleanup(self): # Inline to finish() once cleanup() is removed.
510491
if self._tmpdir:
511492
_log.debug('MovieWriter: clearing temporary path=%s', self._tmpdir)
512493
self._tmpdir.cleanup()
513-
else:
514-
if self._clear_temp:
515-
_log.debug('MovieWriter: clearing temporary paths=%s',
516-
self._temp_paths)
517-
for path in self._temp_paths:
518-
path.unlink()
519494

520495

521496
@writers.register('pillow')
@@ -582,17 +557,6 @@ def output_args(self):
582557

583558
return args + ['-y', self.outfile]
584559

585-
@classmethod
586-
def isAvailable(cls):
587-
return (
588-
super().isAvailable()
589-
# Ubuntu 12.04 ships a broken ffmpeg binary which we shouldn't use.
590-
# NOTE: when removed, remove the same method in AVConvBase.
591-
and b'LibAv' not in subprocess.run(
592-
[cls.bin_path()], creationflags=subprocess_creation_flags,
593-
stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL,
594-
stderr=subprocess.PIPE).stderr)
595-
596560

597561
# Combine FFMpeg options with pipe-based writing
598562
@writers.register('ffmpeg')
@@ -651,45 +615,6 @@ def _args(self):
651615
return [self.bin_path(), *args, *self.output_args]
652616

653617

654-
# Base class of avconv information. AVConv has identical arguments to FFMpeg.
655-
@_api.deprecated('3.3')
656-
class AVConvBase(FFMpegBase):
657-
"""
658-
Mixin class for avconv output.
659-
660-
To be useful this must be multiply-inherited from with a
661-
`MovieWriterBase` sub-class.
662-
"""
663-
664-
_exec_key = 'animation.avconv_path'
665-
_args_key = 'animation.avconv_args'
666-
667-
# NOTE : should be removed when the same method is removed in FFMpegBase.
668-
isAvailable = classmethod(MovieWriter.isAvailable.__func__)
669-
670-
671-
# Combine AVConv options with pipe-based writing
672-
@writers.register('avconv')
673-
class AVConvWriter(AVConvBase, FFMpegWriter):
674-
"""
675-
Pipe-based avconv writer.
676-
677-
Frames are streamed directly to avconv via a pipe and written in a single
678-
pass.
679-
"""
680-
681-
682-
# Combine AVConv options with file-based writing
683-
@writers.register('avconv_file')
684-
class AVConvFileWriter(AVConvBase, FFMpegFileWriter):
685-
"""
686-
File-based avconv writer.
687-
688-
Frames are written to temporary files on disk and then stitched
689-
together at the end.
690-
"""
691-
692-
693618
# Base class for animated GIFs with ImageMagick
694619
class ImageMagickBase:
695620
"""
@@ -794,8 +719,6 @@ class HTMLWriter(FileMovieWriter):
794719
"""Writer for JavaScript-based HTML movies."""
795720

796721
supported_formats = ['png', 'jpeg', 'tiff', 'svg']
797-
args_key = _api.deprecated("3.3")(property(
798-
lambda self: 'animation.html_args'))
799722

800723
@classmethod
801724
def isAvailable(cls):
@@ -892,19 +815,13 @@ def finish(self):
892815

893816
# duplicate the temporary file clean up logic from
894817
# FileMovieWriter.cleanup. We can not call the inherited
895-
# versions of finished or cleanup because both assume that
818+
# versions of finish or cleanup because both assume that
896819
# there is a subprocess that we either need to call to merge
897820
# many frames together or that there is a subprocess call that
898821
# we need to clean up.
899822
if self._tmpdir:
900823
_log.debug('MovieWriter: clearing temporary path=%s', self._tmpdir)
901824
self._tmpdir.cleanup()
902-
else:
903-
if self._clear_temp:
904-
_log.debug('MovieWriter: clearing temporary paths=%s',
905-
self._temp_paths)
906-
for path in self._temp_paths:
907-
path.unlink()
908825

909826

910827
class Animation:

lib/matplotlib/rcsetup.py

+1-9
Original file line numberDiff line numberDiff line change
@@ -1236,16 +1236,10 @@ def _convert_validator_spec(key, conv):
12361236
# Controls image format when frames are written to disk
12371237
"animation.frame_format": ["png", "jpeg", "tiff", "raw", "rgba", "ppm",
12381238
"sgi", "bmp", "pbm", "svg"],
1239-
# Additional arguments for HTML writer
1240-
"animation.html_args": validate_stringlist,
12411239
# Path to ffmpeg binary. If just binary name, subprocess uses $PATH.
12421240
"animation.ffmpeg_path": _validate_pathlike,
12431241
# Additional arguments for ffmpeg movie writer (using pipes)
12441242
"animation.ffmpeg_args": validate_stringlist,
1245-
# Path to AVConv binary. If just binary name, subprocess uses $PATH.
1246-
"animation.avconv_path": _validate_pathlike,
1247-
# Additional arguments for avconv movie writer (using pipes)
1248-
"animation.avconv_args": validate_stringlist,
12491243
# Path to convert binary. If just binary name, subprocess uses $PATH.
12501244
"animation.convert_path": _validate_pathlike,
12511245
# Additional arguments for convert movie writer (using pipes)
@@ -1261,9 +1255,7 @@ def _convert_validator_spec(key, conv):
12611255
# ... because they are private:
12621256
"_internal.classic_mode": False,
12631257
# ... because they are deprecated:
1264-
"animation.avconv_path": "avconv",
1265-
"animation.avconv_args": [],
1266-
"animation.html_args": [],
1258+
# No current deprecations.
12671259
# backend is handled separately when constructing rcParamsDefault.
12681260
}
12691261
_validators = {k: _convert_validator_spec(k, conv)

0 commit comments

Comments
 (0)