Skip to content
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

Add support for Python 3.13 #3967

Merged
merged 52 commits into from
Dec 2, 2024
Merged

Conversation

JasonGrace2282
Copy link
Member

@JasonGrace2282 JasonGrace2282 commented Oct 20, 2024

Python 3.13 has been out for a week or two now, it's highly probable that new users to Manim may start off with python 3.13. As such, we should start testing it.

All tests pass locally on my machine, and looking through the porting guide there isn't much to be concerned about (except a small change w.r.t. functools.partial which I don't think applies to us).

This COMPLETELY REMOVES the upper python version bound. See https://iscinumpy.dev/post/bound-version-constraints/ for why upper bounds on python versions is a terrible idea.

(marking as a draft until tests pass on all operating systems)

Changes

  • Remove python upper bound
  • Use scipy >=1.14.0 for python >=3.13
  • Require moderngl-window >= 3.0.2
  • Require numpy>=2.0
  • Add dependency audioop-lts after removal of stdlib audioop library.

@JasonGrace2282 JasonGrace2282 added the maintenance refactoring, typos, removing clutter/dead code, and other code quality improvements label Oct 20, 2024
@JasonGrace2282 JasonGrace2282 added this to the v0.19.0 milestone Oct 20, 2024
@JasonGrace2282 JasonGrace2282 self-assigned this Oct 20, 2024
@behackl
Copy link
Member

behackl commented Oct 27, 2024

Tried to replicate the 3.13 issue on Windows locally, effectively killed my stream doing so. :-)

