Title: [Bug]: FuncAnimation function not typed properly · Issue #29960 · matplotlib/matplotlib · GitHub
Open Graph Title: [Bug]: FuncAnimation function not typed properly · Issue #29960 · matplotlib/matplotlib
X Title: [Bug]: FuncAnimation function not typed properly · Issue #29960 · matplotlib/matplotlib
Description: Bug summary Type checkers complain when one uses a function that returns None as the parameter of FuncAnimation. However, when blit=False, the return value of the function is ignored. Code for reproduction import matplotlib.pyplot as plt...
Open Graph Description: Bug summary Type checkers complain when one uses a function that returns None as the parameter of FuncAnimation. However, when blit=False, the return value of the function is ignored. Code for repr...
X Description: Bug summary Type checkers complain when one uses a function that returns None as the parameter of FuncAnimation. However, when blit=False, the return value of the function is ignored. Code for repr...
Opengraph URL: https://github.com/matplotlib/matplotlib/issues/29960
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Bug]: FuncAnimation function not typed properly","articleBody":"### Bug summary\n\nType checkers complain when one uses a function that returns `None` as the parameter of `FuncAnimation`. However, when `blit=False`, the return value of the function is ignored.\n\n### Code for reproduction\n\n```Python\nimport matplotlib.pyplot as plt\nfrom matplotlib import rc\nfrom matplotlib.animation import FuncAnimation\n\nrc(\"animation\", html=\"jshtml\")\n\nfig, ax = plt.subplots()\n\ndef update(frame: int) -\u003e None:\n ax.plot([0, 1], [frame, frame])\n\nFuncAnimation(fig, update, range(10))\n```\n\n### Actual outcome\n\nMyPy says `Argument 2 to \"FuncAnimation\" has incompatible type \"Callable[[int], None]\"; expected \"Callable[..., Iterable[Artist]]\"`, but the code executes without problems.\n\n### Expected outcome\n\nNo MyPy error.\n\n### Additional information\n\nI think is possible to allow functions that return arbitrary `object` by combining `overload` and `Literal[True]` / `Literal[False]` for the `blit` argument.\n\n### Operating system\n\nAny\n\n### Matplotlib Version\n\n3.10.0\n\n### Matplotlib Backend\n\n_No response_\n\n### Python version\n\n_No response_\n\n### Jupyter version\n\n_No response_\n\n### Installation\n\npip","author":{"url":"https://github.com/vnmabus","@type":"Person","name":"vnmabus"},"datePublished":"2025-04-22T18:29:38.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":12},"url":"https://github.com/29960/matplotlib/issues/29960"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:843bbd0e-721a-fe54-0311-5b21f3f5f9fc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D084:20FBF5:19A1B55:221B743:6A52CB6B |
| html-safe-nonce | fa7e521726d55a3c47b20c6b43f6b1f18644c846cef0bee06d9852f18065d402 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMDg0OjIwRkJGNToxOUExQjU1OjIyMUI3NDM6NkE1MkNCNkIiLCJ2aXNpdG9yX2lkIjoiMzE0OTQ4MzE3MzI5NTA4MjM0NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8ffee7782f8afa453da2367598da7bfdcfe0a4c3f18d3a78a0e15223659ebb2e |
| hovercard-subject-tag | issue:3011823117 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/matplotlib/matplotlib/29960/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f3fdcee951c4f8d151b0e2d2088822b07d263f7a50f7ae730820e9f1a647484a/matplotlib/matplotlib/issues/29960 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f3fdcee951c4f8d151b0e2d2088822b07d263f7a50f7ae730820e9f1a647484a/matplotlib/matplotlib/issues/29960 |
| og:image:alt | Bug summary Type checkers complain when one uses a function that returns None as the parameter of FuncAnimation. However, when blit=False, the return value of the function is ignored. Code for repr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vnmabus |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width