Hi Guix! This patch series adds the necessary packages for Manim, an animation engine for mathematical animations which can be used in educational maths videos. I have read the "Submitting Patches" section in the Guix manual and have confirmed that the packages build as expected. However, I have disabled tests for the following packages: * python-manim * python-mapbox-earcut * python-moderngl-window * python-pyglet * python-moderngl This is either because they need a DISPLAY to conduct the tests or because the tests are failing and I don't know how to fix it. Your help will be appreciated :) Thanks, Daniel Daniel Meißner (12): gnu: Add python-cloup. gnu: Add python-cloup-0.7. gnu: Add python-glcontext. gnu: Add python-moderngl. gnu: Add python-pyglet. gnu: Add python-multipledispatch. gnu: Add python-pyrr. gnu: Add python-screeninfo. gnu: Add python-moderngl-window. gnu: Add python-manimpango. gnu: Add python-mapbox-earcut. gnu: Add python-manim 0.9.0. gnu/local.mk | 2 + .../python-manimpango-remove-manim-dep.patch | 172 +++++++++++ gnu/packages/python-science.scm | 82 +++++ gnu/packages/python-xyz.scm | 289 ++++++++++++++++++ 4 files changed, 545 insertions(+) create mode 100644 gnu/packages/patches/python-manimpango-remove-manim-dep.patch -- 2.33.0
* gnu/packages/python-xyz.scm (python-cloup): New variable. --- gnu/packages/python-science.scm | 1 + gnu/packages/python-xyz.scm | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm index 738b504e3b..d3730fadcc 100644 --- a/gnu/packages/python-science.scm +++ b/gnu/packages/python-science.scm @@ -14,6 +14,7 @@ ;;; Copyright © 2021 Roel Janssen <roel@gnu.org> ;;; Copyright © 2021 Paul Garlick <pgarlick@tourbillion-technology.com> ;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net> +;;; Copyright © 2021 Daniel Meißner <daniel.meissner-i4k@ruhr-uni-bochum.de> ;;; ;;; This file is part of GNU Guix. ;;; diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index e98eec19bc..6c7ab10216 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -3308,6 +3308,37 @@ with sensible defaults out of the box.") (base32 "0njsm0wn31l21bi118g5825ma5sa3rwn7v2x4wjd7yiiahkri337")))) (arguments `()))) +(define-public python-cloup + (package + (name "python-cloup") + (version "0.11.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "cloup" version)) + (sha256 + (base32 + "07kxw81bml137w9bfmwkjbdzbldkk1k1lws82wffz9244pp7k8ib")))) + (build-system python-build-system) + (arguments + '(#:phases (modify-phases %standard-phases + ;; test phase fails with "error: invalid command pytest" + (delete 'check)))) + (propagated-inputs + `(("python-click" ,python-click))) + (native-inputs + `(("python-setuptools" ,python-setuptools) + ("python-setuptools-scm" ,python-setuptools-scm/next) + ("python-pytest" ,python-pytest))) + (home-page "https://github.com/janLuke/cloup") + (synopsis "Extension library for python-click") + (description + "Cloup — originally from \"Click + option groups\" — enriches Click with +several features that make it more expressive and configurable: option groups, +constraints, subcommand aliases, subcommands sections and a themeable +HelpFormatter.") + (license license:bsd-3))) + (define-public python-vcversioner (package (name "python-vcversioner") -- 2.33.0
* gnu/packages/python-xyz.scm (python-cloup-0.7): New variable. --- gnu/packages/python-xyz.scm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 6c7ab10216..75646aec7f 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -3339,6 +3339,18 @@ constraints, subcommand aliases, subcommands sections and a themeable HelpFormatter.") (license license:bsd-3))) +(define-public python-cloup-0.7 + (package (inherit python-cloup) + (name "python-cloup-0.7") + (version "0.7.1") + (source + (origin + (method url-fetch) + (uri (pypi-uri "cloup" version)) + (sha256 + (base32 + "0yyxibwlxmdkm4866fm4rwpdgy3d6y18n061992ckr54vl0cav7j")))))) + (define-public python-vcversioner (package (name "python-vcversioner") -- 2.33.0
* gnu/packages/python-xyz.scm (python-glcontext): New variable. --- gnu/packages/python-xyz.scm | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 75646aec7f..251aad5b61 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -18884,6 +18884,52 @@ library.") (description "This is the Cython-coded accelerator module for PyOpenGL."))) +(define-public python-glcontext + (package + (name "python-glcontext") + (version "2.3.4") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/moderngl/glcontext") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1m2zkl696vqmgrd5k1c5kl0krk6qgjgsz88qhahwva0l40bswvhp")))) + (build-system python-build-system) + (arguments + '(#:phases + (modify-phases %standard-phases + (add-before 'build 'fix-lib-paths + (lambda* (#:key inputs outputs #:allow-other-keys) + (substitute* '("glcontext/x11.cpp" "glcontext/egl.cpp") + (("\"libGL.so\"") + (string-append "\"" (assoc-ref inputs "mesa") "/lib/libGL.so\"")) + (("\"libEGL.so\"") + (string-append "\"" (assoc-ref inputs "mesa") "/lib/libEGL.so\"")) + (("\"libX11.so\"") + (string-append "\"" (assoc-ref inputs "libx11") "/lib/libX11.so\""))) + (substitute* '("glcontext/__init__.py") + (("find_library\\('GL'\\)") + (string-append "'" (assoc-ref inputs "mesa") "/lib/libGL.so'")) + (("find_library\\('EGL'\\)") + (string-append "'" (assoc-ref inputs "mesa") "/lib/libEGL.so'")) + (("find_library\\(\"X11\"\\)") + (string-append "'" (assoc-ref inputs "libx11") "/lib/libX11.so'"))) + #t)) + ;; tests fail with: Exception: (standalone) XOpenDisplay: cannot open display + (delete 'check)))) + (inputs + `(("libx11" ,libx11) + ("mesa" ,mesa))) + (home-page "https://github.com/moderngl/glcontext") + (synopsis "Portable OpenGL Context for ModernGL") + (description "Python-glcontext is a library providing OpenGL implementation +for ModernGL on multiple platforms.") + (license license:expat))) + (define-public python-rencode (package (name "python-rencode") -- 2.33.0
* gnu/packages/python-xyz.scm (python-moderngl): New variable. --- gnu/packages/python-xyz.scm | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 251aad5b61..394f30226f 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -18930,6 +18930,33 @@ library.") for ModernGL on multiple platforms.") (license license:expat))) +(define-public python-moderngl + (package + (name "python-moderngl") + (version "5.6.4") + (source + (origin + (method url-fetch) + (uri (pypi-uri "moderngl" version)) + (sha256 + (base32 + "1ysinnyr3rkdisbihdrn1623l3rw45nx8p2j31dgffsykxah8vcc")))) + (build-system python-build-system) + (propagated-inputs + `(("python-glcontext" ,python-glcontext))) + (home-page + "https://github.com/moderngl/moderngl") + (synopsis + "Python wrapper for OpenGL") + (description "ModernGL is a python wrapper over OpenGL 3.3+ core that +simplifies the creation of simple graphics applications like scientific +simulations, games or user interfaces. Usually, acquiring in-depth knowledge +of OpenGL requires a steep learning curve. In contrast, ModernGL is easy to +learn and use, moreover it is capable of rendering with high performance and +quality, with less code written. The majority of the moderngl code base is +also written in C++ for high performance.") + (license license:expat))) + (define-public python-rencode (package (name "python-rencode") -- 2.33.0
* gnu/packages/python-xyz.scm (python-pyglet): New variable. --- gnu/packages/python-xyz.scm | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 394f30226f..e1e676490b 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -18957,6 +18957,48 @@ quality, with less code written. The majority of the moderngl code base is also written in C++ for high performance.") (license license:expat))) +(define-public python-pyglet + (package + (name "python-pyglet") + (version "1.5.18") + (source + (origin + (method url-fetch) + (uri (pypi-uri "pyglet" version ".zip")) + (sha256 + (base32 + "044ib8x6pv5rjwj210hq37ry7vi5bizmqkkv1zj8967prk5ii8sq")))) + (build-system python-build-system) + (arguments + '(;; tests fail with: TypeError: don't know how to make test from: + ;; <pyglet._ModuleProxy object at ...> + #:tests? #f + #:phases (modify-phases %standard-phases + (add-before 'build 'fix-lib-paths + (lambda* (#:key inputs outputs #:allow-other-keys) + (substitute* '("pyglet/gl/lib_glx.py") + (("'GL'") + (string-append "\"" (assoc-ref inputs "mesa") + "/lib/libGL.so\"")) + (("'GLU'") + (string-append "\"" (assoc-ref inputs "glu") + "/lib/libGLU.so\""))) + #t))))) + (inputs + `(("mesa" ,mesa) + ("glu" ,glu))) + (native-inputs `(("unzip" ,unzip))) + (home-page + "https://pyglet.readthedocs.io") + (synopsis + "Cross-platform windowing and multimedia Python library") + (description + "Pyglet is a Python library for developing games and other visually-rich +applications. It supports windowing, user interface event handling, +Joysticks, OpenGL graphics, loading images and videos, and playing sounds and +music. All of this with a friendly Pythonic API that's simple to learn.") + (license license:bsd-3))) + (define-public python-rencode (package (name "python-rencode") -- 2.33.0
* gnu/packages/python-xyz.scm (python-multipledispatch): New variable. --- gnu/packages/python-xyz.scm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index e1e676490b..0102dbc4bb 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -18957,6 +18957,26 @@ quality, with less code written. The majority of the moderngl code base is also written in C++ for high performance.") (license license:expat))) +(define-public python-multipledispatch + (package + (name "python-multipledispatch") + (version "0.6.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "multipledispatch" version)) + (sha256 + (base32 + "1slblghfjg9fdi9zpd7gmrkvfbv20nrdgnrymcnbky8bzm8i9ax7")))) + (build-system python-build-system) + (propagated-inputs `(("python-six" ,python-six))) + (home-page + "https://github.com/mrocklin/multipledispatch/") + (synopsis "Multiple dispatch library for Python") + (description "This library defines a decorator that makes dispatching on +types more concise to write. ") + (license license:bsd-3))) + (define-public python-pyglet (package (name "python-pyglet") -- 2.33.0
* gnu/packages/python-xyz.scm (python-pyrr): New variable. --- gnu/packages/python-xyz.scm | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 0102dbc4bb..eb0e67c98d 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -18977,6 +18977,31 @@ also written in C++ for high performance.") types more concise to write. ") (license license:bsd-3))) +(define-public python-pyrr + (package + (name "python-pyrr") + (version "0.10.3") + (source + (origin + (method url-fetch) + (uri (pypi-uri "pyrr" version)) + (sha256 + (base32 + "07byxkq8dcc8n6fc2q7g3vq3mxzzj0hqzm8hlq3gfwbf68h7n3rw")))) + (build-system python-build-system) + (propagated-inputs + `(("python-multipledispatch" ,python-multipledispatch) + ("python-numpy" ,python-numpy))) + (home-page + "https://github.com/adamlwgriffiths/Pyrr") + (synopsis + "Mathematical functions for 3D graphics using NumPy") + (description + "A collection of object-oriented and procedural interfaces for working +with matrices, quaternions, vectors and plane/line/ray objects for 3D +graphics.") + (license license:bsd-3))) + (define-public python-pyglet (package (name "python-pyglet") -- 2.33.0
* gnu/packages/python-xyz.scm (python-screeninfo): New variable. --- gnu/packages/python-xyz.scm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index eb0e67c98d..bdda967d94 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -19044,6 +19044,28 @@ Joysticks, OpenGL graphics, loading images and videos, and playing sounds and music. All of this with a friendly Pythonic API that's simple to learn.") (license license:bsd-3))) +(define-public python-screeninfo + (package + (name "python-screeninfo") + (version "0.7") + (source + (origin + (method url-fetch) + (uri (pypi-uri "screeninfo" version)) + (sha256 + (base32 + "007m7sqv30qak56885dxbijksrg2hd121hfpvg2llm734wspra8j")))) + (build-system python-build-system) + (native-inputs `(("python-pytest" ,python-pytest))) + (home-page "https://github.com/rr-/screeninfo") + (synopsis + "Obtain information about physical screens") + (description + "This python module provides means to access information about physical +screens like resolution, height and width of the screen, connecting port +etc.") + (license (list license:expat license:bsd-3)))) + (define-public python-rencode (package (name "python-rencode") -- 2.33.0
* gnu/packages/python-xyz.scm (python-moderngl-window): New variable. --- gnu/packages/python-xyz.scm | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index bdda967d94..765b3f0a57 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -19044,6 +19044,41 @@ Joysticks, OpenGL graphics, loading images and videos, and playing sounds and music. All of this with a friendly Pythonic API that's simple to learn.") (license license:bsd-3))) +(define-public python-moderngl-window + (package + (name "python-moderngl-window") + (version "2.4.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/moderngl/moderngl-window") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1fvhm6ln3q5kl5m5q3gzfmx1kpyn054fhpcrgpqz8809dxi7pzcv")))) + (build-system python-build-system) + (arguments + '(#:phases + (modify-phases %standard-phases + ;; tests fail with: TypeError: don't know how to make test from: + ;; <moderngl_window.resources.data.DataFiles object at ...> + (delete 'check)))) + (propagated-inputs + `(("python-pillow" ,python-pillow) + ("python-pyrr" ,python-pyrr) + ("python-numpy" ,python-numpy) + ("python-moderngl" ,python-moderngl) + ("python-pyglet" ,python-pyglet))) + (home-page "https://github.com/moderngl/moderngl-window") + (synopsis "Cross-platform utility library for ModernGL") + (description "This ModernGL utility library simplifies window creation and +resource loading. You can create a window for ModernGL using pyglet, pygame, +PySide2, GLFW, SDL2, PyQt5 or tkinter. Events are unified into a single event +system. Resource loading includes loading of 2D textures/texture arrays, +shaders and objects/scenes.") + (license license:expat))) + (define-public python-screeninfo (package (name "python-screeninfo") -- 2.33.0
* gnu/packages/python-science.scm (python-manimpango): New variable. --- gnu/local.mk | 2 + .../python-manimpango-remove-manim-dep.patch | 172 ++++++++++++++++++ gnu/packages/python-science.scm | 28 +++ 3 files changed, 202 insertions(+) create mode 100644 gnu/packages/patches/python-manimpango-remove-manim-dep.patch diff --git a/gnu/local.mk b/gnu/local.mk index 175e691a63..87be4a1b0a 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -44,6 +44,7 @@ # Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net> # Copyright © 2021 Sharlatan Hellseher <sharlatanus@gmail.com> # Copyright © 2021 Dmitry Polyakov <polyakov@liltechdude.xyz> +# Copyright © 2021 Daniel Meißner <daniel.meissner-i4k@ruhr-uni-bochum.de> # # This file is part of GNU Guix. # @@ -1646,6 +1647,7 @@ dist_patch_DATA = \ %D%/packages/patches/python-pyfakefs-remove-bad-test.patch \ %D%/packages/patches/python-flint-includes.patch \ %D%/packages/patches/python-libxml2-utf8.patch \ + %D%/packages/patches/python-manimpango-remove-manim-dep.patch \ %D%/packages/patches/python-matplotlib-run-under-wayland-gtk3.patch \ %D%/packages/patches/python-memcached-syntax-warnings.patch \ %D%/packages/patches/python-mox3-python3.6-compat.patch \ diff --git a/gnu/packages/patches/python-manimpango-remove-manim-dep.patch b/gnu/packages/patches/python-manimpango-remove-manim-dep.patch new file mode 100644 index 0000000000..579c2302d8 --- /dev/null +++ b/gnu/packages/patches/python-manimpango-remove-manim-dep.patch @@ -0,0 +1,172 @@ +Fix dependency on manim for tests + +This fixes a circular dependency between manim and manimpango. + +Extracted from upstream: +https://github.com/ManimCommunity/ManimPango/commit/7e2b17aa14b10bd58af0598cc2de51a406682797 + +diff --git a/tests/_manim.py b/tests/_manim.py +index 3ea4676..b11d3e9 100644 +--- a/tests/_manim.py ++++ b/tests/_manim.py +@@ -2,11 +2,12 @@ + """This file contains helpers for the tests copied and modified + from Manim. + """ +- ++import copy + import os ++import re + from pathlib import Path + +-from manimpango import Alignment, MarkupUtils ++from manimpango import Alignment, MarkupUtils, TextSetting, text2svg + + + class MarkupText: +@@ -104,3 +105,115 @@ class MarkupText: + + def __repr__(self): + return f"MarkupText({repr(self.original_text)})" ++ ++ ++class Text: ++ def __init__( ++ self, ++ text: str, ++ fill_opacity: float = 1.0, ++ stroke_width: int = 0, ++ size: int = 1, ++ line_spacing: int = -1, ++ font: str = "", ++ slant: str = "NORMAL", ++ weight: str = "NORMAL", ++ gradient: tuple = None, ++ tab_width: int = 4, ++ disable_ligatures: bool = False, ++ filename: str = "text.svg", ++ **kwargs, ++ ) -> None: ++ self.size = size ++ self.filename = filename ++ self.line_spacing = line_spacing ++ self.font = font ++ self.slant = slant ++ self.weight = weight ++ self.gradient = gradient ++ self.tab_width = tab_width ++ self.original_text = text ++ self.disable_ligatures = disable_ligatures ++ text_without_tabs = text ++ self.t2f = self.t2s = self.t2w = {} ++ if text.find("\t") != -1: ++ text_without_tabs = text.replace("\t", " " * self.tab_width) ++ self.text = text_without_tabs ++ if self.line_spacing == -1: ++ self.line_spacing = self.size + self.size * 0.3 ++ else: ++ self.line_spacing = self.size + self.size * self.line_spacing ++ self.text2svg() ++ ++ def text2settings(self): ++ """Internally used function. Converts the texts and styles ++ to a setting for parsing.""" ++ settings = [] ++ t2x = [self.t2f, self.t2s, self.t2w] ++ for i in range(len(t2x)): ++ fsw = [self.font, self.slant, self.weight] ++ if t2x[i]: ++ for word, x in list(t2x[i].items()): ++ for start, end in self.find_indexes(word, self.text): ++ fsw[i] = x ++ settings.append(TextSetting(start, end, *fsw)) ++ # Set all text settings (default font, slant, weight) ++ fsw = [self.font, self.slant, self.weight] ++ settings.sort(key=lambda setting: setting.start) ++ temp_settings = settings.copy() ++ start = 0 ++ for setting in settings: ++ if setting.start != start: ++ temp_settings.append(TextSetting(start, setting.start, *fsw)) ++ start = setting.end ++ if start != len(self.text): ++ temp_settings.append(TextSetting(start, len(self.text), *fsw)) ++ settings = sorted(temp_settings, key=lambda setting: setting.start) ++ ++ if re.search(r"\n", self.text): ++ line_num = 0 ++ for start, end in self.find_indexes("\n", self.text): ++ for setting in settings: ++ if setting.line_num == -1: ++ setting.line_num = line_num ++ if start < setting.end: ++ line_num += 1 ++ new_setting = copy.copy(setting) ++ setting.end = end ++ new_setting.start = end ++ new_setting.line_num = line_num ++ settings.append(new_setting) ++ settings.sort(key=lambda setting: setting.start) ++ break ++ for setting in settings: ++ if setting.line_num == -1: ++ setting.line_num = 0 ++ return settings ++ ++ def text2svg(self): ++ """Internally used function. ++ Convert the text to SVG using Pango ++ """ ++ size = self.size * 10 ++ line_spacing = self.line_spacing * 10 ++ dir_name = Path(self.filename).parent ++ disable_liga = self.disable_ligatures ++ if not os.path.exists(dir_name): ++ os.makedirs(dir_name) ++ file_name = self.filename ++ settings = self.text2settings() ++ width = 600 ++ height = 400 ++ ++ return text2svg( ++ settings, ++ size, ++ line_spacing, ++ disable_liga, ++ file_name, ++ 30, ++ 30, ++ width, ++ height, ++ self.text, ++ ) +diff --git a/tests/test_fonts.py b/tests/test_fonts.py +index 51e7eb4..da42895 100644 +--- a/tests/test_fonts.py ++++ b/tests/test_fonts.py +@@ -3,13 +3,12 @@ import sys + from pathlib import Path + from shutil import copyfile + +-import manim + import pytest + + import manimpango + + from . import FONT_DIR +-from ._manim import MarkupText ++from ._manim import MarkupText, Text + + font_lists = { + (FONT_DIR / "AdobeVFPrototype.ttf").absolute(): "Adobe Variable Font Prototype", +@@ -38,7 +37,7 @@ def test_register_font(font_name): + @pytest.mark.parametrize("font_name", font_lists.values()) + def test_warning(capfd, font_name): + print(font_name) +- manim.Text("Testing", font=font_name) ++ Text("Testing", font=font_name) + captured = capfd.readouterr() + assert "Pango-WARNING **" not in captured.err, "Looks like pango raised a warning?" + +-- +2.32.0 diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm index d3730fadcc..fcd983520c 100644 --- a/gnu/packages/python-science.scm +++ b/gnu/packages/python-science.scm @@ -38,6 +38,7 @@ #:use-module (gnu packages check) #:use-module (gnu packages databases) #:use-module (gnu packages gcc) + #:use-module (gnu packages gtk) #:use-module (gnu packages image-processing) #:use-module (gnu packages machine-learning) #:use-module (gnu packages maths) @@ -982,3 +983,30 @@ pandas notebooks, scripts, and libraries. Unlike other distributed DataFrame libraries, Modin provides seamless integration and compatibility with existing pandas code.") (license license:asl2.0))) + +(define-public python-manimpango + (package + (name "python-manimpango") + (version "0.3.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "ManimPango" version)) + (sha256 + (base32 + "1j2mbhf7d82718nkc0r8x7cf35hlh13b67qkczjbbys3w24nyfsw")) + (patches (search-patches "python-manimpango-remove-manim-dep.patch")))) + (build-system python-build-system) + (native-inputs + `(("pkg-config" ,pkg-config) + ("Cython" ,python-cython) + ("python-pytest" ,python-pytest))) + (inputs + `(("pango" ,pango))) + (home-page "https://manimpango.manim.community/") + (synopsis + "Bindings for pango for use with Manim") + (description + "These are Python bindings for Pango to be used with the mathematical +animation software Manim.") + (license license:gpl3+))) -- 2.33.0
* gnu/packages/python-science.scm (python-mapbox-earcut): New variable. --- gnu/packages/python-xyz.scm | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 765b3f0a57..00ed032855 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -19079,6 +19079,35 @@ system. Resource loading includes loading of 2D textures/texture arrays, shaders and objects/scenes.") (license license:expat))) +(define-public python-mapbox-earcut + (package + (name "python-mapbox-earcut") + (version "0.12.10") + (source + (origin + (method url-fetch) + (uri (pypi-uri "mapbox_earcut" version)) + (sha256 + (base32 + "0ly48lijgd9inq07x42pfp9c24fn16vn9axpmfwqrkn979krbnah")))) + (build-system python-build-system) + (propagated-inputs + `(("python-numpy" ,python-numpy))) + (native-inputs + `(("python-pytest" ,python-pytest) + ("python-wheel" ,python-wheel) + ("setuptools-scm" ,python-setuptools-scm) + ("cmake" ,cmake))) + (home-page + "https://github.com/skogler/mapbox_earcut_python") + (synopsis + "Python bindings for the Mapbox Earcut C++ polygon triangulation library") + (description + "The Mapbox Earcut library is a header-only C++ library which provides a +fast and robust triangulation of 2D polygons. This package provides Python +bindings for this library.") + (license license:isc))) + (define-public python-screeninfo (package (name "python-screeninfo") -- 2.33.0
* gnu/packages/python-science.scm (python-manim): New variable. --- gnu/packages/python-science.scm | 53 +++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm index fcd983520c..d653ebca95 100644 --- a/gnu/packages/python-science.scm +++ b/gnu/packages/python-science.scm @@ -36,6 +36,7 @@ #:use-module (gnu packages) #:use-module (gnu packages base) #:use-module (gnu packages check) + #:use-module (gnu packages cmake) #:use-module (gnu packages databases) #:use-module (gnu packages gcc) #:use-module (gnu packages gtk) @@ -1010,3 +1011,55 @@ pandas code.") "These are Python bindings for Pango to be used with the mathematical animation software Manim.") (license license:gpl3+))) + +(define-public python-manim + (package + (name "python-manim") + (version "0.9.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "manim" version)) + (sha256 + (base32 + "0ksp57wcy45xkjips5i4wwm690mhbs2dmlcgsbmiwx78mfk4z0r3")))) + (build-system python-build-system) + (arguments '(;; tests fail with: + ;; pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect + ;; to "None" + #:tests? #f)) + (propagated-inputs + `(("python-click" ,python-click) + ("python-click-default-group" + ,python-click-default-group) + ("python-cloup" ,python-cloup-0.7) + ("python-colour" ,python-colour) + ("python-decorator" ,python-decorator) + ("python-manimpango" ,python-manimpango) + ("python-mapbox-earcut" ,python-mapbox-earcut) + ("python-moderngl" ,python-moderngl) + ("python-moderngl-window" + ,python-moderngl-window) + ("python-networkx" ,python-networkx) + ("python-numpy" ,python-numpy) + ("python-pillow" ,python-pillow) + ("python-pycairo" ,python-pycairo) + ("python-pydub" ,python-pydub) + ("python-pygments" ,python-pygments) + ("python-requests" ,python-requests) + ("python-rich" ,python-rich) + ("python-scipy" ,python-scipy) + ("python-screeninfo" ,python-screeninfo) + ("python-tqdm" ,python-tqdm) + ("python-watchdog" ,python-watchdog))) + (native-inputs + `(("python-wheel" ,python-wheel))) + (home-page "https://www.manim.community/") + (synopsis + "Python animation engine for explanatory math videos") + (description + "Manim is a Python library for creating mathematical animations. The +animations are written as Python code which is based on predefined objects. +You can make animations with maths formulas (LaTeX-based), simple shapes, 3D +objects, function graphs and more.") + (license license:expat))) -- 2.33.0
Hi Daniel,
Am Freitag, den 10.09.2021, 13:22 +0200 schrieb Daniel Meißner:
> Hi Guix!
>
> This patch series adds the necessary packages for Manim, an animation
> engine for mathematical animations which can be used in educational
> maths videos. I have read the "Submitting Patches" section in the
> Guix manual and have confirmed that the packages build as
> expected. However, I have disabled tests for the following packages:
>
> * python-manim
> * python-mapbox-earcut
> * python-moderngl-window
> * python-pyglet
> * python-moderngl
>
> This is either because they need a DISPLAY to conduct the tests or
> because the tests are failing and I don't know how to fix it. Your
> help will be appreciated :)
For the tests that need DISPLAY, the usual thing we do here is to spawn
an Xvfb for display :1 and set DISPLAY accordingly. There are several
variants depending on what exactly else you need (some with dbus, some
without), simply grep for "xorg-server-for-tests" and you ought to find
one that fits your needs.
Once we find out the packages that fail regardless, that have no easy
fix, it is still acceptable to fix a few failing tests manually by
patching the test suite, or if all else fails use `#:tests? #f' with an
appropriate comment.
Regards
[-- Attachment #1.1: Type: text/plain, Size: 2717 bytes --] On Fri, Sep 10 2021, Daniel Meißner via Guix-patches via wrote: > * gnu/packages/python-xyz.scm (python-cloup): New variable. > --- > gnu/packages/python-science.scm | 1 + > gnu/packages/python-xyz.scm | 31 +++++++++++++++++++++++++++++++ > 2 files changed, 32 insertions(+) > > diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm > index 738b504e3b..d3730fadcc 100644 > --- a/gnu/packages/python-science.scm > +++ b/gnu/packages/python-science.scm > @@ -14,6 +14,7 @@ > ;;; Copyright © 2021 Roel Janssen <roel@gnu.org> > ;;; Copyright © 2021 Paul Garlick <pgarlick@tourbillion-technology.com> > ;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net> > +;;; Copyright © 2021 Daniel Meißner <daniel.meissner-i4k@ruhr-uni-bochum.de> > ;;; > ;;; This file is part of GNU Guix. > ;;; > diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm > index e98eec19bc..6c7ab10216 100644 > --- a/gnu/packages/python-xyz.scm > +++ b/gnu/packages/python-xyz.scm > @@ -3308,6 +3308,37 @@ with sensible defaults out of the box.") > (base32 "0njsm0wn31l21bi118g5825ma5sa3rwn7v2x4wjd7yiiahkri337")))) > (arguments `()))) > > +(define-public python-cloup > + (package > + (name "python-cloup") > + (version "0.11.0") > + (source > + (origin > + (method url-fetch) > + (uri (pypi-uri "cloup" version)) > + (sha256 > + (base32 > + "07kxw81bml137w9bfmwkjbdzbldkk1k1lws82wffz9244pp7k8ib")))) > + (build-system python-build-system) > + (arguments > + '(#:phases (modify-phases %standard-phases > + ;; test phase fails with "error: invalid command pytest" > + (delete 'check)))) The tests run after applying the attached patch. I also took the liberty of fixing the formatting of the synopsis and description. :-) > + (propagated-inputs > + `(("python-click" ,python-click))) > + (native-inputs > + `(("python-setuptools" ,python-setuptools) > + ("python-setuptools-scm" ,python-setuptools-scm/next) > + ("python-pytest" ,python-pytest))) > + (home-page "https://github.com/janLuke/cloup") > + (synopsis "Extension library for python-click") > + (description > + "Cloup — originally from \"Click + option groups\" — enriches Click with > +several features that make it more expressive and configurable: option groups, > +constraints, subcommand aliases, subcommands sections and a themeable > +HelpFormatter.") > + (license license:bsd-3))) > + > (define-public python-vcversioner > (package > (name "python-vcversioner") > -- > 2.33.0 [-- Attachment #1.2: 0001-gnu-Add-python-cloup.patch --] [-- Type: text/x-patch, Size: 2936 bytes --] From 574d6706ee0472b2e5e10a42af9bf9ded017a3f1 Mon Sep 17 00:00:00 2001 Message-Id: <574d6706ee0472b2e5e10a42af9bf9ded017a3f1.1631388580.git.public@yoctocell.xyz> From: =?UTF-8?q?Daniel=20Mei=C3=9Fner=20via=20Guix-patches=20via?= <guix-patches@gnu.org> Date: Fri, 10 Sep 2021 13:24:51 +0200 Subject: [PATCH] gnu: Add python-cloup. * gnu/packages/python-xyz.scm (python-cloup): New variable. Co-authored-by: Xinglu Chen <public@yoctocell.xyz> --- gnu/packages/python-science.scm | 1 + gnu/packages/python-xyz.scm | 35 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm index 738b504e3b..d3730fadcc 100644 --- a/gnu/packages/python-science.scm +++ b/gnu/packages/python-science.scm @@ -14,6 +14,7 @@ ;;; Copyright © 2021 Roel Janssen <roel@gnu.org> ;;; Copyright © 2021 Paul Garlick <pgarlick@tourbillion-technology.com> ;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net> +;;; Copyright © 2021 Daniel Meißner <daniel.meissner-i4k@ruhr-uni-bochum.de> ;;; ;;; This file is part of GNU Guix. ;;; diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 7c70829de9..2db7ccc0ee 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -3307,6 +3307,41 @@ with sensible defaults out of the box.") (base32 "0njsm0wn31l21bi118g5825ma5sa3rwn7v2x4wjd7yiiahkri337")))) (arguments `()))) +(define-public python-cloup + (package + (name "python-cloup") + (version "0.11.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "cloup" version)) + (sha256 + (base32 + "07kxw81bml137w9bfmwkjbdzbldkk1k1lws82wffz9244pp7k8ib")))) + (build-system python-build-system) + (arguments + '(#:phases + (modify-phases %standard-phases + (replace 'check + (lambda* (#:key inputs outputs tests? #:allow-other-keys) + (when tests? + (add-installed-pythonpath inputs outputs) + (invoke "python" "-m" "pytest"))))))) + (propagated-inputs + `(("python-click" ,python-click))) + (native-inputs + `(("python-setuptools" ,python-setuptools) + ("python-setuptools-scm" ,python-setuptools-scm/next) + ("python-pytest" ,python-pytest))) + (home-page "https://github.com/janLuke/cloup") + (synopsis "Extension library for @code{python-click}") + (description + "Cloup---originally from ``Click + option groups''---enriches +@code{python-click} with several features that make it more expressive and +configurable: option groups, constraints, subcommand aliases, subcommands +sections, and a themeable @code{HelpFormatter}.") + (license license:bsd-3))) + (define-public python-vcversioner (package (name "python-vcversioner") -- 2.33.0 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 861 bytes --]
[-- Attachment #1: Type: text/plain, Size: 2961 bytes --] On Fri, Sep 10 2021, Daniel Meißner via Guix-patches via wrote: > * gnu/packages/python-xyz.scm (python-glcontext): New variable. > --- > gnu/packages/python-xyz.scm | 46 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 46 insertions(+) > > diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm > index 75646aec7f..251aad5b61 100644 > --- a/gnu/packages/python-xyz.scm > +++ b/gnu/packages/python-xyz.scm > @@ -18884,6 +18884,52 @@ library.") > (description > "This is the Cython-coded accelerator module for PyOpenGL."))) > > +(define-public python-glcontext > + (package > + (name "python-glcontext") > + (version "2.3.4") > + (source > + (origin > + (method git-fetch) > + (uri (git-reference > + (url "https://github.com/moderngl/glcontext") > + (commit version))) > + (file-name (git-file-name name version)) > + (sha256 > + (base32 > + "1m2zkl696vqmgrd5k1c5kl0krk6qgjgsz88qhahwva0l40bswvhp")))) > + (build-system python-build-system) > + (arguments > + '(#:phases > + (modify-phases %standard-phases > + (add-before 'build 'fix-lib-paths > + (lambda* (#:key inputs outputs #:allow-other-keys) > + (substitute* '("glcontext/x11.cpp" "glcontext/egl.cpp") > + (("\"libGL.so\"") > + (string-append "\"" (assoc-ref inputs "mesa") "/lib/libGL.so\"")) > + (("\"libEGL.so\"") > + (string-append "\"" (assoc-ref inputs "mesa") "/lib/libEGL.so\"")) > + (("\"libX11.so\"") > + (string-append "\"" (assoc-ref inputs "libx11") "/lib/libX11.so\""))) Please keep lines =<80 columns wide. Also I would use a ‘let’ form to avoid writing (assoc-ref inputs "mesa") twice. > + (substitute* '("glcontext/__init__.py") > + (("find_library\\('GL'\\)") > + (string-append "'" (assoc-ref inputs "mesa") "/lib/libGL.so'")) > + (("find_library\\('EGL'\\)") > + (string-append "'" (assoc-ref inputs "mesa") "/lib/libEGL.so'")) Likewise (‘let’ form). > + (("find_library\\(\"X11\"\\)") > + (string-append "'" (assoc-ref inputs "libx11") "/lib/libX11.so'"))) > + #t)) Phases don’t need to return #t once the ‘core-updates-frozen’ branch gets merged, which should happen soon™. :-) > + ;; tests fail with: Exception: (standalone) XOpenDisplay: cannot open display > + (delete 'check)))) > + (inputs > + `(("libx11" ,libx11) > + ("mesa" ,mesa))) > + (home-page "https://github.com/moderngl/glcontext") > + (synopsis "Portable OpenGL Context for ModernGL") > + (description "Python-glcontext is a library providing OpenGL implementation > +for ModernGL on multiple platforms.") “providing an OpenGL implementation” (missing article). [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 861 bytes --]
[-- Attachment #1: Type: text/plain, Size: 1842 bytes --] On Fri, Sep 10 2021, Daniel Meißner via Guix-patches via wrote: > * gnu/packages/python-xyz.scm (python-moderngl): New variable. > --- > gnu/packages/python-xyz.scm | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > > diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm > index 251aad5b61..394f30226f 100644 > --- a/gnu/packages/python-xyz.scm > +++ b/gnu/packages/python-xyz.scm > @@ -18930,6 +18930,33 @@ library.") > for ModernGL on multiple platforms.") > (license license:expat))) > > +(define-public python-moderngl > + (package > + (name "python-moderngl") > + (version "5.6.4") > + (source > + (origin > + (method url-fetch) > + (uri (pypi-uri "moderngl" version)) > + (sha256 > + (base32 > + "1ysinnyr3rkdisbihdrn1623l3rw45nx8p2j31dgffsykxah8vcc")))) > + (build-system python-build-system) > + (propagated-inputs > + `(("python-glcontext" ,python-glcontext))) > + (home-page > + "https://github.com/moderngl/moderngl") Nit: no need for a newline :-) > + (synopsis > + "Python wrapper for OpenGL") Likewise. > + (description "ModernGL is a python wrapper over OpenGL 3.3+ core that > +simplifies the creation of simple graphics applications like scientific > +simulations, games or user interfaces. Usually, acquiring in-depth knowledge > +of OpenGL requires a steep learning curve. In contrast, ModernGL is easy to > +learn and use, moreover it is capable of rendering with high performance and > +quality, with less code written. The majority of the moderngl code base is > +also written in C++ for high performance.") > + (license license:expat))) > + > (define-public python-rencode > (package > (name "python-rencode") > -- > 2.33.0 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 861 bytes --]
[-- Attachment #1: Type: text/plain, Size: 2659 bytes --] On Fri, Sep 10 2021, Daniel Meißner via Guix-patches via wrote: > * gnu/packages/python-xyz.scm (python-pyglet): New variable. > --- > gnu/packages/python-xyz.scm | 42 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 42 insertions(+) > > diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm > index 394f30226f..e1e676490b 100644 > --- a/gnu/packages/python-xyz.scm > +++ b/gnu/packages/python-xyz.scm > @@ -18957,6 +18957,48 @@ quality, with less code written. The majority of the moderngl code base is > also written in C++ for high performance.") > (license license:expat))) > > +(define-public python-pyglet > + (package > + (name "python-pyglet") > + (version "1.5.18") > + (source > + (origin > + (method url-fetch) > + (uri (pypi-uri "pyglet" version ".zip")) > + (sha256 > + (base32 > + "044ib8x6pv5rjwj210hq37ry7vi5bizmqkkv1zj8967prk5ii8sq")))) > + (build-system python-build-system) > + (arguments > + '(;; tests fail with: TypeError: don't know how to make test from: > + ;; <pyglet._ModuleProxy object at ...> > + #:tests? #f > + #:phases (modify-phases %standard-phases Nit: ‘modify-phase’ is usually on its own line. > + (add-before 'build 'fix-lib-paths > + (lambda* (#:key inputs outputs #:allow-other-keys) > + (substitute* '("pyglet/gl/lib_glx.py") > + (("'GL'") > + (string-append "\"" (assoc-ref inputs "mesa") > + "/lib/libGL.so\"")) > + (("'GLU'") > + (string-append "\"" (assoc-ref inputs "glu") > + "/lib/libGLU.so\""))) > + #t))))) No need for trailing #t. > + (inputs > + `(("mesa" ,mesa) > + ("glu" ,glu))) > + (native-inputs `(("unzip" ,unzip))) > + (home-page > + "https://pyglet.readthedocs.io") No need for a newline. > + (synopsis > + "Cross-platform windowing and multimedia Python library") > + (description > + "Pyglet is a Python library for developing games and other visually-rich > +applications. It supports windowing, user interface event handling, > +Joysticks, OpenGL graphics, loading images and videos, and playing sounds and > +music. All of this with a friendly Pythonic API that's simple to learn.") > + (license license:bsd-3))) > + > (define-public python-rencode > (package > (name "python-rencode") > -- > 2.33.0 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 861 bytes --]
[-- Attachment #1: Type: text/plain, Size: 1599 bytes --] On Fri, Sep 10 2021, Daniel Meißner via Guix-patches via wrote: > * gnu/packages/python-xyz.scm (python-multipledispatch): New variable. > --- > gnu/packages/python-xyz.scm | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm > index e1e676490b..0102dbc4bb 100644 > --- a/gnu/packages/python-xyz.scm > +++ b/gnu/packages/python-xyz.scm > @@ -18957,6 +18957,26 @@ quality, with less code written. The majority of the moderngl code base is > also written in C++ for high performance.") > (license license:expat))) > > +(define-public python-multipledispatch > + (package > + (name "python-multipledispatch") > + (version "0.6.0") > + (source > + (origin > + (method url-fetch) > + (uri (pypi-uri "multipledispatch" version)) > + (sha256 > + (base32 > + "1slblghfjg9fdi9zpd7gmrkvfbv20nrdgnrymcnbky8bzm8i9ax7")))) > + (build-system python-build-system) > + (propagated-inputs `(("python-six" ,python-six))) > + (home-page > + "https://github.com/mrocklin/multipledispatch/") No need for a newline. > + (synopsis "Multiple dispatch library for Python") > + (description "This library defines a decorator that makes dispatching on > +types more concise to write. ") ^ Trailing whitespace; ‘guix lint’ should have caught this. :-) > + (license license:bsd-3))) > + > (define-public python-pyglet > (package > (name "python-pyglet") > -- > 2.33.0 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 861 bytes --]
[-- Attachment #1: Type: text/plain, Size: 1969 bytes --] On Fri, Sep 10 2021, Daniel Meißner via Guix-patches via wrote: > * gnu/packages/python-xyz.scm (python-pyrr): New variable. > --- > gnu/packages/python-xyz.scm | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm > index 0102dbc4bb..eb0e67c98d 100644 > --- a/gnu/packages/python-xyz.scm > +++ b/gnu/packages/python-xyz.scm > @@ -18977,6 +18977,31 @@ also written in C++ for high performance.") > types more concise to write. ") > (license license:bsd-3))) > > +(define-public python-pyrr > + (package > + (name "python-pyrr") > + (version "0.10.3") > + (source > + (origin > + (method url-fetch) > + (uri (pypi-uri "pyrr" version)) > + (sha256 > + (base32 > + "07byxkq8dcc8n6fc2q7g3vq3mxzzj0hqzm8hlq3gfwbf68h7n3rw")))) > + (build-system python-build-system) > + (propagated-inputs > + `(("python-multipledispatch" ,python-multipledispatch) > + ("python-numpy" ,python-numpy))) > + (home-page > + "https://github.com/adamlwgriffiths/Pyrr") No need for a newline :-) > + (synopsis > + "Mathematical functions for 3D graphics using NumPy") Likewise. > + (description > + "A collection of object-oriented and procedural interfaces for working > +with matrices, quaternions, vectors and plane/line/ray objects for 3D > +graphics.") The description should consist of one or more complete sentences, see “16.4.4 Synopses and Descriptions” in the manual. Maybe This Python package provides collection of object-oriented and procedural interfaces for working with matrices, quaternions, vectors and plane/line/ray objects for 3D graphics. ? > + (license license:bsd-3))) The LICENSE file looks more like BSD-2. > + > (define-public python-pyglet > (package > (name "python-pyglet") > -- > 2.33.0 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 861 bytes --]
Hi Liliana, Liliana writes: > For the tests that need DISPLAY, the usual thing we do here is to spawn > an Xvfb for display :1 and set DISPLAY accordingly. There are several > variants depending on what exactly else you need (some with dbus, some > without), simply grep for "xorg-server-for-tests" and you ought to find > one that fits your needs. Thanks for your advice, I was able to spawn an Xvfb for display :1 like you suggested but apparently, the tests for python-manim want to create some type of cache folder. The tests now raise a different error: `Failed to create //.cache for shader cache (Permission denied)---disabling.' I have to investigate where this error message comes from. I suppose I have to set some environment variable. Nevertheless, what would be an appriopiate writable location for the cache? > Once we find out the packages that fail regardless, that have no easy > fix, it is still acceptable to fix a few failing tests manually by > patching the test suite, or if all else fails use `#:tests? #f' with an > appropriate comment. Alright, thank you. I will give the other tests another try. Best Daniel
Hi Daniel,
Am Montag, den 13.09.2021, 16:30 +0200 schrieb Daniel Meißner:
> Hi Liliana,
>
> Liliana writes:
> > For the tests that need DISPLAY, the usual thing we do here is to
> > spawn an Xvfb for display :1 and set DISPLAY accordingly. There
> > are several variants depending on what exactly else you need (some
> > with dbus, some without), simply grep for "xorg-server-for-tests"
> > and you ought to find one that fits your needs.
>
> Thanks for your advice, I was able to spawn an Xvfb for display :1
> like you suggested but apparently, the tests for python-manim want to
> create some type of cache folder. The tests now raise a different
> error: `Failed to create //.cache for shader cache (Permission
> denied)---disabling.' I have to investigate where this error message
> comes from. I suppose I have to set some environment variable.
> Nevertheless, what would be an appriopiate writable location for the
> cache?
Normally, such tests want to write to $HOME/.cache. I'm not sure why
HOME isn't homeless-shelter in this output, but setting HOME or
XDG_CACHE_HOME appropriately ought to resolve this one.
Regards,
Liliana
Am Montag, den 13.09.2021, 16:46 +0200 schrieb Liliana Marie Prikler:
> Hi Daniel,
>
> Am Montag, den 13.09.2021, 16:30 +0200 schrieb Daniel Meißner:
> > Hi Liliana,
> >
> > Liliana writes:
> > > For the tests that need DISPLAY, the usual thing we do here is to
> > > spawn an Xvfb for display :1 and set DISPLAY accordingly. There
> > > are several variants depending on what exactly else you need
> > > (some with dbus, some without), simply grep for "xorg-server-for-
> > > tests" and you ought to find one that fits your needs.
> >
> > Thanks for your advice, I was able to spawn an Xvfb for display :1
> > like you suggested but apparently, the tests for python-manim want
> > to create some type of cache folder. The tests now raise a
> > different error: `Failed to create //.cache for shader cache
> > (Permission denied)---disabling.' I have to investigate where this
> > error message comes from. I suppose I have to set some environment
> > variable. Nevertheless, what would be an appriopiate writable
> > location for the cache?
> Normally, such tests want to write to $HOME/.cache. I'm not sure why
> HOME isn't homeless-shelter in this output, but setting HOME or
> XDG_CACHE_HOME appropriately ought to resolve this one.
Oops, forgot about the value, normally we do (setenv "HOME" (getcwd))
in the build directory, for XDG_CACHE_HOME that'd be (string-append
(getcwd) "/.cache"). If whatever creates this cache doesn't honour
XDG_CACHE_HOME, you'll have to find out which variable it honours or
potentially patch it.
Happy hacking!
Hi Liliana,
Liliana writes:
> > Normally, such tests want to write to $HOME/.cache. I'm not sure
> > why
> > HOME isn't homeless-shelter in this output, but setting HOME or
> > XDG_CACHE_HOME appropriately ought to resolve this one.
> Oops, forgot about the value, normally we do (setenv "HOME" (getcwd))
> in the build directory, for XDG_CACHE_HOME that'd be (string-append
> (getcwd) "/.cache"). If whatever creates this cache doesn't honour
> XDG_CACHE_HOME, you'll have to find out which variable it honours or
> potentially patch it.
I couldn't find the right variable to make this error message
disappear. I am not even sure where the error message comes from. It
appears somewhere during the check phase of python-pyglet. However,
turned out that this error message was not responsible for the failing
tests and the tests now pass.
Best
Daniel
Hi Xinglu, thanks for your thorough review and the fix :) I will prepare a new patchset implementing the comments. Best Daniel
Hi! The following patchset implements the suggestions by Xinglu and Liliana. Main points: * fix tests for all packages BUT: python-moderngl-window still has some failing tests * Fix formatting as suggested by Xinglu Chen * Fix dependencies of python-manim and python-pyglet Open problems: Some of the tests of python-moderngl-window fail during `guix build --keep-failed python-moderngl-window'. However, when changing into the build directory and running `pytest tests' in a guix environment where the dependencies are installed, the tests pass. Any ideas? The package python-manim has an optional LaTeX dependency to allow LaTeX rendering of equations. The docs[1] say that the full package list they use is: amsmath babel-english cbfonts-fd cm-super ctex doublestroke dvisvgm everysel fontspec frcursive fundus-calligra gnu-freefont jknapltx latex-bin mathastext microtype ms physics preview ragged2e relsize rsfs setspace standalone tipa wasy wasysym xcolor xetex xkeyval Since texlive is a relatively large package: What is the best way to deal with this optional dependency? 1: https://docs.manim.community/en/stable/installation/linux.html#optional-dependencies Daniel Meißner (13): gnu: Add python-cloup. gnu: Add python-cloup-0.7. gnu: Add python-glcontext. gnu: Add python-moderngl. gnu: Add python-pyglet. gnu: Add python-multipledispatch. gnu: Add python-pyrr. gnu: Add python-screeninfo. gnu: Add python-moderngl-window. gnu: Add python-manimpango. gnu: Add python-mapbox-earcut. gnu: Add python-screeninfo-0.6. gnu: Add python-manim 0.9.0. gnu/local.mk | 3 + .../python-manimpango-remove-manim-dep.patch | 172 +++++++++ .../python-moderngl-window-skip-tests.patch | 62 ++++ gnu/packages/python-science.scm | 93 +++++ gnu/packages/python-xyz.scm | 341 ++++++++++++++++++ 5 files changed, 671 insertions(+) create mode 100644 gnu/packages/patches/python-manimpango-remove-manim-dep.patch create mode 100644 gnu/packages/patches/python-moderngl-window-skip-tests.patch -- 2.33.0
* gnu/packages/python-xyz.scm (python-cloup): New variable. Co-authored-by: Xinglu Chen <public@yoctocell.xyz> --- gnu/packages/python-science.scm | 1 + gnu/packages/python-xyz.scm | 35 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm index 738b504e3b..d3730fadcc 100644 --- a/gnu/packages/python-science.scm +++ b/gnu/packages/python-science.scm @@ -14,6 +14,7 @@ ;;; Copyright © 2021 Roel Janssen <roel@gnu.org> ;;; Copyright © 2021 Paul Garlick <pgarlick@tourbillion-technology.com> ;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net> +;;; Copyright © 2021 Daniel Meißner <daniel.meissner-i4k@ruhr-uni-bochum.de> ;;; ;;; This file is part of GNU Guix. ;;; diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index e98eec19bc..202cf569d5 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -3308,6 +3308,41 @@ with sensible defaults out of the box.") (base32 "0njsm0wn31l21bi118g5825ma5sa3rwn7v2x4wjd7yiiahkri337")))) (arguments `()))) +(define-public python-cloup + (package + (name "python-cloup") + (version "0.11.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "cloup" version)) + (sha256 + (base32 + "07kxw81bml137w9bfmwkjbdzbldkk1k1lws82wffz9244pp7k8ib")))) + (build-system python-build-system) + (arguments + '(#:phases + (modify-phases %standard-phases + (replace 'check + (lambda* (#:key inputs outputs tests? #:allow-other-keys) + (when tests? + (add-installed-pythonpath inputs outputs) + (invoke "python" "-m" "pytest"))))))) + (propagated-inputs + `(("python-click" ,python-click))) + (native-inputs + `(("python-setuptools" ,python-setuptools) + ("python-setuptools-scm" ,python-setuptools-scm/next) + ("python-pytest" ,python-pytest))) + (home-page "https://github.com/janLuke/cloup") + (synopsis "Extension library for @code{python-click}") + (description + "Cloup---originally from ``Click + option groups''---enriches +@code{python-click} with several features that make it more expressive and +configurable: option groups, constraints, subcommand aliases, subcommands +sections, and a themeable @code{HelpFormatter}.") + (license license:bsd-3))) + (define-public python-vcversioner (package (name "python-vcversioner") -- 2.33.0
* gnu/packages/python-xyz.scm (python-cloup-0.7): New variable. --- gnu/packages/python-xyz.scm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 202cf569d5..659a02e7e6 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -3343,6 +3343,18 @@ configurable: option groups, constraints, subcommand aliases, subcommands sections, and a themeable @code{HelpFormatter}.") (license license:bsd-3))) +(define-public python-cloup-0.7 + (package (inherit python-cloup) + (name "python-cloup-0.7") + (version "0.7.1") + (source + (origin + (method url-fetch) + (uri (pypi-uri "cloup" version)) + (sha256 + (base32 + "0yyxibwlxmdkm4866fm4rwpdgy3d6y18n061992ckr54vl0cav7j")))))) + (define-public python-vcversioner (package (name "python-vcversioner") -- 2.33.0
* gnu/packages/python-xyz.scm (python-glcontext): New variable. --- gnu/packages/python-xyz.scm | 58 +++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 659a02e7e6..09df43b41d 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -18888,6 +18888,64 @@ library.") (description "This is the Cython-coded accelerator module for PyOpenGL."))) +(define-public python-glcontext + (package + (name "python-glcontext") + (version "2.3.4") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/moderngl/glcontext") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1m2zkl696vqmgrd5k1c5kl0krk6qgjgsz88qhahwva0l40bswvhp")))) + (build-system python-build-system) + (arguments + '(#:phases + (modify-phases %standard-phases + (add-before 'build 'fix-lib-paths + (lambda* (#:key inputs outputs #:allow-other-keys) + (let ((mesa (assoc-ref inputs "mesa")) + (libx11 (assoc-ref inputs "libx11"))) + (substitute* '("glcontext/x11.cpp" "glcontext/egl.cpp") + (("\"libGL.so\"") + (string-append "\"" mesa "/lib/libGL.so\"")) + (("\"libEGL.so\"") + (string-append "\"" mesa "/lib/libEGL.so\"")) + (("\"libX11.so\"") + (string-append "\"" libx11 "/lib/libX11.so\""))) + (substitute* '("glcontext/__init__.py") + (("find_library\\('GL'\\)") + (string-append "'" mesa "/lib/libGL.so'")) + (("find_library\\('EGL'\\)") + (string-append "'" mesa "/lib/libEGL.so'")) + (("find_library\\(\"X11\"\\)") + (string-append "'" libx11 "/lib/libX11.so'")))))) + (add-before 'check 'prepare-x + (lambda _ + (system "Xvfb :1 &") + (setenv "DISPLAY" ":1"))) + (replace 'check + (lambda* (#:key inputs outputs tests? #:allow-other-keys) + (when tests? + (add-installed-pythonpath inputs outputs) + (invoke "pytest" "tests"))))))) + (inputs + `(("libx11" ,libx11) + ("mesa" ,mesa))) + (native-inputs + `(("xorg-server" ,xorg-server-for-tests) + ("python-pytest" ,python-pytest) + ("python-psutil" ,python-psutil))) + (home-page "https://github.com/moderngl/glcontext") + (synopsis "Portable OpenGL Context for ModernGL") + (description "Python-glcontext is a library providing an OpenGL +implementation for ModernGL on multiple platforms.") + (license license:expat))) + (define-public python-rencode (package (name "python-rencode") -- 2.33.0
* gnu/packages/python-xyz.scm (python-moderngl): New variable. --- gnu/packages/python-xyz.scm | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 09df43b41d..f10858d315 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -18946,6 +18946,31 @@ library.") implementation for ModernGL on multiple platforms.") (license license:expat))) +(define-public python-moderngl + (package + (name "python-moderngl") + (version "5.6.4") + (source + (origin + (method url-fetch) + (uri (pypi-uri "moderngl" version)) + (sha256 + (base32 + "1ysinnyr3rkdisbihdrn1623l3rw45nx8p2j31dgffsykxah8vcc")))) + (build-system python-build-system) + (propagated-inputs + `(("python-glcontext" ,python-glcontext))) + (home-page "https://github.com/moderngl/moderngl") + (synopsis "Python wrapper for OpenGL") + (description "ModernGL is a python wrapper over OpenGL 3.3+ core that +simplifies the creation of simple graphics applications like scientific +simulations, games or user interfaces. Usually, acquiring in-depth knowledge +of OpenGL requires a steep learning curve. In contrast, ModernGL is easy to +learn and use, moreover it is capable of rendering with high performance and +quality, with less code written. The majority of the moderngl code base is +also written in C++ for high performance.") + (license license:expat))) + (define-public python-rencode (package (name "python-rencode") -- 2.33.0
* gnu/packages/python-xyz.scm (python-pyglet): New variable. --- gnu/packages/python-xyz.scm | 58 +++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index f10858d315..a48c228158 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -18971,6 +18971,64 @@ quality, with less code written. The majority of the moderngl code base is also written in C++ for high performance.") (license license:expat))) +(define-public python-pyglet + (package + (name "python-pyglet") + (version "1.5.18") + (source + (origin + (method url-fetch) + (uri (pypi-uri "pyglet" version ".zip")) + (sha256 + (base32 + "044ib8x6pv5rjwj210hq37ry7vi5bizmqkkv1zj8967prk5ii8sq")))) + (build-system python-build-system) + (arguments + '(#:phases + (modify-phases %standard-phases + (add-before 'build 'fix-lib-paths + (lambda* (#:key inputs outputs #:allow-other-keys) + (substitute* '("pyglet/gl/lib_glx.py") + (("'GL'") + (string-append "\"" (assoc-ref inputs "mesa") + "/lib/libGL.so\"")) + (("'GLU'") + (string-append "\"" (assoc-ref inputs "glu") + "/lib/libGLU.so\""))) + (substitute* '("pyglet/font/freetype_lib.py") + (("'freetype'") + (string-append "\"" (assoc-ref inputs "freetype") + "/lib/libfreetype.so\""))) + (substitute* '("pyglet/font/fontconfig.py") + (("'fontconfig'") + (string-append "\"" (assoc-ref inputs "fontconfig") + "/lib/libfontconfig.so\""))))) + (add-before 'check 'prepare-x + (lambda _ + (system "Xvfb :1 &") + (setenv "DISPLAY" ":1"))) + (replace 'check + (lambda* (#:key inputs outputs #:allow-other-keys) + (add-installed-pythonpath inputs outputs) + (invoke "pytest" "tests/unit")))))) + (inputs + `(("mesa" ,mesa) + ("glu" ,glu) + ("freetype" ,freetype) + ("fontconfig" ,fontconfig))) + (native-inputs + `(("unzip" ,unzip) + ("python-pytest" ,python-pytest) + ("xorg-server" ,xorg-server-for-tests))) + (home-page "https://pyglet.readthedocs.io") + (synopsis "Cross-platform windowing and multimedia Python library") + (description + "Pyglet is a Python library for developing games and other visually-rich +applications. It supports windowing, user interface event handling, +Joysticks, OpenGL graphics, loading images and videos, and playing sounds and +music. All of this with a friendly Pythonic API that's simple to learn.") + (license license:bsd-3))) + (define-public python-rencode (package (name "python-rencode") -- 2.33.0
* gnu/packages/python-xyz.scm (python-multipledispatch): New variable. --- gnu/packages/python-xyz.scm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index a48c228158..0f445e15bc 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -18971,6 +18971,25 @@ quality, with less code written. The majority of the moderngl code base is also written in C++ for high performance.") (license license:expat))) +(define-public python-multipledispatch + (package + (name "python-multipledispatch") + (version "0.6.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "multipledispatch" version)) + (sha256 + (base32 + "1slblghfjg9fdi9zpd7gmrkvfbv20nrdgnrymcnbky8bzm8i9ax7")))) + (build-system python-build-system) + (propagated-inputs `(("python-six" ,python-six))) + (home-page "https://github.com/mrocklin/multipledispatch/") + (synopsis "Multiple dispatch library for Python") + (description "This library defines a decorator that makes dispatching on +types more concise to write.") + (license license:bsd-3))) + (define-public python-pyglet (package (name "python-pyglet") -- 2.33.0
* gnu/packages/python-xyz.scm (python-pyrr): New variable. --- gnu/packages/python-xyz.scm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 0f445e15bc..4fa193f47e 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -18990,6 +18990,29 @@ also written in C++ for high performance.") types more concise to write.") (license license:bsd-3))) +(define-public python-pyrr + (package + (name "python-pyrr") + (version "0.10.3") + (source + (origin + (method url-fetch) + (uri (pypi-uri "pyrr" version)) + (sha256 + (base32 + "07byxkq8dcc8n6fc2q7g3vq3mxzzj0hqzm8hlq3gfwbf68h7n3rw")))) + (build-system python-build-system) + (propagated-inputs + `(("python-multipledispatch" ,python-multipledispatch) + ("python-numpy" ,python-numpy))) + (home-page "https://github.com/adamlwgriffiths/Pyrr") + (synopsis "Mathematical functions for 3D graphics using NumPy") + (description + "This Python package provides a collection of object-oriented and +procedural interfaces for working with matrices, quaternions, vectors and +plane/line/ray objects for 3D graphics.") + (license license:bsd-2))) + (define-public python-pyglet (package (name "python-pyglet") -- 2.33.0
* gnu/packages/python-xyz.scm (python-screeninfo): New variable. --- gnu/packages/python-xyz.scm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 4fa193f47e..3a984eaa68 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -19071,6 +19071,28 @@ Joysticks, OpenGL graphics, loading images and videos, and playing sounds and music. All of this with a friendly Pythonic API that's simple to learn.") (license license:bsd-3))) +(define-public python-screeninfo + (package + (name "python-screeninfo") + (version "0.7") + (source + (origin + (method url-fetch) + (uri (pypi-uri "screeninfo" version)) + (sha256 + (base32 + "007m7sqv30qak56885dxbijksrg2hd121hfpvg2llm734wspra8j")))) + (build-system python-build-system) + (native-inputs `(("python-pytest" ,python-pytest))) + (home-page "https://github.com/rr-/screeninfo") + (synopsis + "Obtain information about physical screens") + (description + "This python module provides means to access information about physical +screens like resolution, height and width of the screen, connecting port +etc.") + (license (list license:expat license:bsd-3)))) + (define-public python-rencode (package (name "python-rencode") -- 2.33.0
* gnu/packages/python-xyz.scm (python-moderngl-window): New variable. --- gnu/local.mk | 1 + .../python-moderngl-window-skip-tests.patch | 62 +++++++++++++++++++ gnu/packages/python-xyz.scm | 49 +++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 gnu/packages/patches/python-moderngl-window-skip-tests.patch diff --git a/gnu/local.mk b/gnu/local.mk index 175e691a63..d738f97ca8 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1648,6 +1648,7 @@ dist_patch_DATA = \ %D%/packages/patches/python-libxml2-utf8.patch \ %D%/packages/patches/python-matplotlib-run-under-wayland-gtk3.patch \ %D%/packages/patches/python-memcached-syntax-warnings.patch \ + %D%/packages/patches/python-moderngl-window-skip-tests.patch \ %D%/packages/patches/python-mox3-python3.6-compat.patch \ %D%/packages/patches/python-testtools.patch \ %D%/packages/patches/python-packaging-test-arch.patch \ diff --git a/gnu/packages/patches/python-moderngl-window-skip-tests.patch b/gnu/packages/patches/python-moderngl-window-skip-tests.patch new file mode 100644 index 0000000000..cbfefa6c3a --- /dev/null +++ b/gnu/packages/patches/python-moderngl-window-skip-tests.patch @@ -0,0 +1,62 @@ +Skip tests for optional dependencies + +The Python packages pywavefront and trimesh are optional dependencies and not +yet packaged in Guix but the tests try to load the modules anyway. Therefore +skip them. + +diff --git a/tests/test_docs.py b/tests/test_docs.py +index e4a38df..99a2aa0 100644 +--- a/tests/test_docs.py ++++ b/tests/test_docs.py +@@ -133,20 +133,11 @@ class TestCase(unittest.TestCase): + + # --- Loaders : Scene --- + +- def test_loaders_wavefront(self): +- self.validate('loaders/wavefront.rst', 'moderngl_window.loaders.scene.wavefront', 'Loader') +- + def test_loaders_gltf(self): + self.validate('loaders/gltf2.rst', 'moderngl_window.loaders.scene.gltf2', 'Loader') + +- def test_loaders_stl(self): +- self.validate('loaders/wavefront.rst', 'moderngl_window.loaders.scene.stl', 'Loader') +- + # --- Loaders : Program --- + +- def test_loader_single(self): +- self.validate('loaders/single.rst', 'moderngl_window.loaders.program.single', 'Loader') +- + def test_loader_separate(self): + self.validate('loaders/separate.rst', 'moderngl_window.loaders.program.separate', 'Loader') + +diff --git a/tests/test_loaders_scene.py b/tests/test_loaders_scene.py +index c577315..2eef889 100644 +--- a/tests/test_loaders_scene.py ++++ b/tests/test_loaders_scene.py +@@ -16,16 +16,6 @@ class SceneLoadersTestCase(HeadlessTestCase): + window_size = (16, 16) + aspect_ratio = 1.0 + +- def test_wavefront(self): +- """Load wavefront file""" +- scene = resources.scenes.load(SceneDescription(path='scenes/crate/crate.obj')) +- self.assertIsInstance(scene, Scene) +- +- def test_wavefont_not_found(self): +- """Ensure ImproperlyConfigured is raised when wavefront is not found""" +- with self.assertRaises(ImproperlyConfigured): +- resources.scenes.load(SceneDescription(path='scenes/doesnotexist.obj')) +- + def test_gltf(self): + """Load standard gltf""" + scene = resources.scenes.load(SceneDescription(path='scenes/BoxTextured/glTF/BoxTextured.gltf')) +@@ -45,7 +35,3 @@ class SceneLoadersTestCase(HeadlessTestCase): + """Attempt to load nonexisting gltf""" + with self.assertRaises(ImproperlyConfigured): + resources.scenes.load(SceneDescription(path='scenes/doesnotexist.gltf')) +- +- def test_stl(self): +- scene = resources.scenes.load(SceneDescription(path='scenes/uplink.stl')) +- self.assertIsInstance(scene, Scene) +-- +2.33.0 diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 3a984eaa68..0d3efe2700 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -19071,6 +19071,55 @@ Joysticks, OpenGL graphics, loading images and videos, and playing sounds and music. All of this with a friendly Pythonic API that's simple to learn.") (license license:bsd-3))) +(define-public python-moderngl-window + (package + (name "python-moderngl-window") + (version "2.4.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/moderngl/moderngl-window") + (commit version))) + (file-name (git-file-name name version)) + (patches + (search-patches "python-moderngl-window-skip-tests.patch")) + (sha256 + (base32 + "1fvhm6ln3q5kl5m5q3gzfmx1kpyn054fhpcrgpqz8809dxi7pzcv")))) + (build-system python-build-system) + (arguments + '(#:phases + (modify-phases %standard-phases + (add-before 'check 'prepare-x + (lambda _ + (system "Xvfb :1 &") + (setenv "DISPLAY" ":1"))) + (add-before 'check 'fix-test + (lambda _ + (substitute* '("tests/test_windowconfig.py") + (("terrain_Vs.glsl") "terrain_vs.glsl")))) + (replace 'check + (lambda* (#:key inputs outputs #:allow-other-keys) + (add-installed-pythonpath inputs outputs) + (invoke "pytest" "tests" )))))) + (propagated-inputs + `(("python-pillow" ,python-pillow) + ("python-pyrr" ,python-pyrr) + ("python-numpy" ,python-numpy) + ("python-moderngl" ,python-moderngl) + ("python-pyglet" ,python-pyglet))) + (native-inputs + `(("python-pytest" ,python-pytest) + ("xorg-server" ,xorg-server-for-tests))) + (home-page "https://github.com/moderngl/moderngl-window") + (synopsis "Cross-platform utility library for ModernGL") + (description "This ModernGL utility library simplifies window creation and +resource loading. You can create a window for ModernGL using pyglet, pygame, +PySide2, GLFW, SDL2, PyQt5 or tkinter. Events are unified into a single event +system. Resource loading includes loading of 2D textures/texture arrays, +shaders and objects/scenes.") + (license license:expat))) + (define-public python-screeninfo (package (name "python-screeninfo") -- 2.33.0
* gnu/packages/python-science.scm (python-manimpango): New variable. --- gnu/local.mk | 2 + .../python-manimpango-remove-manim-dep.patch | 172 ++++++++++++++++++ gnu/packages/python-science.scm | 28 +++ 3 files changed, 202 insertions(+) create mode 100644 gnu/packages/patches/python-manimpango-remove-manim-dep.patch diff --git a/gnu/local.mk b/gnu/local.mk index d738f97ca8..640b9e3b95 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -44,6 +44,7 @@ # Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net> # Copyright © 2021 Sharlatan Hellseher <sharlatanus@gmail.com> # Copyright © 2021 Dmitry Polyakov <polyakov@liltechdude.xyz> +# Copyright © 2021 Daniel Meißner <daniel.meissner-i4k@ruhr-uni-bochum.de> # # This file is part of GNU Guix. # @@ -1646,6 +1647,7 @@ dist_patch_DATA = \ %D%/packages/patches/python-pyfakefs-remove-bad-test.patch \ %D%/packages/patches/python-flint-includes.patch \ %D%/packages/patches/python-libxml2-utf8.patch \ + %D%/packages/patches/python-manimpango-remove-manim-dep.patch \ %D%/packages/patches/python-matplotlib-run-under-wayland-gtk3.patch \ %D%/packages/patches/python-memcached-syntax-warnings.patch \ %D%/packages/patches/python-moderngl-window-skip-tests.patch \ diff --git a/gnu/packages/patches/python-manimpango-remove-manim-dep.patch b/gnu/packages/patches/python-manimpango-remove-manim-dep.patch new file mode 100644 index 0000000000..579c2302d8 --- /dev/null +++ b/gnu/packages/patches/python-manimpango-remove-manim-dep.patch @@ -0,0 +1,172 @@ +Fix dependency on manim for tests + +This fixes a circular dependency between manim and manimpango. + +Extracted from upstream: +https://github.com/ManimCommunity/ManimPango/commit/7e2b17aa14b10bd58af0598cc2de51a406682797 + +diff --git a/tests/_manim.py b/tests/_manim.py +index 3ea4676..b11d3e9 100644 +--- a/tests/_manim.py ++++ b/tests/_manim.py +@@ -2,11 +2,12 @@ + """This file contains helpers for the tests copied and modified + from Manim. + """ +- ++import copy + import os ++import re + from pathlib import Path + +-from manimpango import Alignment, MarkupUtils ++from manimpango import Alignment, MarkupUtils, TextSetting, text2svg + + + class MarkupText: +@@ -104,3 +105,115 @@ class MarkupText: + + def __repr__(self): + return f"MarkupText({repr(self.original_text)})" ++ ++ ++class Text: ++ def __init__( ++ self, ++ text: str, ++ fill_opacity: float = 1.0, ++ stroke_width: int = 0, ++ size: int = 1, ++ line_spacing: int = -1, ++ font: str = "", ++ slant: str = "NORMAL", ++ weight: str = "NORMAL", ++ gradient: tuple = None, ++ tab_width: int = 4, ++ disable_ligatures: bool = False, ++ filename: str = "text.svg", ++ **kwargs, ++ ) -> None: ++ self.size = size ++ self.filename = filename ++ self.line_spacing = line_spacing ++ self.font = font ++ self.slant = slant ++ self.weight = weight ++ self.gradient = gradient ++ self.tab_width = tab_width ++ self.original_text = text ++ self.disable_ligatures = disable_ligatures ++ text_without_tabs = text ++ self.t2f = self.t2s = self.t2w = {} ++ if text.find("\t") != -1: ++ text_without_tabs = text.replace("\t", " " * self.tab_width) ++ self.text = text_without_tabs ++ if self.line_spacing == -1: ++ self.line_spacing = self.size + self.size * 0.3 ++ else: ++ self.line_spacing = self.size + self.size * self.line_spacing ++ self.text2svg() ++ ++ def text2settings(self): ++ """Internally used function. Converts the texts and styles ++ to a setting for parsing.""" ++ settings = [] ++ t2x = [self.t2f, self.t2s, self.t2w] ++ for i in range(len(t2x)): ++ fsw = [self.font, self.slant, self.weight] ++ if t2x[i]: ++ for word, x in list(t2x[i].items()): ++ for start, end in self.find_indexes(word, self.text): ++ fsw[i] = x ++ settings.append(TextSetting(start, end, *fsw)) ++ # Set all text settings (default font, slant, weight) ++ fsw = [self.font, self.slant, self.weight] ++ settings.sort(key=lambda setting: setting.start) ++ temp_settings = settings.copy() ++ start = 0 ++ for setting in settings: ++ if setting.start != start: ++ temp_settings.append(TextSetting(start, setting.start, *fsw)) ++ start = setting.end ++ if start != len(self.text): ++ temp_settings.append(TextSetting(start, len(self.text), *fsw)) ++ settings = sorted(temp_settings, key=lambda setting: setting.start) ++ ++ if re.search(r"\n", self.text): ++ line_num = 0 ++ for start, end in self.find_indexes("\n", self.text): ++ for setting in settings: ++ if setting.line_num == -1: ++ setting.line_num = line_num ++ if start < setting.end: ++ line_num += 1 ++ new_setting = copy.copy(setting) ++ setting.end = end ++ new_setting.start = end ++ new_setting.line_num = line_num ++ settings.append(new_setting) ++ settings.sort(key=lambda setting: setting.start) ++ break ++ for setting in settings: ++ if setting.line_num == -1: ++ setting.line_num = 0 ++ return settings ++ ++ def text2svg(self): ++ """Internally used function. ++ Convert the text to SVG using Pango ++ """ ++ size = self.size * 10 ++ line_spacing = self.line_spacing * 10 ++ dir_name = Path(self.filename).parent ++ disable_liga = self.disable_ligatures ++ if not os.path.exists(dir_name): ++ os.makedirs(dir_name) ++ file_name = self.filename ++ settings = self.text2settings() ++ width = 600 ++ height = 400 ++ ++ return text2svg( ++ settings, ++ size, ++ line_spacing, ++ disable_liga, ++ file_name, ++ 30, ++ 30, ++ width, ++ height, ++ self.text, ++ ) +diff --git a/tests/test_fonts.py b/tests/test_fonts.py +index 51e7eb4..da42895 100644 +--- a/tests/test_fonts.py ++++ b/tests/test_fonts.py +@@ -3,13 +3,12 @@ import sys + from pathlib import Path + from shutil import copyfile + +-import manim + import pytest + + import manimpango + + from . import FONT_DIR +-from ._manim import MarkupText ++from ._manim import MarkupText, Text + + font_lists = { + (FONT_DIR / "AdobeVFPrototype.ttf").absolute(): "Adobe Variable Font Prototype", +@@ -38,7 +37,7 @@ def test_register_font(font_name): + @pytest.mark.parametrize("font_name", font_lists.values()) + def test_warning(capfd, font_name): + print(font_name) +- manim.Text("Testing", font=font_name) ++ Text("Testing", font=font_name) + captured = capfd.readouterr() + assert "Pango-WARNING **" not in captured.err, "Looks like pango raised a warning?" + +-- +2.32.0 diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm index d3730fadcc..fcd983520c 100644 --- a/gnu/packages/python-science.scm +++ b/gnu/packages/python-science.scm @@ -38,6 +38,7 @@ #:use-module (gnu packages check) #:use-module (gnu packages databases) #:use-module (gnu packages gcc) + #:use-module (gnu packages gtk) #:use-module (gnu packages image-processing) #:use-module (gnu packages machine-learning) #:use-module (gnu packages maths) @@ -982,3 +983,30 @@ pandas notebooks, scripts, and libraries. Unlike other distributed DataFrame libraries, Modin provides seamless integration and compatibility with existing pandas code.") (license license:asl2.0))) + +(define-public python-manimpango + (package + (name "python-manimpango") + (version "0.3.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "ManimPango" version)) + (sha256 + (base32 + "1j2mbhf7d82718nkc0r8x7cf35hlh13b67qkczjbbys3w24nyfsw")) + (patches (search-patches "python-manimpango-remove-manim-dep.patch")))) + (build-system python-build-system) + (native-inputs + `(("pkg-config" ,pkg-config) + ("Cython" ,python-cython) + ("python-pytest" ,python-pytest))) + (inputs + `(("pango" ,pango))) + (home-page "https://manimpango.manim.community/") + (synopsis + "Bindings for pango for use with Manim") + (description + "These are Python bindings for Pango to be used with the mathematical +animation software Manim.") + (license license:gpl3+))) -- 2.33.0
* gnu/packages/python-science.scm (python-mapbox-earcut): New variable. --- gnu/packages/python-xyz.scm | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 0d3efe2700..c5163d93a3 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -19120,6 +19120,35 @@ system. Resource loading includes loading of 2D textures/texture arrays, shaders and objects/scenes.") (license license:expat))) +(define-public python-mapbox-earcut + (package + (name "python-mapbox-earcut") + (version "0.12.10") + (source + (origin + (method url-fetch) + (uri (pypi-uri "mapbox_earcut" version)) + (sha256 + (base32 + "0ly48lijgd9inq07x42pfp9c24fn16vn9axpmfwqrkn979krbnah")))) + (build-system python-build-system) + (propagated-inputs + `(("python-numpy" ,python-numpy))) + (native-inputs + `(("python-pytest" ,python-pytest) + ("python-wheel" ,python-wheel) + ("setuptools-scm" ,python-setuptools-scm) + ("cmake" ,cmake))) + (home-page + "https://github.com/skogler/mapbox_earcut_python") + (synopsis + "Python bindings for the Mapbox Earcut C++ polygon triangulation library") + (description + "The Mapbox Earcut library is a header-only C++ library which provides a +fast and robust triangulation of 2D polygons. This package provides Python +bindings for this library.") + (license license:isc))) + (define-public python-screeninfo (package (name "python-screeninfo") -- 2.33.0
* (python-screeninfo-0.6): New variable. --- gnu/packages/python-xyz.scm | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index c5163d93a3..592e41f057 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -19149,17 +19149,17 @@ fast and robust triangulation of 2D polygons. This package provides Python bindings for this library.") (license license:isc))) -(define-public python-screeninfo +(define-public python-screeninfo-0.6 (package (name "python-screeninfo") - (version "0.7") + (version "0.6.7") (source (origin (method url-fetch) (uri (pypi-uri "screeninfo" version)) (sha256 (base32 - "007m7sqv30qak56885dxbijksrg2hd121hfpvg2llm734wspra8j")))) + "1jv9m9xhl7zr2hzfx0w5zyw9pajn4b4zpln4rdl3zni9lcfaqjqw")))) (build-system python-build-system) (native-inputs `(("python-pytest" ,python-pytest))) (home-page "https://github.com/rr-/screeninfo") @@ -19171,6 +19171,17 @@ screens like resolution, height and width of the screen, connecting port etc.") (license (list license:expat license:bsd-3)))) +(define-public python-screeninfo + (package/inherit python-screeninfo-0.6 + (version "0.7") + (source + (origin + (method url-fetch) + (uri (pypi-uri "screeninfo" version)) + (sha256 + (base32 + "007m7sqv30qak56885dxbijksrg2hd121hfpvg2llm734wspra8j")))))) + (define-public python-rencode (package (name "python-rencode") -- 2.33.0
* gnu/packages/python-science.scm (python-manim): New variable. --- gnu/packages/python-science.scm | 64 +++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm index fcd983520c..df105d5103 100644 --- a/gnu/packages/python-science.scm +++ b/gnu/packages/python-science.scm @@ -36,6 +36,7 @@ #:use-module (gnu packages) #:use-module (gnu packages base) #:use-module (gnu packages check) + #:use-module (gnu packages cmake) #:use-module (gnu packages databases) #:use-module (gnu packages gcc) #:use-module (gnu packages gtk) @@ -55,6 +56,7 @@ #:use-module (gnu packages sphinx) #:use-module (gnu packages statistics) #:use-module (gnu packages time) + #:use-module (gnu packages video) #:use-module (gnu packages xdisorg) #:use-module (gnu packages xml) #:use-module (gnu packages xorg) @@ -1010,3 +1012,65 @@ pandas code.") "These are Python bindings for Pango to be used with the mathematical animation software Manim.") (license license:gpl3+))) + +(define-public python-manim + (package + (name "python-manim") + (version "0.9.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "manim" version)) + (sha256 + (base32 + "0ksp57wcy45xkjips5i4wwm690mhbs2dmlcgsbmiwx78mfk4z0r3")))) + (build-system python-build-system) + (arguments '(#:phases + (modify-phases %standard-phases + (add-before 'build 'fix-ffmpeg-path + (lambda* (#:key inputs outputs #:allow-other-keys) + (substitute* '("manim/constants.py") + (("FFMPEG_BIN: str = \"ffmpeg\"") + (string-append "FFMPEG_BIN: str = \"" + (assoc-ref inputs "ffmpeg") + "/bin/ffmpeg\""))))) + ;; PyPI package contains no tests for manim but the + ;; setup.py test command fails, so remove it + (delete 'check)))) + (propagated-inputs + `(("python-click" ,python-click) + ("python-click-default-group" + ,python-click-default-group) + ("python-cloup" ,python-cloup-0.7) + ("python-colour" ,python-colour) + ("python-decorator" ,python-decorator) + ("python-manimpango" ,python-manimpango) + ("python-mapbox-earcut" ,python-mapbox-earcut) + ("python-moderngl" ,python-moderngl) + ("python-moderngl-window" + ,python-moderngl-window) + ("python-networkx" ,python-networkx) + ("python-numpy" ,python-numpy) + ("python-pillow" ,python-pillow) + ("python-pycairo" ,python-pycairo) + ("python-pydub" ,python-pydub) + ("python-pygments" ,python-pygments) + ("python-requests" ,python-requests) + ("python-rich" ,python-rich) + ("python-scipy" ,python-scipy) + ("python-screeninfo" ,python-screeninfo-0.6) + ("python-tqdm" ,python-tqdm) + ("python-watchdog" ,python-watchdog))) + (inputs + `(("ffmpeg" ,ffmpeg))) + (native-inputs + `(("python-wheel" ,python-wheel))) + (home-page "https://www.manim.community/") + (synopsis + "Python animation engine for explanatory math videos") + (description + "Manim is a Python library for creating mathematical animations. The +animations are written as Python code which is based on predefined objects. +You can make animations with maths formulas (LaTeX-based), simple shapes, 3D +objects, function graphs and more.") + (license license:expat))) -- 2.33.0
Hi Liliana, hi Xinglu, I have adapted the patch set to the new input field style and I would be very happy if you could, once more, review the patches and push them to master if they look fine to you. Thanks, Daniel Daniel Meißner (13): gnu: Add python-cloup. gnu: Add python-cloup-0.7. gnu: Add python-glcontext. gnu: Add python-moderngl. gnu: Add python-pyglet. gnu: Add python-multipledispatch. gnu: Add python-pyrr. gnu: Add python-screeninfo. gnu: Add python-moderngl-window. gnu: Add python-manimpango. gnu: Add python-mapbox-earcut. gnu: Add python-screeninfo-0.6. gnu: Add python-manim 0.9.0. gnu/local.mk | 3 + .../python-manimpango-remove-manim-dep.patch | 172 ++++++++++ .../python-moderngl-window-skip-tests.patch | 146 +++++++++ gnu/packages/python-science.scm | 88 +++++ gnu/packages/python-xyz.scm | 303 ++++++++++++++++++ 5 files changed, 712 insertions(+) create mode 100644 gnu/packages/patches/python-manimpango-remove-manim-dep.patch create mode 100644 gnu/packages/patches/python-moderngl-window-skip-tests.patch -- 2.34.0
* gnu/packages/python-xyz.scm (python-cloup): New variable. Co-authored-by: Xinglu Chen <public@yoctocell.xyz> --- gnu/packages/python-science.scm | 1 + gnu/packages/python-xyz.scm | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm index 1311fbad0c..65f1dbf014 100644 --- a/gnu/packages/python-science.scm +++ b/gnu/packages/python-science.scm @@ -15,6 +15,7 @@ ;;; Copyright © 2021 Paul Garlick <pgarlick@tourbillion-technology.com> ;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net> ;;; Copyright © 2021 Felix Gruber <felgru@posteo.net> +;;; Copyright © 2021 Daniel Meißner <daniel.meissner-i4k@ruhr-uni-bochum.de> ;;; ;;; This file is part of GNU Guix. ;;; diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 27f8c11c9c..db511a178f 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -3430,6 +3430,39 @@ (define-public python-cligj well-tested and interoperable CLIs for handling GeoJSON.") (license license:bsd-3))) +(define-public python-cloup + (package + (name "python-cloup") + (version "0.11.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "cloup" version)) + (sha256 + (base32 + "07kxw81bml137w9bfmwkjbdzbldkk1k1lws82wffz9244pp7k8ib")))) + (build-system python-build-system) + (arguments + '(#:phases + (modify-phases %standard-phases + (replace 'check + (lambda* (#:key inputs outputs tests? #:allow-other-keys) + (when tests? + (add-installed-pythonpath inputs outputs) + (invoke "python" "-m" "pytest"))))))) + (propagated-inputs + (list python-click)) + (native-inputs + (list python-setuptools python-setuptools-scm python-pytest)) + (home-page "https://github.com/janLuke/cloup") + (synopsis "Extension library for @code{python-click}") + (description + "Cloup---originally from ``Click + option groups''---enriches +@code{python-click} with several features that make it more expressive and +configurable: option groups, constraints, subcommand aliases, subcommands +sections, and a themeable @code{HelpFormatter}.") + (license license:bsd-3))) + (define-public python-vcversioner (package (name "python-vcversioner") -- 2.34.0
* gnu/packages/python-xyz.scm (python-cloup-0.7): New variable. --- gnu/packages/python-xyz.scm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index db511a178f..deff85e797 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -3463,6 +3463,18 @@ (define-public python-cloup sections, and a themeable @code{HelpFormatter}.") (license license:bsd-3))) +(define-public python-cloup-0.7 + (package (inherit python-cloup) + (name "python-cloup-0.7") + (version "0.7.1") + (source + (origin + (method url-fetch) + (uri (pypi-uri "cloup" version)) + (sha256 + (base32 + "0yyxibwlxmdkm4866fm4rwpdgy3d6y18n061992ckr54vl0cav7j")))))) + (define-public python-vcversioner (package (name "python-vcversioner") -- 2.34.0
* gnu/packages/python-xyz.scm (python-glcontext): New variable. --- gnu/packages/python-xyz.scm | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index deff85e797..d8e6fa070e 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -19555,6 +19555,59 @@ (define-public python-pyopengl-accelerate (description "This is the Cython-coded accelerator module for PyOpenGL."))) +(define-public python-glcontext + (package + (name "python-glcontext") + (version "2.3.4") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/moderngl/glcontext") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1m2zkl696vqmgrd5k1c5kl0krk6qgjgsz88qhahwva0l40bswvhp")))) + (build-system python-build-system) + (arguments + '(#:phases + (modify-phases %standard-phases + (add-before 'build 'fix-lib-paths + (lambda* (#:key inputs outputs #:allow-other-keys) + (let ((mesa (assoc-ref inputs "mesa")) + (libx11 (assoc-ref inputs "libx11"))) + (substitute* '("glcontext/x11.cpp" "glcontext/egl.cpp") + (("\"libGL.so\"") + (string-append "\"" mesa "/lib/libGL.so\"")) + (("\"libEGL.so\"") + (string-append "\"" mesa "/lib/libEGL.so\"")) + (("\"libX11.so\"") + (string-append "\"" libx11 "/lib/libX11.so\""))) + (substitute* '("glcontext/__init__.py") + (("find_library\\('GL'\\)") + (string-append "'" mesa "/lib/libGL.so'")) + (("find_library\\('EGL'\\)") + (string-append "'" mesa "/lib/libEGL.so'")) + (("find_library\\(\"X11\"\\)") + (string-append "'" libx11 "/lib/libX11.so'")))))) + (replace 'check + (lambda* (#:key inputs outputs tests? #:allow-other-keys) + (when tests? + (system "Xvfb :1 &") + (setenv "DISPLAY" ":1") + (add-installed-pythonpath inputs outputs) + (invoke "pytest" "tests"))))))) + (inputs + (list libx11 mesa)) + (native-inputs + (list xorg-server-for-tests python-pytest python-psutil)) + (home-page "https://github.com/moderngl/glcontext") + (synopsis "Portable OpenGL Context for ModernGL") + (description "Python-glcontext is a library providing an OpenGL +implementation for ModernGL on multiple platforms.") + (license license:expat))) + (define-public python-rencode (package (name "python-rencode") -- 2.34.0
* gnu/packages/python-xyz.scm (python-moderngl): New variable. --- gnu/packages/python-xyz.scm | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index d8e6fa070e..21cf780338 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -19608,6 +19608,31 @@ (define-public python-glcontext implementation for ModernGL on multiple platforms.") (license license:expat))) +(define-public python-moderngl + (package + (name "python-moderngl") + (version "5.6.4") + (source + (origin + (method url-fetch) + (uri (pypi-uri "moderngl" version)) + (sha256 + (base32 + "1ysinnyr3rkdisbihdrn1623l3rw45nx8p2j31dgffsykxah8vcc")))) + (build-system python-build-system) + (propagated-inputs + (list python-glcontext)) + (home-page "https://github.com/moderngl/moderngl") + (synopsis "Python wrapper for OpenGL") + (description "ModernGL is a python wrapper over OpenGL 3.3+ core that +simplifies the creation of simple graphics applications like scientific +simulations, games or user interfaces. Usually, acquiring in-depth knowledge +of OpenGL requires a steep learning curve. In contrast, ModernGL is easy to +learn and use, moreover it is capable of rendering with high performance and +quality, with less code written. The majority of the moderngl code base is +also written in C++ for high performance.") + (license license:expat))) + (define-public python-rencode (package (name "python-rencode") -- 2.34.0
* gnu/packages/python-xyz.scm (python-pyglet): New variable. --- gnu/packages/python-xyz.scm | 55 +++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 21cf780338..e0d65daf91 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -19633,6 +19633,61 @@ (define-public python-moderngl also written in C++ for high performance.") (license license:expat))) +(define-public python-pyglet + (package + (name "python-pyglet") + (version "1.5.18") + (source + (origin + (method url-fetch) + (uri (pypi-uri "pyglet" version ".zip")) + (sha256 + (base32 + "044ib8x6pv5rjwj210hq37ry7vi5bizmqkkv1zj8967prk5ii8sq")))) + (build-system python-build-system) + (arguments + '(#:phases + (modify-phases %standard-phases + (add-before 'build 'fix-lib-paths + (lambda* (#:key inputs outputs #:allow-other-keys) + (substitute* '("pyglet/gl/lib_glx.py") + (("'GL'") + (string-append "\"" (assoc-ref inputs "mesa") + "/lib/libGL.so\"")) + (("'GLU'") + (string-append "\"" (assoc-ref inputs "glu") + "/lib/libGLU.so\""))) + (substitute* '("pyglet/font/freetype_lib.py") + (("'freetype'") + (string-append "\"" (assoc-ref inputs "freetype") + "/lib/libfreetype.so\""))) + (substitute* '("pyglet/font/fontconfig.py") + (("'fontconfig'") + (string-append "\"" (assoc-ref inputs "fontconfig") + "/lib/libfontconfig.so\""))))) + (replace 'check + (lambda* (#:key inputs outputs tests? #:allow-other-keys) + (when tests? + (system "Xvfb :1 &") + (setenv "DISPLAY" ":1") + (add-installed-pythonpath inputs outputs) + (invoke "pytest" "tests/unit"))))))) + (inputs + `(("mesa" ,mesa) + ("glu" ,glu) + ("freetype" ,freetype) + ("fontconfig" ,fontconfig))) + (native-inputs + (list unzip python-pytest xorg-server-for-tests)) + (home-page "https://pyglet.readthedocs.io") + (synopsis "Cross-platform windowing and multimedia Python library") + (description + "Pyglet is a Python library for developing games and other visually-rich +applications. It supports windowing, user interface event handling, +Joysticks, OpenGL graphics, loading images and videos, and playing sounds and +music. All of this with a friendly Pythonic API that's simple to learn.") + (license license:bsd-3))) + (define-public python-rencode (package (name "python-rencode") -- 2.34.0
* gnu/packages/python-xyz.scm (python-pyrr): New variable. --- gnu/packages/python-xyz.scm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index e0d65daf91..d706d208af 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -19633,6 +19633,28 @@ (define-public python-moderngl also written in C++ for high performance.") (license license:expat))) +(define-public python-pyrr + (package + (name "python-pyrr") + (version "0.10.3") + (source + (origin + (method url-fetch) + (uri (pypi-uri "pyrr" version)) + (sha256 + (base32 + "07byxkq8dcc8n6fc2q7g3vq3mxzzj0hqzm8hlq3gfwbf68h7n3rw")))) + (build-system python-build-system) + (propagated-inputs + (list python-multipledispatch python-numpy)) + (home-page "https://github.com/adamlwgriffiths/Pyrr") + (synopsis "Mathematical functions for 3D graphics using NumPy") + (description + "This Python package provides a collection of object-oriented and +procedural interfaces for working with matrices, quaternions, vectors and +plane/line/ray objects for 3D graphics.") + (license license:bsd-2))) + (define-public python-pyglet (package (name "python-pyglet") -- 2.34.0
* gnu/packages/python-xyz.scm (python-screeninfo): New variable. --- gnu/packages/python-xyz.scm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index d706d208af..0dbc9db830 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -19710,6 +19710,28 @@ (define-public python-pyglet music. All of this with a friendly Pythonic API that's simple to learn.") (license license:bsd-3))) +(define-public python-screeninfo + (package + (name "python-screeninfo") + (version "0.7") + (source + (origin + (method url-fetch) + (uri (pypi-uri "screeninfo" version)) + (sha256 + (base32 + "007m7sqv30qak56885dxbijksrg2hd121hfpvg2llm734wspra8j")))) + (build-system python-build-system) + (native-inputs `(("python-pytest" ,python-pytest))) + (home-page "https://github.com/rr-/screeninfo") + (synopsis + "Obtain information about physical screens") + (description + "This python module provides means to access information about physical +screens like resolution, height and width of the screen, connecting port +etc.") + (license (list license:expat license:bsd-3)))) + (define-public python-rencode (package (name "python-rencode") -- 2.34.0
* gnu/packages/python-xyz.scm (python-moderngl-window): New variable. --- gnu/local.mk | 1 + .../python-moderngl-window-skip-tests.patch | 146 ++++++++++++++++++ gnu/packages/python-xyz.scm | 44 ++++++ 3 files changed, 191 insertions(+) create mode 100644 gnu/packages/patches/python-moderngl-window-skip-tests.patch diff --git a/gnu/local.mk b/gnu/local.mk index 852f9f3246..ff3e80ea68 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1685,6 +1685,7 @@ dist_patch_DATA = \ %D%/packages/patches/python-magic-python-bytecode.patch \ %D%/packages/patches/python-matplotlib-run-under-wayland-gtk3.patch \ %D%/packages/patches/python-memcached-syntax-warnings.patch \ + %D%/packages/patches/python-moderngl-window-skip-tests.patch \ %D%/packages/patches/python-mox3-python3.6-compat.patch \ %D%/packages/patches/python-typing-inspect-fix.patch \ %D%/packages/patches/python-packaging-test-arch.patch \ diff --git a/gnu/packages/patches/python-moderngl-window-skip-tests.patch b/gnu/packages/patches/python-moderngl-window-skip-tests.patch new file mode 100644 index 0000000000..aee4b71e2a --- /dev/null +++ b/gnu/packages/patches/python-moderngl-window-skip-tests.patch @@ -0,0 +1,146 @@ +Skip failing tests and tests for optional dependencies + +The Python packages pywavefront and trimesh are optional dependencies and not +yet packaged in Guix but the tests try to load the modules anyway. Therefore +skip them. + +The tests test_texture_mimpamps, test_texture_abspath, test_load_texture_2d +and test_load_texture_array fail when Guix builds the package. This is not +the case when running the tests directly from a source tree. + +diff --git a/tests/test_docs.py b/tests/test_docs.py +index e4a38df..99a2aa0 100644 +--- a/tests/test_docs.py ++++ b/tests/test_docs.py +@@ -133,20 +133,11 @@ class TestCase(unittest.TestCase): + + # --- Loaders : Scene --- + +- def test_loaders_wavefront(self): +- self.validate('loaders/wavefront.rst', 'moderngl_window.loaders.scene.wavefront', 'Loader') +- + def test_loaders_gltf(self): + self.validate('loaders/gltf2.rst', 'moderngl_window.loaders.scene.gltf2', 'Loader') + +- def test_loaders_stl(self): +- self.validate('loaders/wavefront.rst', 'moderngl_window.loaders.scene.stl', 'Loader') +- + # --- Loaders : Program --- + +- def test_loader_single(self): +- self.validate('loaders/single.rst', 'moderngl_window.loaders.program.single', 'Loader') +- + def test_loader_separate(self): + self.validate('loaders/separate.rst', 'moderngl_window.loaders.program.separate', 'Loader') + +diff --git a/tests/test_loaders_scene.py b/tests/test_loaders_scene.py +index c577315..2eef889 100644 +--- a/tests/test_loaders_scene.py ++++ b/tests/test_loaders_scene.py +@@ -16,16 +16,6 @@ class SceneLoadersTestCase(HeadlessTestCase): + window_size = (16, 16) + aspect_ratio = 1.0 + +- def test_wavefront(self): +- """Load wavefront file""" +- scene = resources.scenes.load(SceneDescription(path='scenes/crate/crate.obj')) +- self.assertIsInstance(scene, Scene) +- +- def test_wavefont_not_found(self): +- """Ensure ImproperlyConfigured is raised when wavefront is not found""" +- with self.assertRaises(ImproperlyConfigured): +- resources.scenes.load(SceneDescription(path='scenes/doesnotexist.obj')) +- + def test_gltf(self): + """Load standard gltf""" + scene = resources.scenes.load(SceneDescription(path='scenes/BoxTextured/glTF/BoxTextured.gltf')) +@@ -45,7 +35,3 @@ class SceneLoadersTestCase(HeadlessTestCase): + """Attempt to load nonexisting gltf""" + with self.assertRaises(ImproperlyConfigured): + resources.scenes.load(SceneDescription(path='scenes/doesnotexist.gltf')) +- +- def test_stl(self): +- scene = resources.scenes.load(SceneDescription(path='scenes/uplink.stl')) +- self.assertIsInstance(scene, Scene) +diff --git a/tests/test_loaders_texture.py b/tests/test_loaders_texture.py +index fcd4d72..8e13037 100644 +--- a/tests/test_loaders_texture.py ++++ b/tests/test_loaders_texture.py +@@ -55,39 +55,3 @@ class TextureLoadersTestCase(HeadlessTestCase): + kind='cube', + )) + self.assertIsInstance(texture, moderngl.TextureCube) +- +- def test_texture_mimpamps(self): +- """Load texture with mipmapping and anisotropy""" +- desc = TextureDescription( +- path='textures/crate.png', +- mipmap_levels=(0, 2), +- anisotropy=4.0, +- ) +- texture = resources.textures.load(desc) +- self.assertEqual(texture.anisotropy, 4.0) +- self.assertEqual(desc.mipmap, True) +- +- # Texture Array +- desc = TextureDescription( +- path='textures/array.png', +- kind="array", +- layers=10, +- mipmap_levels=(0, 5), +- anisotropy=8.0, +- ) +- texture = resources.textures.load(desc) +- self.assertEqual(texture.anisotropy, 8.0) +- self.assertEqual(desc.mipmap, True) +- +- def test_texture_abspath(self): +- """Strip search directories and use absolute path""" +- path = (Path(__file__).parent / "fixtures/resources/textures/crate.png").resolve() +- with resources.temporary_dirs([]): +- desc = TextureDescription( +- path=path, +- mipmap_levels=(0, 2), +- anisotropy=4.0, +- ) +- texture = resources.textures.load(desc) +- self.assertEqual(texture.anisotropy, 4.0) +- self.assertEqual(desc.mipmap, True) +diff --git a/tests/test_windowconfig.py b/tests/test_windowconfig.py +index 185c36e..2eb6f39 100644 +--- a/tests/test_windowconfig.py ++++ b/tests/test_windowconfig.py +@@ -94,31 +94,6 @@ class WindowConfigTestCase(WindowConfigTestCase): + with self.assertRaises(ValueError): + self.window.resize_func = "Hello" + +- def test_load_texture_2d(self): +- """Load texture with shortcut method""" +- texture = self.config.load_texture_2d( +- "textures/crate.png", +- flip=True, +- mipmap_levels=(0, 2), +- anisotropy=4.0, +- ) +- self.assertIsInstance(texture, moderngl.Texture) +- self.assertEqual(texture.anisotropy, 4.0) +- +- def test_load_texture_array(self): +- """Load texture array with shortcut method""" +- texture = self.config.load_texture_array( +- 'textures/array.png', +- layers=10, +- flip=True, +- mipmap=False, +- mipmap_levels=(0, 2), +- anisotropy=4.0, +- ) +- self.assertIsInstance(texture, moderngl.TextureArray) +- self.assertEqual(texture.anisotropy, 4.0) +- self.assertEqual(texture.layers, 10) +- + def test_load_program_single(self): + """Load a single glsl program""" + prog = self.config.load_program(path='programs/white.glsl') +-- +2.33.0 diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 0dbc9db830..eee2fc0077 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -19710,6 +19710,50 @@ (define-public python-pyglet music. All of this with a friendly Pythonic API that's simple to learn.") (license license:bsd-3))) +(define-public python-moderngl-window + (package + (name "python-moderngl-window") + (version "2.4.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/moderngl/moderngl-window") + (commit version))) + (file-name (git-file-name name version)) + (patches + (search-patches "python-moderngl-window-skip-tests.patch")) + (sha256 + (base32 + "1fvhm6ln3q5kl5m5q3gzfmx1kpyn054fhpcrgpqz8809dxi7pzcv")))) + (build-system python-build-system) + (arguments + '(#:phases + (modify-phases %standard-phases + (add-before 'check 'fix-test + (lambda _ + (substitute* '("tests/test_windowconfig.py") + (("terrain_Vs.glsl") "terrain_vs.glsl")))) + (replace 'check + (lambda* (#:key inputs outputs tests? #:allow-other-keys) + (when tests? + (system "Xvfb :1 &") + (setenv "DISPLAY" ":1") + (add-installed-pythonpath inputs outputs) + (invoke "pytest" "tests" ))))))) + (propagated-inputs + (list python-pillow python-pyrr python-numpy python-moderngl + python-pyglet)) + (native-inputs + (list python-pytest xorg-server-for-tests)) + (home-page "https://github.com/moderngl/moderngl-window") + (synopsis "Cross-platform utility library for ModernGL") + (description "This ModernGL utility library simplifies window creation and +resource loading. You can create a window for ModernGL using pyglet, pygame, +PySide2, GLFW, SDL2, PyQt5 or tkinter. Events are unified into a single event +system. Resource loading includes loading of 2D textures/texture arrays, +shaders and objects/scenes.") + (license license:expat))) + (define-public python-screeninfo (package (name "python-screeninfo") -- 2.34.0
* gnu/packages/python-science.scm (python-manimpango): New variable. --- gnu/local.mk | 2 + .../python-manimpango-remove-manim-dep.patch | 172 ++++++++++++++++++ gnu/packages/python-science.scm | 26 +++ 3 files changed, 200 insertions(+) create mode 100644 gnu/packages/patches/python-manimpango-remove-manim-dep.patch diff --git a/gnu/local.mk b/gnu/local.mk index ff3e80ea68..c5fe7d87b8 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -47,6 +47,7 @@ # Copyright © 2021 Dmitry Polyakov <polyakov@liltechdude.xyz> # Copyright © 2021 Andrew Tropin <andrew@trop.in> # Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com> +# Copyright © 2021 Daniel Meißner <daniel.meissner-i4k@ruhr-uni-bochum.de> # # This file is part of GNU Guix. # @@ -1683,6 +1684,7 @@ dist_patch_DATA = \ %D%/packages/patches/python-flint-includes.patch \ %D%/packages/patches/python-libxml2-utf8.patch \ %D%/packages/patches/python-magic-python-bytecode.patch \ + %D%/packages/patches/python-manimpango-remove-manim-dep.patch \ %D%/packages/patches/python-matplotlib-run-under-wayland-gtk3.patch \ %D%/packages/patches/python-memcached-syntax-warnings.patch \ %D%/packages/patches/python-moderngl-window-skip-tests.patch \ diff --git a/gnu/packages/patches/python-manimpango-remove-manim-dep.patch b/gnu/packages/patches/python-manimpango-remove-manim-dep.patch new file mode 100644 index 0000000000..579c2302d8 --- /dev/null +++ b/gnu/packages/patches/python-manimpango-remove-manim-dep.patch @@ -0,0 +1,172 @@ +Fix dependency on manim for tests + +This fixes a circular dependency between manim and manimpango. + +Extracted from upstream: +https://github.com/ManimCommunity/ManimPango/commit/7e2b17aa14b10bd58af0598cc2de51a406682797 + +diff --git a/tests/_manim.py b/tests/_manim.py +index 3ea4676..b11d3e9 100644 +--- a/tests/_manim.py ++++ b/tests/_manim.py +@@ -2,11 +2,12 @@ + """This file contains helpers for the tests copied and modified + from Manim. + """ +- ++import copy + import os ++import re + from pathlib import Path + +-from manimpango import Alignment, MarkupUtils ++from manimpango import Alignment, MarkupUtils, TextSetting, text2svg + + + class MarkupText: +@@ -104,3 +105,115 @@ class MarkupText: + + def __repr__(self): + return f"MarkupText({repr(self.original_text)})" ++ ++ ++class Text: ++ def __init__( ++ self, ++ text: str, ++ fill_opacity: float = 1.0, ++ stroke_width: int = 0, ++ size: int = 1, ++ line_spacing: int = -1, ++ font: str = "", ++ slant: str = "NORMAL", ++ weight: str = "NORMAL", ++ gradient: tuple = None, ++ tab_width: int = 4, ++ disable_ligatures: bool = False, ++ filename: str = "text.svg", ++ **kwargs, ++ ) -> None: ++ self.size = size ++ self.filename = filename ++ self.line_spacing = line_spacing ++ self.font = font ++ self.slant = slant ++ self.weight = weight ++ self.gradient = gradient ++ self.tab_width = tab_width ++ self.original_text = text ++ self.disable_ligatures = disable_ligatures ++ text_without_tabs = text ++ self.t2f = self.t2s = self.t2w = {} ++ if text.find("\t") != -1: ++ text_without_tabs = text.replace("\t", " " * self.tab_width) ++ self.text = text_without_tabs ++ if self.line_spacing == -1: ++ self.line_spacing = self.size + self.size * 0.3 ++ else: ++ self.line_spacing = self.size + self.size * self.line_spacing ++ self.text2svg() ++ ++ def text2settings(self): ++ """Internally used function. Converts the texts and styles ++ to a setting for parsing.""" ++ settings = [] ++ t2x = [self.t2f, self.t2s, self.t2w] ++ for i in range(len(t2x)): ++ fsw = [self.font, self.slant, self.weight] ++ if t2x[i]: ++ for word, x in list(t2x[i].items()): ++ for start, end in self.find_indexes(word, self.text): ++ fsw[i] = x ++ settings.append(TextSetting(start, end, *fsw)) ++ # Set all text settings (default font, slant, weight) ++ fsw = [self.font, self.slant, self.weight] ++ settings.sort(key=lambda setting: setting.start) ++ temp_settings = settings.copy() ++ start = 0 ++ for setting in settings: ++ if setting.start != start: ++ temp_settings.append(TextSetting(start, setting.start, *fsw)) ++ start = setting.end ++ if start != len(self.text): ++ temp_settings.append(TextSetting(start, len(self.text), *fsw)) ++ settings = sorted(temp_settings, key=lambda setting: setting.start) ++ ++ if re.search(r"\n", self.text): ++ line_num = 0 ++ for start, end in self.find_indexes("\n", self.text): ++ for setting in settings: ++ if setting.line_num == -1: ++ setting.line_num = line_num ++ if start < setting.end: ++ line_num += 1 ++ new_setting = copy.copy(setting) ++ setting.end = end ++ new_setting.start = end ++ new_setting.line_num = line_num ++ settings.append(new_setting) ++ settings.sort(key=lambda setting: setting.start) ++ break ++ for setting in settings: ++ if setting.line_num == -1: ++ setting.line_num = 0 ++ return settings ++ ++ def text2svg(self): ++ """Internally used function. ++ Convert the text to SVG using Pango ++ """ ++ size = self.size * 10 ++ line_spacing = self.line_spacing * 10 ++ dir_name = Path(self.filename).parent ++ disable_liga = self.disable_ligatures ++ if not os.path.exists(dir_name): ++ os.makedirs(dir_name) ++ file_name = self.filename ++ settings = self.text2settings() ++ width = 600 ++ height = 400 ++ ++ return text2svg( ++ settings, ++ size, ++ line_spacing, ++ disable_liga, ++ file_name, ++ 30, ++ 30, ++ width, ++ height, ++ self.text, ++ ) +diff --git a/tests/test_fonts.py b/tests/test_fonts.py +index 51e7eb4..da42895 100644 +--- a/tests/test_fonts.py ++++ b/tests/test_fonts.py +@@ -3,13 +3,12 @@ import sys + from pathlib import Path + from shutil import copyfile + +-import manim + import pytest + + import manimpango + + from . import FONT_DIR +-from ._manim import MarkupText ++from ._manim import MarkupText, Text + + font_lists = { + (FONT_DIR / "AdobeVFPrototype.ttf").absolute(): "Adobe Variable Font Prototype", +@@ -38,7 +37,7 @@ def test_register_font(font_name): + @pytest.mark.parametrize("font_name", font_lists.values()) + def test_warning(capfd, font_name): + print(font_name) +- manim.Text("Testing", font=font_name) ++ Text("Testing", font=font_name) + captured = capfd.readouterr() + assert "Pango-WARNING **" not in captured.err, "Looks like pango raised a warning?" + +-- +2.32.0 diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm index 65f1dbf014..61628ec956 100644 --- a/gnu/packages/python-science.scm +++ b/gnu/packages/python-science.scm @@ -39,6 +39,7 @@ (define-module (gnu packages python-science) #:use-module (gnu packages check) #:use-module (gnu packages databases) #:use-module (gnu packages gcc) + #:use-module (gnu packages gtk) #:use-module (gnu packages image-processing) #:use-module (gnu packages machine-learning) #:use-module (gnu packages maths) @@ -1037,3 +1038,28 @@ (define-public python-modin libraries, Modin provides seamless integration and compatibility with existing pandas code.") (license license:asl2.0))) + +(define-public python-manimpango + (package + (name "python-manimpango") + (version "0.3.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "ManimPango" version)) + (sha256 + (base32 + "1j2mbhf7d82718nkc0r8x7cf35hlh13b67qkczjbbys3w24nyfsw")) + (patches (search-patches "python-manimpango-remove-manim-dep.patch")))) + (build-system python-build-system) + (native-inputs + (list pkg-config python-cython python-pytest)) + (inputs + (list pango)) + (home-page "https://manimpango.manim.community/") + (synopsis + "Bindings for pango for use with Manim") + (description + "These are Python bindings for Pango to be used with the mathematical +animation software Manim.") + (license license:gpl3+))) -- 2.34.0
* gnu/packages/python-science.scm (python-mapbox-earcut): New variable. --- gnu/packages/python-xyz.scm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index eee2fc0077..5e43b0ca03 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -19754,6 +19754,32 @@ (define-public python-moderngl-window shaders and objects/scenes.") (license license:expat))) +(define-public python-mapbox-earcut + (package + (name "python-mapbox-earcut") + (version "0.12.10") + (source + (origin + (method url-fetch) + (uri (pypi-uri "mapbox_earcut" version)) + (sha256 + (base32 + "0ly48lijgd9inq07x42pfp9c24fn16vn9axpmfwqrkn979krbnah")))) + (build-system python-build-system) + (propagated-inputs + (list python-numpy)) + (native-inputs + (list python-pytest python-wheel python-setuptools-scm cmake)) + (home-page + "https://github.com/skogler/mapbox_earcut_python") + (synopsis + "Python bindings for the Mapbox Earcut C++ polygon triangulation library") + (description + "The Mapbox Earcut library is a header-only C++ library which provides a +fast and robust triangulation of 2D polygons. This package provides Python +bindings for this library.") + (license license:isc))) + (define-public python-screeninfo (package (name "python-screeninfo") -- 2.34.0
* (python-screeninfo-0.6): New variable. --- gnu/packages/python-xyz.scm | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 5e43b0ca03..640edabd23 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -19780,19 +19780,19 @@ (define-public python-mapbox-earcut bindings for this library.") (license license:isc))) -(define-public python-screeninfo +(define-public python-screeninfo-0.6 (package (name "python-screeninfo") - (version "0.7") + (version "0.6.7") (source (origin (method url-fetch) (uri (pypi-uri "screeninfo" version)) (sha256 (base32 - "007m7sqv30qak56885dxbijksrg2hd121hfpvg2llm734wspra8j")))) + "1jv9m9xhl7zr2hzfx0w5zyw9pajn4b4zpln4rdl3zni9lcfaqjqw")))) (build-system python-build-system) - (native-inputs `(("python-pytest" ,python-pytest))) + (native-inputs (list python-pytest)) (home-page "https://github.com/rr-/screeninfo") (synopsis "Obtain information about physical screens") @@ -19802,6 +19802,17 @@ (define-public python-screeninfo etc.") (license (list license:expat license:bsd-3)))) +(define-public python-screeninfo + (package/inherit python-screeninfo-0.6 + (version "0.7") + (source + (origin + (method url-fetch) + (uri (pypi-uri "screeninfo" version)) + (sha256 + (base32 + "007m7sqv30qak56885dxbijksrg2hd121hfpvg2llm734wspra8j")))))) + (define-public python-rencode (package (name "python-rencode") -- 2.34.0
* gnu/packages/python-science.scm (python-manim): New variable. --- gnu/packages/python-science.scm | 61 +++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm index 61628ec956..ce451a3d28 100644 --- a/gnu/packages/python-science.scm +++ b/gnu/packages/python-science.scm @@ -37,6 +37,7 @@ (define-module (gnu packages python-science) #:use-module (gnu packages) #:use-module (gnu packages base) #:use-module (gnu packages check) + #:use-module (gnu packages cmake) #:use-module (gnu packages databases) #:use-module (gnu packages gcc) #:use-module (gnu packages gtk) @@ -56,6 +57,7 @@ (define-module (gnu packages python-science) #:use-module (gnu packages sphinx) #:use-module (gnu packages statistics) #:use-module (gnu packages time) + #:use-module (gnu packages video) #:use-module (gnu packages xdisorg) #:use-module (gnu packages xml) #:use-module (gnu packages xorg) @@ -1063,3 +1065,62 @@ (define-public python-manimpango "These are Python bindings for Pango to be used with the mathematical animation software Manim.") (license license:gpl3+))) + +(define-public python-manim + (package + (name "python-manim") + (version "0.9.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "manim" version)) + (sha256 + (base32 + "0ksp57wcy45xkjips5i4wwm690mhbs2dmlcgsbmiwx78mfk4z0r3")))) + (build-system python-build-system) + (arguments '(#:phases + (modify-phases %standard-phases + (add-before 'build 'fix-ffmpeg-path + (lambda* (#:key inputs outputs #:allow-other-keys) + (substitute* '("manim/constants.py") + (("FFMPEG_BIN: str = \"ffmpeg") + (string-append "FFMPEG_BIN: str = \"" + (search-input-file inputs "/bin/ffmpeg")))))) + ;; PyPI package contains no tests for manim but the + ;; setup.py test command fails, so remove it + (delete 'check)))) + (propagated-inputs + (list python-click + python-click-default-group + python-cloup-0.7 + python-colour + python-decorator + python-manimpango + python-mapbox-earcut + python-moderngl + python-moderngl-window + python-networkx + python-numpy + python-pillow + python-pycairo + python-pydub + python-pygments + python-requests + python-rich + python-scipy + python-screeninfo-0.6 + python-tqdm + python-watchdog)) + (inputs + (list ffmpeg)) + (native-inputs + (list python-wheel)) + (home-page "https://www.manim.community/") + (synopsis + "Python animation engine for explanatory math videos") + (description + "Manim is a Python library for creating mathematical animations. The +animations are written as Python code which is based on predefined objects. +You can make animations with maths formulas (LaTeX-based), simple shapes, 3D +objects, function graphs and more.") + (license license:expat))) -- 2.34.0
Am Sonntag, dem 02.01.2022 um 00:51 +0100 schrieb Daniel Meißner: > * gnu/packages/python-xyz.scm (python-glcontext): New variable. > --- > gnu/packages/python-xyz.scm | 53 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 53 insertions(+) > > diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm > index deff85e797..d8e6fa070e 100644 > --- a/gnu/packages/python-xyz.scm > +++ b/gnu/packages/python-xyz.scm > @@ -19555,6 +19555,59 @@ (define-public python-pyopengl-accelerate > (description > "This is the Cython-coded accelerator module for PyOpenGL."))) > > +(define-public python-glcontext > + (package > + (name "python-glcontext") > + (version "2.3.4") > + (source > + (origin > + (method git-fetch) > + (uri (git-reference > + (url "https://github.com/moderngl/glcontext") > + (commit version))) > + (file-name (git-file-name name version)) > + (sha256 > + (base32 > + "1m2zkl696vqmgrd5k1c5kl0krk6qgjgsz88qhahwva0l40bswvhp")))) > + (build-system python-build-system) > + (arguments > + '(#:phases > + (modify-phases %standard-phases > + (add-before 'build 'fix-lib-paths > + (lambda* (#:key inputs outputs #:allow-other-keys) > + (let ((mesa (assoc-ref inputs "mesa")) > + (libx11 (assoc-ref inputs "libx11"))) > + (substitute* '("glcontext/x11.cpp" "glcontext/egl.cpp") > + (("\"libGL.so\"") > + (string-append "\"" mesa "/lib/libGL.so\"")) > + (("\"libEGL.so\"") > + (string-append "\"" mesa "/lib/libEGL.so\"")) > + (("\"libX11.so\"") > + (string-append "\"" libx11 "/lib/libX11.so\""))) > + (substitute* '("glcontext/__init__.py") > + (("find_library\\('GL'\\)") > + (string-append "'" mesa "/lib/libGL.so'")) > + (("find_library\\('EGL'\\)") > + (string-append "'" mesa "/lib/libEGL.so'")) > + (("find_library\\(\"X11\"\\)") > + (string-append "'" libx11 "/lib/libX11.so'")))))) Use of (assoc-ref inputs input) in new code is discouraged in favour of this-package-input or search-input-file. Leo Famulari started a thread on which of the two to prefer over in guix-devel [1]. My personal opinion is that search-input-file ought to be fine here. [1] https://lists.gnu.org/archive/html/guix-devel/2021-12/msg00240.html
Am Sonntag, dem 02.01.2022 um 00:51 +0100 schrieb Daniel Meißner:
> + (description "ModernGL is a python wrapper over OpenGL 3.3+ core
> that
> +simplifies the creation of simple graphics applications like
> scientific
> +simulations, games or user interfaces. Usually, acquiring in-depth
> knowledge
> +of OpenGL requires a steep learning curve. In contrast, ModernGL is
> easy to
> +learn and use, moreover it is capable of rendering with high
> performance and
> +quality, with less code written. The majority of the moderngl code
> base is
> +also written in C++ for high performance.")
The first sentence is enough, we don't need ads :)
Am Sonntag, dem 02.01.2022 um 00:51 +0100 schrieb Daniel Meißner: > + (add-before 'build 'fix-lib-paths > + (lambda* (#:key inputs outputs #:allow-other-keys) > + (substitute* '("pyglet/gl/lib_glx.py") > + (("'GL'") > + (string-append "\"" (assoc-ref inputs "mesa") > + "/lib/libGL.so\"")) > + (("'GLU'") > + (string-append "\"" (assoc-ref inputs "glu") > + "/lib/libGLU.so\""))) > + (substitute* '("pyglet/font/freetype_lib.py") > + (("'freetype'") > + (string-append "\"" (assoc-ref inputs "freetype") > + "/lib/libfreetype.so\""))) > + (substitute* '("pyglet/font/fontconfig.py") > + (("'fontconfig'") > + (string-append "\"" (assoc-ref inputs "fontconfig") > + "/lib/libfontconfig.so\""))))) Here as well, friendship ended with assoc-ref ;) > + (replace 'check > + (lambda* (#:key inputs outputs tests? #:allow-other-keys) > + (when tests? > + (system "Xvfb :1 &") > + (setenv "DISPLAY" ":1") > + (add-installed-pythonpath inputs outputs) > + (invoke "pytest" "tests/unit"))))))) We typically use a pre-check phase to set things up. Does python support #:test-target? > + (description > + "Pyglet is a Python library for developing games and other > visually-rich > +applications. It supports windowing, user interface event handling, > +Joysticks, OpenGL graphics, loading images and videos, and playing > sounds and > +music. All of this with a friendly Pythonic API that's simple to > learn.") Last sentence sounds like an ad statement, the others can stay.
Am Sonntag, dem 02.01.2022 um 00:51 +0100 schrieb Daniel Meißner: > * gnu/packages/python-xyz.scm (python-moderngl-window): New variable. > --- > gnu/local.mk | 1 + > .../python-moderngl-window-skip-tests.patch | 146 > ++++++++++++++++++ > gnu/packages/python-xyz.scm | 44 ++++++ > 3 files changed, 191 insertions(+) > create mode 100644 gnu/packages/patches/python-moderngl-window-skip- > tests.patch > > diff --git a/gnu/local.mk b/gnu/local.mk > index 852f9f3246..ff3e80ea68 100644 > --- a/gnu/local.mk > +++ b/gnu/local.mk > @@ -1685,6 +1685,7 @@ dist_patch_DATA > = \ > %D%/packages/patches/python-magic-python-bytecode.patch \ > %D%/packages/patches/python-matplotlib-run-under-wayland- > gtk3.patch \ > %D%/packages/patches/python-memcached-syntax-warnings.patch \ > + %D%/packages/patches/python-moderngl-window-skip-tests.patch \ Document this addition as well as the file itself (New file.) in the commit log. > %D%/packages/patches/python-mox3-python3.6-compat.patch \ > %D%/packages/patches/python-typing-inspect-fix.patch \ > %D%/packages/patches/python-packaging-test- > arch.patch \ > diff --git a/gnu/packages/patches/python-moderngl-window-skip- > tests.patch b/gnu/packages/patches/python-moderngl-window-skip- > tests.patch > new file mode 100644 > index 0000000000..aee4b71e2a > --- /dev/null > +++ b/gnu/packages/patches/python-moderngl-window-skip-tests.patch > @@ -0,0 +1,146 @@ > +Skip failing tests and tests for optional dependencies > + > +The Python packages pywavefront and trimesh are optional > dependencies and not > +yet packaged in Guix but the tests try to load the modules anyway. > Therefore > +skip them. Okay. > +The tests test_texture_mimpamps, test_texture_abspath, > test_load_texture_2d > +and test_load_texture_array fail when Guix builds the package. This > is not > +the case when running the tests directly from a source tree. > + You might be missing an X extension here. Try adjusting the Xvfb call. Btw. I checked python-build-system and it relies on setup.py to do tests, so the check phase can stay, both here and where I previously criticised it. Sorry for the noise.
Am Sonntag, dem 02.01.2022 um 00:51 +0100 schrieb Daniel Meißner:
> + ;; PyPI package contains no tests for manim but
> the
> + ;; setup.py test command fails, so remove it
> + (delete 'check))))
Use #:tests? #f then, either with the same comment or a shortened one.
Hi Liliana,
Liliana Marie Prikler writes:
> Am Sonntag, dem 02.01.2022 um 00:51 +0100 schrieb Daniel Meißner:
>> +The tests test_texture_mimpamps, test_texture_abspath,
>> test_load_texture_2d
>> +and test_load_texture_array fail when Guix builds the package. This
>> is not
>> +the case when running the tests directly from a source tree.
>> +
> You might be missing an X extension here. Try adjusting the Xvfb call.
After some research on the internet and grepping Guix sources I adjusted
the invocation of Xvfb to the following:
Xvfb :1 +extension GLX &
as used for example in the package definition of gtk. However, the same
four tests still fail. Do you have an idea what other X extensions
might be missing?
Thanks,
Daniel