From afcdcc829d33b1ac5e46b1fd7e709540d91e7c95 Mon Sep 17 00:00:00 2001 From: Michael Kashirin <88917554+mkashirin@users.noreply.github.com> Date: Wed, 11 Oct 2023 17:24:26 +0300 Subject: [PATCH 1/2] Update cmanimpango.pyx --- manimpango/cmanimpango.pyx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/manimpango/cmanimpango.pyx b/manimpango/cmanimpango.pyx index d8ea5116..ecaf1dca 100644 --- a/manimpango/cmanimpango.pyx +++ b/manimpango/cmanimpango.pyx @@ -28,16 +28,16 @@ class TextSetting: def text2svg( - settings:list, - size:int, - line_spacing:int, - disable_liga:bool, - file_name:str, - START_X:int, - START_Y:int, - width:int, - height:int, - orig_text:str, + settings: list, + size: float, + line_spacing: float, + disable_liga: bool, + file_name: str, + START_X: int, + START_Y: int, + width: int, + height: int, + orig_text: str, pango_width: typing.Union[int, None] = None, ) -> int: """Render an SVG file from a :class:`manim.mobject.svg.text_mobject.Text` object.""" @@ -183,7 +183,7 @@ class MarkupUtils: font: str, slant: str, weight: str, - size: int, + size: float, _: int, # for some there was a keyword here. disable_liga: bool, file_name: str, From 69ba49d882f0e6bd11023b09a9facf9fb5fa28df Mon Sep 17 00:00:00 2001 From: Naveen M K Date: Thu, 12 Oct 2023 20:20:58 +0530 Subject: [PATCH 2/2] Fix some more types in `cmanimpango.pyx` also update to `Cython>=3.0.2` --- manimpango/cmanimpango.pyx | 34 +++++++++++++++++----------------- pyproject.toml | 2 +- requirements-dev.txt | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/manimpango/cmanimpango.pyx b/manimpango/cmanimpango.pyx index ecaf1dca..8ede399f 100644 --- a/manimpango/cmanimpango.pyx +++ b/manimpango/cmanimpango.pyx @@ -10,13 +10,13 @@ class TextSetting: """Formatting for slices of a :class:`manim.mobject.svg.text_mobject.Text` object.""" def __init__( self, - start:int, - end:int, - font:str, - slant, - weight, - line_num=-1, - color: str=None, + start: int, + end: int, + font: str, + slant: str, + weight: str, + line_num = -1, + color: str = None, ): self.start = start self.end = end @@ -39,7 +39,7 @@ def text2svg( height: int, orig_text: str, pango_width: typing.Union[int, None] = None, -) -> int: +) -> str: """Render an SVG file from a :class:`manim.mobject.svg.text_mobject.Text` object.""" cdef cairo_surface_t* surface cdef cairo_t* cr @@ -180,11 +180,11 @@ class MarkupUtils: @staticmethod def text2svg( text: str, - font: str, + font: str | None, slant: str, weight: str, size: float, - _: int, # for some there was a keyword here. + _, # for some there was a keyword here. disable_liga: bool, file_name: str, START_X: int, @@ -192,12 +192,12 @@ class MarkupUtils: width: int, height: int, *, # keyword only arguments below - justify: bool = None, - indent: float = None, - line_spacing: float = None, - alignment: Alignment = None, - pango_width: typing.Union[int, None] = None, - ) -> int: + justify: bool | None = None, + indent: float | int | None = None, + line_spacing: float | None = None, + alignment: Alignment | None = None, + pango_width: int | None = None, + ) -> str: """Render an SVG file from a :class:`manim.mobject.svg.text_mobject.MarkupText` object.""" cdef cairo_surface_t* surface cdef cairo_t* context @@ -264,7 +264,7 @@ class MarkupUtils: pango_layout_set_alignment(layout, alignment.value) font_desc = pango_font_description_new() - if font_desc==NULL: + if font_desc == NULL: cairo_destroy(context) cairo_surface_destroy(surface) g_object_unref(layout) diff --git a/pyproject.toml b/pyproject.toml index 2e3fb959..9a0f7bf5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] build-backend = "setuptools.build_meta" -requires = ["Cython>=0.29.25,<3.0", "setuptools>=59.2.0", "wheel"] +requires = ["Cython>=3.0.2", "setuptools>=59.2.0", "wheel"] [tool.isort] # from https://black.readthedocs.io/en/stable/compatible_configs.html diff --git a/requirements-dev.txt b/requirements-dev.txt index b66b1256..7e7a6e0b 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,5 +1,5 @@ pytest-cov>=4.0,<5.0 pytest>=7.0.0,<8.0.0 -Cython>=0.29.32,<0.30.0 +Cython>=3.0.2 coverage>=6.5.0,<7.0.0 setuptools>=59.2.0