Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
2af0403
refactor(lib): change how manim API is imported
jeertmans Oct 13, 2023
e0fdac9
chore(lib): delete old files
jeertmans Oct 13, 2023
01aca2f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 13, 2023
5ebb61c
Merge remote-tracking branch 'origin/refactor-manim' into refactor-manim
jeertmans Oct 13, 2023
f3ff76e
wip: moving all commands
jeertmans Oct 13, 2023
06ff18f
adding animations
jeertmans Oct 13, 2023
9355e3d
fix tests
jeertmans Oct 13, 2023
2211ac6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 13, 2023
dd57527
fix mypy
jeertmans Oct 13, 2023
effcc75
fixes
jeertmans Oct 13, 2023
418f1f7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 13, 2023
f5f60e7
trying to fix docs
jeertmans Oct 14, 2023
d4a6148
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 14, 2023
1b1d6c5
wip: docs
jeertmans Oct 16, 2023
c803d67
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 16, 2023
bccff71
make it work
jeertmans Oct 16, 2023
036a796
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 16, 2023
2c3e5cc
wip test
jeertmans Oct 16, 2023
927a489
Merge remote-tracking branch 'origin/refactor-manim' into refactor-manim
jeertmans Oct 16, 2023
fb97409
tests are working
jeertmans Oct 16, 2023
946cb11
improving docs
jeertmans Oct 16, 2023
aa8205a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 16, 2023
85ff07e
fix index
jeertmans Oct 16, 2023
b79da53
docs: nicer shift
jeertmans Oct 16, 2023
6c14ee2
docs: nicer quickstart example
jeertmans Oct 16, 2023
95f84ef
fix tests
jeertmans Oct 17, 2023
353a7f4
change tests
jeertmans Oct 17, 2023
7b37c2d
move coverage to test workflow
jeertmans Oct 17, 2023
b182e72
fix(tests): remove resolve
jeertmans Oct 17, 2023
ffe8322
strict resolve
jeertmans Oct 17, 2023
90a2909
change local path test
jeertmans Oct 17, 2023
4c1df69
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 17, 2023
f8978c2
documented changes
jeertmans Oct 17, 2023
489ea5b
Merge remote-tracking branch 'origin/refactor-manim' into refactor-manim
jeertmans Oct 17, 2023
c010971
cleanup docs
jeertmans Oct 17, 2023
4d166d5
cleanup files
jeertmans Oct 17, 2023
a767aef
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 17, 2023
9300811
fix(ci): set type
jeertmans Oct 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ repos:
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies:
- black==23.9.1
- repo: https://github.com/PyCQA/docformatter
rev: v1.7.5
hooks:
- id: docformatter
additional_dependencies: [tomli]
args: [--in-place, --config, ./pyproject.toml]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.292
hooks:
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@ Wrap a series of animations between `self.start_loop()` and `self.stop_loop()` w
# example.py

from manim import *

# or: from manimlib import *
from manim_slides import Slide


class BasicExample(Slide):
def construct(self):
circle = Circle(radius=3, color=BLUE)
Expand Down
9 changes: 7 additions & 2 deletions docs/source/reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Therefore, we only document here the methods we think the end-user will ever
use, not the methods used internally when rendering.

```{eval-rst}
.. autoclass:: manim_slides.Slide
.. autoclass:: manim_slides.slide.Slide
:members:
add_to_canvas,
canvas,
Expand All @@ -22,6 +22,11 @@ use, not the methods used internally when rendering.
wipe,
zoom,

.. autoclass:: manim_slides.ThreeDSlide
.. autoclass:: manim_slides.slide.ThreeDSlide
:members:

.. automodule:: manim_slides.slide.animation
:members:
Wipe,
Zoom,
```
2 changes: 1 addition & 1 deletion example.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def construct(self):
language="console",
).shift(DOWN)

self.play(self.wipe(title, code))
self.wipe(title, code)
self.next_slide()

self.play(FadeIn(step, shift=RIGHT))
Expand Down
6 changes: 2 additions & 4 deletions manim_slides/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def dispatch(key: PositiveInt) -> None:


class Config(BaseModel): # type: ignore[misc]
"""General Manim Slides config"""
"""General Manim Slides config."""

keys: Keys = Keys()

Expand Down Expand Up @@ -207,9 +207,7 @@ def to_file(self, path: Path) -> None:
f.write(self.model_dump_json(indent=2))

def copy_to(self, folder: Path, use_cached: bool = True) -> "PresentationConfig":
"""
Copy the files to a given directory.
"""
"""Copy the files to a given directory."""
for slide_config in self.slides:
file = slide_config.file
rev_file = slide_config.rev_file
Expand Down
17 changes: 8 additions & 9 deletions manim_slides/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ def validate_config_option(


def file_to_data_uri(file: Path) -> str:
"""
Reads a video and returns the corresponding data-uri.
"""
"""Reads a video and returns the corresponding data-uri."""
b64 = b64encode(file.read_bytes()).decode("ascii")
mime_type = mimetypes.guess_type(file)[0] or "video/mp4"

Expand All @@ -84,9 +82,11 @@ def convert_to(self, dest: Path) -> None:
raise NotImplementedError

def load_template(self) -> str:
"""Returns the template as a string.
"""
Returns the template as a string.

An empty string is returned if no template is used."""
An empty string is returned if no template is used.
"""
return ""

def open(self, file: Path) -> Any:
Expand Down Expand Up @@ -358,7 +358,8 @@ def open(self, file: Path) -> bool:
return webbrowser.open(file.absolute().as_uri())

def convert_to(self, dest: Path) -> None:
"""Converts this configuration into a RevealJS HTML presentation, saved to DEST."""
"""Converts this configuration into a RevealJS HTML presentation, saved to
DEST."""
if self.data_uri:
assets_dir = Path("") # Actually we won't care.
else:
Expand Down Expand Up @@ -632,9 +633,7 @@ def convert(
config_options: Dict[str, str],
template: Optional[Path],
) -> None:
"""
Convert SCENE(s) into a given format and writes the result in DEST.
"""
"""Convert SCENE(s) into a given format and writes the result in DEST."""

presentation_configs = get_scenes_presentation_config(scenes, folder)

Expand Down
14 changes: 8 additions & 6 deletions manim_slides/docs/manim_slides_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,9 @@ def construct(self):


class SkipManimNode(nodes.Admonition, nodes.Element):
"""Auxiliary node class that is used when the ``skip-manim-slides`` tag is
present or ``.pot`` files are being built.
"""
Auxiliary node class that is used when the ``skip-manim-slides`` tag is present or
``.pot`` files are being built.

Skips rendering the manim-slides directive and outputs a placeholder instead.
"""
Expand All @@ -158,8 +159,9 @@ def depart(self, node):


def process_name_list(option_input: str, reference_type: str) -> list[str]:
r"""Reformats a string of space separated class names
as a list of strings containing valid Sphinx references.
r"""
Reformats a string of space separated class names as a list of strings containing
valid Sphinx references.

Tests
-----
Expand All @@ -175,8 +177,8 @@ def process_name_list(option_input: str, reference_type: str) -> list[str]:


class ManimSlidesDirective(Directive):
r"""The manim-slides directive, rendering videos while building
the documentation.
r"""
The manim-slides directive, rendering videos while building the documentation.

See the module docstring for documentation.
"""
Expand Down
5 changes: 2 additions & 3 deletions manim_slides/ipython/ipython_magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def manim_slides(
cell: Optional[str] = None,
local_ns: Dict[str, Any] = {},
) -> None:
r"""Render Manim Slides contained in IPython cells.
Works as a line or cell magic.
r"""
Render Manim Slides contained in IPython cells. Works as a line or cell magic.

.. note::

Expand Down Expand Up @@ -143,7 +143,6 @@ def construct(self):
In case you want to hide the red box containing the output progress bar, the ``progress_bar`` config
option should be set to ``None``. This can also be done by passing ``--progress_bar None`` as a
CLI flag.

"""
if cell:
exec(cell, local_ns)
Expand Down
5 changes: 2 additions & 3 deletions manim_slides/logger.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""
Logger utils, mostly copied from Manim Community:

https://github.com/ManimCommunity/manim/blob/d5b65b844b8ce8ff5151a2f56f9dc98cebbc1db4/manim/_config/logger_utils.py#L29-L101
"""

Expand Down Expand Up @@ -29,9 +30,7 @@


def make_logger() -> logging.Logger:
"""
Make a logger similar to the one used by Manim.
"""
"""Make a logger similar to the one used by Manim."""
RichHandler.KEYWORDS = HIGHLIGHTED_KEYWORDS
rich_handler = RichHandler(
show_time=True,
Expand Down
93 changes: 0 additions & 93 deletions manim_slides/manim.py

This file was deleted.

Loading