Full Log
C:\Users\benja\src\manim\.venv\Lib\site-packages\_pytest\config\__init__.py:331: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
Plugin: helpconfig, Hook: pytest_cmdline_parse
ConftestImportFailure: ImportError: DLL load failed while importing _core: The paging file is too small for this operation to complete. (from C:\Users\benja\src\manim\conftest.py)
For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
  config = pluginmanager.hook.pytest_cmdline_parse(
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "C:\Users\benja\src\manim\.venv\Lib\site-packages\_pytest\main.py", line 269, in wrap_session
INTERNALERROR>     config.hook.pytest_sessionstart(session=session)
INTERNALERROR>     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "C:\Users\benja\src\manim\.venv\Lib\site-packages\pluggy\_hooks.py", line 513, in __call__
INTERNALERROR>     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR>            ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "C:\Users\benja\src\manim\.venv\Lib\site-packages\pluggy\_manager.py", line 120, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>            ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "C:\Users\benja\src\manim\.venv\Lib\site-packages\pluggy\_callers.py", line 182, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>            ~~~~~~~~~~~~~~~~~~^^
INTERNALERROR>   File "C:\Users\benja\src\manim\.venv\Lib\site-packages\pluggy\_result.py", line 100, in get_result
INTERNALERROR>     raise exc.with_traceback(exc.__traceback__)
INTERNALERROR>   File "C:\Users\benja\src\manim\.venv\Lib\site-packages\pluggy\_callers.py", line 103, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "C:\Users\benja\src\manim\.venv\Lib\site-packages\xdist\dsession.py", line 79, in pytest_sessionstart
INTERNALERROR>     nodes = self.nodemanager.setup_nodes(putevent=self.queue.put)
INTERNALERROR>   File "C:\Users\benja\src\manim\.venv\Lib\site-packages\xdist\workermanage.py", line 66, in setup_nodes
INTERNALERROR>     return [self.setup_node(spec, putevent) for spec in self.specs]
INTERNALERROR>             ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
INTERNALERROR>   File "C:\Users\benja\src\manim\.venv\Lib\site-packages\xdist\workermanage.py", line 69, in setup_node
INTERNALERROR>     gw = self.group.makegateway(spec)
INTERNALERROR>   File "C:\Users\benja\src\manim\.venv\Lib\site-packages\execnet\multi.py", line 154, in makegateway
INTERNALERROR>     gw = gateway_bootstrap.bootstrap(io, spec)
INTERNALERROR>   File "C:\Users\benja\src\manim\.venv\Lib\site-packages\execnet\gateway_bootstrap.py", line 88, in bootstrap
INTERNALERROR>     bootstrap_import(io, spec)
INTERNALERROR>     ~~~~~~~~~~~~~~~~^^^^^^^^^^
INTERNALERROR>   File "C:\Users\benja\src\manim\.venv\Lib\site-packages\execnet\gateway_bootstrap.py", line 36, in bootstrap_import
INTERNALERROR>     s = io.read(1)
INTERNALERROR>   File "C:\Users\benja\src\manim\.venv\Lib\site-packages\execnet\gateway_base.py", line 536, in read
INTERNALERROR>     raise EOFError("expected %d bytes, got %d" % (numbytes, len(buf)))
INTERNALERROR> EOFError: expected 1 bytes, got 0
Exception ignored in atexit callback <bound method Group._cleanup_atexit of <Group []>>:
Traceback (most recent call last):
C:\Users\benja\src\manim\.venv\Lib\site-packages\_pytest\config\__init__.py:331: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
Plugin: helpconfig, Hook: pytest_cmdline_parse
MemoryError:
For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
  config = pluginmanager.hook.pytest_cmdline_parse(
C:\Users\benja\src\manim\.venv\Lib\site-packages\_pytest\config\__init__.py:331: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
Plugin: helpconfig, Hook: pytest_cmdline_parse
ConftestImportFailure: MemoryError:  (from C:\Users\benja\src\manim\conftest.py)
For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
  config = pluginmanager.hook.pytest_cmdline_parse(
C:\Users\benja\src\manim\.venv\Lib\site-packages\_pytest\config\__init__.py:331: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
Plugin: helpconfig, Hook: pytest_cmdline_parse
ConftestImportFailure: ImportError: DLL load failed while importing _bounded_integers: The paging file is too small for this operation to complete. (from C:\Users\benja\src\manim\conftest.py)
For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
  config = pluginmanager.hook.pytest_cmdline_parse(
C:\Users\benja\src\manim\.venv\Lib\site-packages\_pytest\config\__init__.py:331: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
Plugin: helpconfig, Hook: pytest_cmdline_parse
ConftestImportFailure: ImportError: DLL load failed while importing _pathops: The paging file is too small for this operation to complete. (from C:\Users\benja\src\manim\conftest.py)
For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
  config = pluginmanager.hook.pytest_cmdline_parse(
C:\Users\benja\src\manim\.venv\Lib\site-packages\_pytest\config\__init__.py:331: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
Plugin: helpconfig, Hook: pytest_cmdline_parse
ConftestImportFailure: MemoryError:  (from C:\Users\benja\src\manim\conftest.py)
For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
  config = pluginmanager.hook.pytest_cmdline_parse(
C:\Users\benja\src\manim\.venv\Lib\site-packages\_pytest\config\__init__.py:331: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
Plugin: helpconfig, Hook: pytest_cmdline_parse
ConftestImportFailure: ImportError: DLL load failed while importing _cairo: The paging file is too small for this operation to complete. (from C:\Users\benja\src\manim\conftest.py)
For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
  config = pluginmanager.hook.pytest_cmdline_parse(
C:\Users\benja\src\manim\.venv\Lib\site-packages\_pytest\config\__init__.py:331: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
Plugin: helpconfig, Hook: pytest_cmdline_parse
ConftestImportFailure: ImportError: DLL load failed while importing mtrand: The paging file is too small for this operation to complete. (from C:\Users\benja\src\manim\conftest.py)
For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
  config = pluginmanager.hook.pytest_cmdline_parse(
C:\Users\benja\src\manim\.venv\Lib\site-packages\_pytest\config\__init__.py:331: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
Plugin: helpconfig, Hook: pytest_cmdline_parse
ConftestImportFailure: ImportError: DLL load failed while importing _core: The paging file is too small for this operation to complete. (from C:\Users\benja\src\manim\conftest.py)
For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
  config = pluginmanager.hook.pytest_cmdline_parse(
PS C:\Users\benja\src\manim> C:\Users\benja\src\manim\.venv\Lib\site-packages\_pytest\main.py:306: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
Plugin: 2050814534256, Hook: pytest_sessionfinish
OSError: cannot send (already closed?)
For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
  config.hook.pytest_sessionfinish(
C:\Users\benja\src\manim\.venv\Lib\site-packages\_pytest\main.py:306: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
Plugin: 2679295664752, Hook: pytest_sessionfinish
OSError: cannot send (already closed?)
For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
  config.hook.pytest_sessionfinish(

@behackl
Copy link
Member

behackl commented Nov 16, 2024

Alright, this was rather annoying -- but here we are; our tests are passing for all OS/Python version combinations.

There were a bunch of breaking changes mandated due to the need to upgrade numpy to >=2.0 (mainly in the doctests). Actually requiring numpy>=2.0 makes our dependencies unsatisfiable due to moderngl-window requiring numpy<2 (reported upstream, likely to be resolved with their next release).

I am not sure what to do with this PR in the meantime; probably we will just have to wait until moderngl-window has a new release.

@behackl behackl changed the title Start testing python 3.13 Add support for Python 3.13 Nov 16, 2024
@JasonGrace2282 JasonGrace2282 marked this pull request as ready for review November 30, 2024 22:58
@@ -58,6 +89,7 @@ def manim_caplog(caplog):
@pytest.fixture
def config():
saved = manim.config.copy()
manim.config.renderer = "cairo"
Copy link
Member Author

Choose a reason for hiding this comment

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

Should this be reverted?

Copy link
Member

Choose a reason for hiding this comment

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

This fixed a bunch of tests that were mistakenly run with the opengl renderer, we should keep it for now.

Curiously, the pipeline failed again in the pathological case, am looking into details.

Copy link
Member

@behackl behackl left a comment

Choose a reason for hiding this comment

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

Official Python 3.13 support, here we go! 🚀

@behackl behackl merged commit e749330 into ManimCommunity:main Dec 2, 2024
21 checks passed
@JasonGrace2282 JasonGrace2282 deleted the py313 branch December 2, 2024 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance refactoring, typos, removing clutter/dead code, and other code quality improvements
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants