Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions pkgs/development/python-modules/manim/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
lib,
buildPythonPackage,
fetchFromGitHub,
texliveInfraOnly,

# build-system
poetry-core,
pytest-xdist,
pytestCheckHook,
pythonOlder,

# buildInputs
cairo,
ffmpeg,
texliveInfraOnly,

# dependencies
av,
beautifulsoup4,
click,
cloup,
decorator,
isosurfaces,
jupyterlab,
manimpango,
mapbox-earcut,
moderngl,
moderngl-window,
networkx,
notebook,
numpy,
pillow,
pycairo,
Expand All @@ -36,6 +36,17 @@
tqdm,
typing-extensions,
watchdog,

# optional-dependencies
jupyterlab,
notebook,

# tests
ffmpeg,
pytest-cov-stub,
pytest-xdist,
pytestCheckHook,
versionCheckHook,
}:

let
Expand Down Expand Up @@ -175,41 +186,26 @@ in
buildPythonPackage rec {
pname = "manim";
pyproject = true;
version = "0.18.1";
disabled = pythonOlder "3.9";
version = "0.19.0";

src = fetchFromGitHub {
owner = "ManimCommunity";
repo = "manim";
tag = "v${version}";
hash = "sha256-o+Wl3NMK6yopcsRVFtZuUE9c1GABa5d8rbQNHDJ4OiQ=";
hash = "sha256-eQgp/GwKsfQA1ZgqfB3HF2ThEgH3Fbn9uAtcko9pkjs=";
};

build-system = [
poetry-core
];

pythonRelaxDeps = [
"cloup"
"isosurfaces"
"pillow"
"skia-pathops"
"watchdog"
];

patches = [ ./pytest-report-header.patch ];

postPatch = ''
substituteInPlace pyproject.toml \
--replace "--no-cov-on-fail --cov=manim --cov-report xml --cov-report term" ""

substituteInPlace manim/_config/default.cfg \
--replace "ffmpeg_executable = ffmpeg" "ffmpeg_executable = ${lib.getExe ffmpeg}"
'';

buildInputs = [ cairo ];

dependencies = [
av
beautifulsoup4
click
cloup
decorator
Expand Down Expand Up @@ -257,25 +253,29 @@ buildPythonPackage rec {
nativeCheckInputs = [
ffmpeg
manim-tinytex
pytest-cov-stub
pytest-xdist
pytestCheckHook
versionCheckHook
Copy link
Member

Choose a reason for hiding this comment

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

versionCheckHook should be in nativeInstallCheckInputs, and doInstallCheck should be set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Usually yes, but not for python packages (unless I'm wrong).
I was never able to get the installCheckPhase running on them. I don't remember well, but I think that there is a reason.

Copy link
Member

Choose a reason for hiding this comment

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

Let's ask @mweinelt

Copy link
Member

@mweinelt mweinelt Jan 21, 2025

Choose a reason for hiding this comment

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

For Python checkPhase is mapped to the installCheckPhase 🤷‍♂️

#324124

];
versionCheckProgramArg = [ "--version" ];

# about 55 of ~600 tests failing mostly due to demand for display
disabledTests = import ./failing_tests.nix;

pythonImportsCheck = [ "manim" ];

meta = with lib; {
meta = {
description = "Animation engine for explanatory math videos - Community version";
longDescription = ''
Manim is an animation engine for explanatory math videos. It's used to
create precise animations programmatically, as seen in the videos of
3Blue1Brown on YouTube. This is the community maintained version of
manim.
'';
changelog = "https://docs.manim.community/en/latest/changelog/${version}-changelog.html";
homepage = "https://github.com/ManimCommunity/manim";
license = licenses.mit;
license = lib.licenses.mit;
maintainers = [ ];
};
}
40 changes: 27 additions & 13 deletions pkgs/development/python-modules/manim/pytest-report-header.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
diff --git a/conftest.py b/conftest.py
index dacb730a..149c6702 100644
--- a/conftest.py
+++ b/conftest.py
@@ -33,17 +33,3 @@ def temp_media_dir(tmpdir, monkeypatch, request):
with tempconfig({"media_dir": str(tmpdir)}):
assert config.media_dir == str(tmpdir)
yield tmpdir
-
-
diff --git a/tests/conftest.py b/tests/conftest.py
index 4de34bbb..07b4bea6 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -4,31 +4,11 @@ import logging
import sys
from pathlib import Path

-import cairo
-import moderngl
import pytest

import manim


-def pytest_report_header(config):
- ctx = moderngl.create_standalone_context()
- info = ctx.info
- ctx.release()
- try:
- ctx = moderngl.create_standalone_context()
- info = ctx.info
- ctx.release()
- except Exception as e:
- raise Exception("Error while creating moderngl context") from e
-
- return (
- f"\nCairo Version: {cairo.cairo_version()}",
- "\nOpenGL information",
Expand All @@ -20,3 +29,8 @@ index dacb730a..149c6702 100644
- f"renderer: {info['GL_RENDERER'].strip()}",
- f"version: {info['GL_VERSION'].strip()}\n",
- )
-
-
def pytest_addoption(parser):
parser.addoption(
"--skip_slow",