From 112c99ba4adfe502ff7c18428d5d485158593170 Mon Sep 17 00:00:00 2001 From: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com> Date: Mon, 16 Dec 2024 11:04:07 -0500 Subject: [PATCH] Fix `SyntaxWarnings` when building the docs and bump `readthedocs` to Python 3.13 (#3924) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Benjamin Hackl Co-authored-by: Francisco ManrĂ­quez Novoa <49853152+chopan050@users.noreply.github.com> --- .readthedocs.yml | 2 +- docs/source/examples.rst | 8 ++++---- manim/animation/fading.py | 2 +- manim/mobject/geometry/line.py | 2 +- manim/mobject/matrix.py | 6 +++--- manim/utils/docbuild/manim_directive.py | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index c102102858..afc76e5597 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -3,7 +3,7 @@ build: os: ubuntu-22.04 tools: - python: "3.11" + python: "3.13" apt_packages: - libpango1.0-dev diff --git a/docs/source/examples.rst b/docs/source/examples.rst index 3213c35160..00b4299a52 100644 --- a/docs/source/examples.rst +++ b/docs/source/examples.rst @@ -341,7 +341,7 @@ Plotting with Manim axes.i2gp(TAU, cos_graph), color=YELLOW, line_func=Line ) line_label = axes.get_graph_label( - cos_graph, "x=2\pi", x_val=TAU, direction=UR, color=WHITE + cos_graph, r"x=2\pi", x_val=TAU, direction=UR, color=WHITE ) plot = VGroup(axes, sin_graph, cos_graph, vert_line) @@ -482,7 +482,7 @@ Plotting with Manim tips=False, ) labels = ax.get_axis_labels( - x_label=Tex("$\Delta Q$"), y_label=Tex("T[$^\circ C$]") + x_label=Tex(r"$\Delta Q$"), y_label=Tex(r"T[$^\circ C$]") ) x_vals = [0, 8, 38, 39] @@ -785,8 +785,8 @@ Advanced Projects def add_x_labels(self): x_labels = [ - MathTex("\pi"), MathTex("2 \pi"), - MathTex("3 \pi"), MathTex("4 \pi"), + MathTex(r"\pi"), MathTex(r"2 \pi"), + MathTex(r"3 \pi"), MathTex(r"4 \pi"), ] for i in range(len(x_labels)): diff --git a/manim/animation/fading.py b/manim/animation/fading.py index f99eebe4cf..79cd41a516 100644 --- a/manim/animation/fading.py +++ b/manim/animation/fading.py @@ -166,7 +166,7 @@ def construct(self): dot = Dot(UP * 2 + LEFT) self.add(dot) tex = Tex( - "FadeOut with ", "shift ", " or target\\_position", " and scale" + "FadeOut with ", "shift ", r" or target\_position", " and scale" ).scale(1) animations = [ FadeOut(tex[0]), diff --git a/manim/mobject/geometry/line.py b/manim/mobject/geometry/line.py index ef0e4aa1ff..75a6037ff3 100644 --- a/manim/mobject/geometry/line.py +++ b/manim/mobject/geometry/line.py @@ -1068,7 +1068,7 @@ def construct(self): angle = Angle(line1, line2, radius=0.4) - value = DecimalNumber(angle.get_value(degrees=True), unit="^{\\circ}") + value = DecimalNumber(angle.get_value(degrees=True), unit=r"^{\circ}") value.next_to(angle, UR) self.add(line1, line2, angle, value) diff --git a/manim/mobject/matrix.py b/manim/mobject/matrix.py index e506bc4528..673aba1877 100644 --- a/manim/mobject/matrix.py +++ b/manim/mobject/matrix.py @@ -15,8 +15,8 @@ def construct(self): m2 = DecimalMatrix( [[3.456, 2.122], [33.2244, 12.33]], element_to_mobject_config={"num_decimal_places": 2}, - left_bracket="\\{", - right_bracket="\\}") + left_bracket=r"\{", + right_bracket=r"\}") m3 = MobjectMatrix( [[Circle().scale(0.3), Square().scale(0.3)], [MathTex("\\pi").scale(2), Star().scale(0.3)]], @@ -294,7 +294,7 @@ def get_columns(self): class GetColumnsExample(Scene): def construct(self): - m0 = Matrix([["\\pi", 3], [1, 5]]) + m0 = Matrix([[r"\pi", 3], [1, 5]]) m0.add(SurroundingRectangle(m0.get_columns()[1])) self.add(m0) """ diff --git a/manim/utils/docbuild/manim_directive.py b/manim/utils/docbuild/manim_directive.py index 4576be81dd..8d68f2aa53 100644 --- a/manim/utils/docbuild/manim_directive.py +++ b/manim/utils/docbuild/manim_directive.py @@ -174,7 +174,7 @@ def run(self) -> list[nodes.Element]: # Rendering is skipped if the tag skip-manim is present, # or if we are making the pot-files should_skip = ( - "skip-manim" in self.state.document.settings.env.app.builder.tags.tags + "skip-manim" in self.state.document.settings.env.app.builder.tags or self.state.document.settings.env.app.builder.name == "gettext" ) if should_skip: