Commit graph

28 commits

Author SHA1 Message Date
Darylgolden
6018ebf445 Revert "Merge branch 'main' of https://github.com/ManimCommunity/manim"
This reverts commit e7f9d23aa7, reversing
changes made to afe91d02b6.
2023-07-31 15:29:39 +08:00
NotWearingPants
206db54af5
Migrate more os.path to pathlib in tests (#2991)
* Migrate more `os.path` to `pathlib` in tests

* Convert test fixtures to pathlib

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix mypy errors in tests

* migrate another pathlib instance

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2022-10-26 19:51:38 +02:00
ad_chaos
326bf21b5c
Fixed a File logging bug and some maintenance (#2546)
* Fixed File logging bug

Previously, the file logger was set in manim/_config/utils.
That caused problems as python tried to enable file logging when other
variables like media_dir, scene_name and others which were required for
the naming of log_dir were not yet set.

Now, we enable log_to_file in scene_file_writer where all the required
directories are declared before we enable file logging.

Also removed a test that was based on set_file_logger's previous
behaviour where it added a suffix only when the class name was
specified when calling manim. Since, we now enable file logging
in scene_file_writer, we always have access to the class name
regardless.

* Added Typings to file_ops

* Fixed typings and some warnings in _config.utils

Fixed some typings to now explicitly importing the types we require.
Removed one of the double declarations of dry_run.
Removed an unused import and a block of commented code.

* Remove rendundant check

* Add suggested changes

Co-authored-by: Hugues Devimeux <36239975+huguesdevimeux@users.noreply.github.com>
2022-03-30 16:43:04 +02:00
ad_chaos
5b11a0e48b
Improved Error in :mod:.utils.tex_file_writing (#2574)
* Better Error and insight

* Do not use keywords as identifiers

* add_tests

* Nasty comma

* Windows does its own thing

* Use os.path.join for windows

* Do not log path

* Include Insights

* Full stop.

Co-authored-by: Darylgolden <darylgolden@gmail.com>

* Full stop to test data.

Co-authored-by: Darylgolden <darylgolden@gmail.com>
2022-02-26 20:50:11 +01:00
Darylgolden
7efa2066ac
Removed unused imports (#2503)
* Remove unused imports

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Removed non pytest imports from tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Remove unused pytest imports

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* re-added removed pass statements

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2022-01-30 14:31:45 +00:00
GameDungeon
daf23c9d10
Upgraded typehints (#2429)
* Future Annotations

* Delete template_twitter_post.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Apply suggestions from code review

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fixed broken RTD

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-20 12:26:21 +08:00
Christopher Besch
3ce4c133dd
Introduced API for scene sections via :meth:.Scene.next_section (#2152)
* feat: added section class

* fix: fixed imports in scene.py

* feat: added section class

* fix: fixed imports in scene.py

* feat: scene file writer update; needs testing

* broken test

* fixed wrong partial movie files

* feat: added animation concatenation for sections

* fix: sections can contains None as partial movie file

* fix: correct section output file names

* fix: removed media folder

* feat: section output able to extract type

* feat: added guarantee_existence tests

* fix: touch file on windows

* fix: touch file on windows

* feat: automatically create control data with --set_test flag

* feat: added tests for sections output folder

* feat: added flag to enable sections

* feat: testing section metadata file

* feat: finished metadata tests; changed enums to be extendable

* fix: removed testing files

* fix: fixed section types

* fix: fixed outdated control data

* fix: fixed simple_scenes.py

* fix: fixed section type documentation example

* feat: added section video metadata to API

* fix: isort should stop destroying the import order for commands.py

* fix: fixed types of section metadata output

* fix: better comments

* ?

* feat: added elaborate test; switched name and type in next_section call

* feat: changed testing terminology: "config" got renamed to "movie metadata"

* fix: removed unicode lambda :<

* fix: fixed control data

* fix: removed test setter

* feat: added tutorial in the documentation

* fix: updated test control data

* fix: fixed double '.' in video tests

* fix: fixed some documentation

* fix: fixed missign JSON file in docs

* fix: implemented proposed changes

* fix: better --save_sections help

* fix: better docstrings

* fix: fixed last docstring...hopefully :>

* feat: custom section output supported

* fix: removed resolved todos

* fix: added debug for movie concatenation back

* fix: removed implemented TODO

* fix: removed doubled log

* fix: changed debug to info log

* fix: fixed log test data
2021-10-20 10:36:24 +02:00
GameDungeon
94821c10d8
Flake8 Changes + Fixing Warnings (#1968)
* Warning Removal

* Flake Stuff

* HotFix

* Docs Fix

* I'm Dumb

* Docs Fix 2

* Fixing Github Requests

* Fix

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* quick fix

* Add Deprecation Warning

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Weird Pre Commit Stuff

* Quick Fix

* Quick Fix

* Fix

* Flake Fix

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-09-03 13:45:48 -04:00
friedkeenan
1b32bce0c2
Output errors to stderr (#1570)
* Add error_console, output correct exit status

* Try to start Github Actions

* Fix spelling and isort

* Use python_version fixture
2021-05-25 10:30:31 +05:30
Jason Villanueva
a87bb28484
Refactored the Command Line Interface to use Click + Cloup instead of Argparse (#1013)
* Added click dependency and command structure

* Refactored code for separation of concerns

* Shortened plugins command to plugin, added render options

* first draft for render -h

* First successful render using click

* Cleaned main

* Moved flush_cache to option, ran black

* Removed argparse logic, scattered print statements

* corrected tests, all passing

* merge upstream

* fixed test with click's clirunner

* Fixed doctest configuration.rst

* Temporarily add in main_utils

* Removed main_utils.parse_args, used ManimConfig.digest_args

* fixed progress bar

* Fix jupyter

* black

* Fixed incorrectly merged merge conflict

* updated README command.png image

* updated configuration.rst expected output

* Fixed test_plugins and config_file expected type

* Refixed the jupyter fix

* Apply 3/5 suggestions

Remove stray print

Improve readability of test code

Added module docs for the subcommands

* Updated `main` to `manim` for tests

* Forced `file` positional argument to be Path type

* Fixed main -> manim

* Added libpango to linux dependency

* Updated poetry.lock

* Changed configuration.rst test

* Fixed test_a_flag test

minor space issue

added media_width to configuration.rst

* Fixed fps flag in Cairo rendering

* Fixed more outdated rst in sphinx docs

Removed default for fps option, always overwrote quality

Fixed doctest control_data

* Fixed more incorrect rst orderings

* Update tests/test_commands.py

Co-authored-by: Naveen M K <naveen@syrusdark.website>

* Added suggestions

* Removed unused imports

* Reverted entry point back to main

* Update manim/_config/default.cfg

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>

* Adjusted ipython_magic's call to the entry_point

* Converted frame_rate to int if integer

* run black

* Fixed doctest

* Fixed issue with command name from CliRunner

* Fixed multiple video windows opening from upstream merge

* to black or not to black

* Added deprecation warning to render subcommand

* warning instead of warn

* Applied Naveen's suggestions

* Made `manim render` show the help page

* Update manim/cli/render/commands.py

Co-authored-by: Naveen M K <naveen@syrusdark.website>

* Update manim/cli/cfg/commands.py

Co-authored-by: Naveen M K <naveen@syrusdark.website>

* Update manim/cli/cfg/commands.py

Co-authored-by: Naveen M K <naveen@syrusdark.website>

* Update manim/cli/plugins/commands.py

Co-authored-by: Naveen M K <naveen@syrusdark.website>

* Addressed some style changes

* add back in write_to_movie temporarily for OpenGL support

* Removed sound flag, deprecated use_opengl_renderer, added renderer option

* revert webgl_renderer_path removal

* Fixed cfg export

Fixed readme usage of CLI

* Flake8/black

* Fixed bug in setting renderer choice

* Removed log message due to default option

Removed default option of background color

Fixed write_to_movie flag default

* Fix log_to_file tests

* Make '-c' option for config_file, not background_color

* print colored version always

* Remove -v = --version shorthand, conflicts with verbosity

* Use subprocess.run instead of Click's CliRunner for stdout

* Refactor cli/render to use Cloup instead of click-option-group

1) There's a new file for each option group
2) render is now a cloup.Command, not a Group

Fixed issue when an animation is cached, manim can't merge the partial movie files. (#1192)

* fixed issue

* fixed tests

* Update manim/renderer/cairo_renderer.py

Co-authored-by: Darylgolden <darylgolden@gmail.com>

* added tests

* imrpoved test

* fixed logic

* added new test

* check if the file has been outputed

* added test when caching is enabled

* fixed tests on windows

* black

* Update manim/renderer/cairo_renderer.py

Co-authored-by: Naveen M K <naveen@syrusdark.website>

* Update tests/assert_utils.py

Co-authored-by: Naveen M K <naveen@syrusdark.website>

Co-authored-by: KingWampy <9156604+WampyCakes@users.noreply.github.com>
Co-authored-by: Darylgolden <darylgolden@gmail.com>
Co-authored-by: Naveen M K <naveen@syrusdark.website>

Added :ref_methods: to the manim directive (#1209)

* fix manim_directive for methods

* added ref_methods to Angle example

* black

* added new ref_methods references

* sort out ref_functions vs ref_methods in examples.rst

Co-authored-by: Jason Villanueva <a@jsonvillanueva.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>

Fixed issue when an animation is cached, manim can't merge the partial movie files. (#1192)

* fixed issue

* fixed tests

* Update manim/renderer/cairo_renderer.py

Co-authored-by: Darylgolden <darylgolden@gmail.com>

* added tests

* imrpoved test

* fixed logic

* added new test

* check if the file has been outputed

* added test when caching is enabled

* fixed tests on windows

* black

* Update manim/renderer/cairo_renderer.py

Co-authored-by: Naveen M K <naveen@syrusdark.website>

* Update tests/assert_utils.py

Co-authored-by: Naveen M K <naveen@syrusdark.website>

Co-authored-by: KingWampy <9156604+WampyCakes@users.noreply.github.com>
Co-authored-by: Darylgolden <darylgolden@gmail.com>
Co-authored-by: Naveen M K <naveen@syrusdark.website>

Added :ref_methods: to the manim directive (#1209)

* fix manim_directive for methods

* added ref_methods to Angle example

* black

* added new ref_methods references

* sort out ref_functions vs ref_methods in examples.rst

Co-authored-by: Jason Villanueva <a@jsonvillanueva.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>

Fixed unnecessary args dict

* Fixed bug that changed caching hashing result

* Revert doctest logic for fps filename output

Co-authored-by: Naveen M K <naveen@syrusdark.website>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
Co-authored-by: Gianluca Gippetto <gianluca.gippetto@gmail.com>
2021-04-01 23:53:07 -07:00
friedkeenan
3ad385a168
Enhancement: Migrate width/height/depth to properties (#1024)
* Migrate width/height/depth to properties

* Fix examples

* Fix typos

* Import manim for doctests

* Expect Square for doctests

* Improve docs for width/height/depth properties
2021-02-14 12:33:12 +01:00
Philipp Imhof
68ee6a1b15
Bugfix: correctly parse log_dir option (#932) 2021-01-13 13:48:37 +01:00
leotrs
6e0ba47a1e change every mention of file_writer_config to config. Also some tweaks to ManimConfig 2020-10-14 22:08:00 -04:00
leotrs
504ac73859 refactor config system so that all the global variables are defined in manim/config/__init__.py. All other files inside manim/config/ just contain utils that are used by either manim/config/__init__.py or directly by manim/__main__.py 2020-10-13 16:21:35 -04:00
Leo Torres
043cc53a6c
Merge pull request #521 from charlie4fun/fix_453
Fix #453: log files when scene is not specified
2020-10-07 17:02:57 -04:00
charlie4fun
9b61e3d0b7 Fix #453: log files naming, when scene is not specified, is fixed 2020-10-07 08:25:37 +02:00
Julian van Doorn
fa0a82c226
Implements -q[l|m|h|k] (#514)
Consolidates quality flags under a single --quality or -q flag
2020-10-06 13:42:52 -07:00
Hugues Devimeux
50c504f094
Refactored logs and added log-to-json feature (removed the old log-to-file feature), added logging test utils. (#403)
* refactored logging, and logging to file feature.

* cleaned up old tests

* Update tests/test_logging/test_logging.py

Co-authored-by: Hugues Devimeux <hugues.devimeux@gmail.com>
Co-authored-by: Pg Biel <9021226+PgBiel@users.noreply.github.com>
Co-authored-by: Leo Torres <dleonardotn@gmail.com>
2020-09-12 15:45:27 -04:00
Hugues Devimeux
5dd7bfe644
Miscellaneous Scene-Caching Optimisations and Bugfixes. (#315)
* fix 301/scene-caching optimization

* added nested dict with cirular references support

+ some docs

* optimization: now it ignores the scene object

* fix #320

* modified verbosity level

* added copy error handling

* fixed test_logging (maybe)

* captain black

* Various improvemens and optimizations,

Mostly about copys handling.

* yes sir I run black I swear sir

* ahem, typo

* (hopefully) fixed logging test

* Suggestion from the great @aathis

* Disable Scene Caching if `-` is filename.
Fix #348

* Import logger from proper place.

* Update expected log file

* added mappingproxy support

* fixed bug related when keys of the wrong format,

Now manim do really change the key to its hash. (wasn't really the case before)

* added large np array handling

* added message when using truncated array

* smolfix

* added unit test for hashing.py

* Fix a typo.

Co-authored-by: Leo Torres <dleonardotn@gmail.com>

* Assign suggestions from @PgBiel

* suggestion from @leotrs

* Apply suggestions from code review

Co-authored-by: Pg Biel <9021226+PgBiel@users.noreply.github.com>

* fixed tests

* imrpoved code organization

* NO COLON NO COLON NO NO COLON NO LOCON NO COLON

Co-authored-by: Pg Biel <9021226+PgBiel@users.noreply.github.com>

* NO COLON NO COLON NO NO COLON NO LOCON NO COLON

Co-authored-by: Pg Biel <9021226+PgBiel@users.noreply.github.com>

Co-authored-by: Aathish Sivasubrahmanian <aathish04@gmail.com>
Co-authored-by: Hugues Devimeux <hugues.devimeux@gmail.com>
Co-authored-by: Leo Torres <dleonardotn@gmail.com>
Co-authored-by: Pg Biel <9021226+PgBiel@users.noreply.github.com>
2020-09-08 13:35:03 +02:00
Aathish Sivasubrahmanian
6df53cc9f7
Deprecate TexMobject and TextMobject in favour of MathTex and Tex (#391)
* Rename TexMobject to MathTex
Rename TextMobject to Tex
Replace all instances of TexMobject with MathTex and TextMobject with Tex.
Get rid of single-use TexSymbol.
Rename SingleStringTexMobject to SingleStringMathTex.
Add Deprecation warnings to TexMobject and TextMobject.

* Edit __all__ for tex_mobject.py

* Re-add TexSymbol by request of devs.

* Docstring Modifications by @pgbiel

Co-authored-by: Pg Biel <9021226+PgBiel@users.noreply.github.com>

* Import logger differently, by @leotrs

* Run updated Black on files changed.

Co-authored-by: Pg Biel <9021226+PgBiel@users.noreply.github.com>
2020-09-02 09:20:37 +05:30
Hugues Devimeux
a623a9e4c3
Refactored tests and added new tests tools for videos-tests. (#335)
* Refactored file architecture of graphical tests

* removed tests_cache now useless

* added show_diff helper flag

* updated test data for TextMobjecttest

* refactored set_test_scene

* removed useless imports

* added video comparison tools

* improved tests helpers for devs

* added small video tests (provisionnal)

* small changes and cleanup

* RUN BLACK SIR YES SIR

* removed unused imports

* improved docs

* Apply suggestions from code review

Co-authored-by: Leo Torres <dleonardotn@gmail.com>

* updated tests from master.

* RUN BLACK SIR YES SIR

* fixed logging tests

* fixed test name

* rgb(0,0,0)

* fixed tests

* changed .npy data to fix test (hopefully)

* removed bad control data.

* aaand re added control data

* Regenerate Reference data for TextMobject and Text tests.

* Turn off fast-failing to see if tests pass anywhere

* Use shell mode for logging test.
(Fixes the failing logging test)

* Merge branch 'master' into refactor-tests

* Add OS Specific control data for Tex[t] tests on MacOS, Windows

* Use old TextMobject reference data.

* Add reference data for Linux.

* Use reference data from Ubuntu for Linux tests.

* Use @CorvidCanine's Text data and @leotrs's Tex[t]Mobject data.

* removed hash comparison in video tests.

* updated control data

* updated helpers

* removed useless comment

* removed test_writing

* updated tests

* renamed tests

* fixed tests

* Re-add fail-fast

* Apply suggestions from code review

Co-authored-by: Pg Biel <9021226+PgBiel@users.noreply.github.com>

* small docs mistake

* Update tests/utils/video_tester.py

Co-authored-by: Pg Biel <9021226+PgBiel@users.noreply.github.com>

Co-authored-by: Leo Torres <dleonardotn@gmail.com>
Co-authored-by: Aathish Sivasubrahmanian <aathish04@gmail.com>
Co-authored-by: Hugues Devimeux <hugues.devimeux@gmail.com>
Co-authored-by: Pg Biel <9021226+PgBiel@users.noreply.github.com>
2020-09-01 23:12:39 +02:00
Leo Torres
c89a441d8b
Refactor config (#340)
* add a context manager to temporarily change the global config. This will be useful for testing

* make Camera instances read some of their values from the global config dict at construction, and not when the Camera class is defined as it was previously done

* update test_logging to use the correct expected.txt file
2020-08-28 15:44:46 -04:00
Aathish Sivasubrahmanian
b6c0903bdb Changed log level for Read Configuration Files message.
Changed default logging level for tests to "DEBUG"

Edited expected.txt to account for verbosity change.
2020-08-15 12:01:12 +05:30
Aathish
338c67d34f
Merge branch 'master' into extend_subcmds 2020-08-12 19:09:58 +05:30
Hugues Devimeux
61d5e46914
Added Scene caching (#166)
* added caching functionnality

* deleted comments

* fixed wait bug

* added docstrings

* fixed minor typo in doc

* added cache cleaner

* added disable_caching option

* supported camera_config, and hashing functions

* use now digital naming when disable_caching

* added an option to flush the cache.

* fixed shameful typo

* added max_cached_files

* fixed merge issues

* added digital naming when disable_caching

* foxed skip_animations dlag that #98 broke

* removed cairo context from hash

* removed deprecated code

* fixed tests by setting write_to_movie to False

* removed useless code

* Revert "Use file_writer_config instead of config to get text_dir for Text() (#220)"

This reverts commit 7f2876991d.

* Apply suggestions from code review

Thanks @pgsuper !

Co-authored-by: Pg Biel <9021226+PgBiel@users.noreply.github.com>

* fixed max_files_cached typo

* Use file_writer_config instead of config to get text_dir for Text() (#220)

* Use file_writer_config instead if config for Text()

Fixes a bug where a keyerror would be thrown when rendering a Text() mobject.

* Make testing_utils.py use file_writer_config.

Thank you @huguesdevimeux !

Co-authored-by: Aathish Sivasubrahmanian <aathishs@Aathishs-MacBook-Air.local>

* removed useless code

* used self.camera instead of __dict__

* Apply suggestions from code review

Thanks @pgsuper !

Co-authored-by: Pg Biel <9021226+PgBiel@users.noreply.github.com>

* more pythonic

* fixed bug related to dict keys

When a dict containing keys not of the right type it caused an error.

thanks to @Aatish04.

* fixed minor bufg of the last commit

* Now clean_cache can remove multiple files.

* fixed bug when rendering multiple scenes.

skp_animations was not reset to a default value. Appeared in #98

* fixed bug related to nested dict with wrong keys

See previous commit.

* added infinity support for max_file_cached

and changed default

* changed default value of max_files_cached to 100

* deleted comments

* fixed docstrings

* fixed format (maybe)

* fixed format

* fixed tests

* Update expected.txt

Fixes logging tests.

* fixed merge conflict

* fixed logging test

* fixed docstrings

* minor doc improvement

* Apply suggestions from code review

Thank you Captain Docs !

Co-authored-by: Pg Biel <9021226+PgBiel@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Pg Biel <9021226+PgBiel@users.noreply.github.com>

* fixed typo of the last commit -_-

Co-authored-by: Aathish <aathish04@gmail.com>
Co-authored-by: Aathish Sivasubrahmanian <aathishs@Aathishs-MacBook-Air.local>
Co-authored-by: Pg Biel <9021226+PgBiel@users.noreply.github.com>
2020-08-12 15:19:01 +02:00
Aathish
54a3a3e97f Increase compatibility with scene-caching's tests. 2020-08-11 01:13:31 +05:30
Aathish
b7e455e653 Disable timestamps for logging tests. 2020-08-07 15:30:20 +05:30
Aathish
6646610b16
Implement Logging of Terminal Output to a .log file. (#180)
* Implemented logging of terminal output to file.

* Set default config values for log_to_file, log_dir

* Change default log_dir to ./logs

[skip ci]

* Bring log-file up to date with Master.

* Re-implement logging of Terminal output to log file.

* Move log _writing_ statements to separate function.

* Add a test for logging.

* Added test to check if logs generated are same.

* Added model log file.

* Test on this branch

* Change Regex expression for windows.

* Print log on failure

* Print log windows.

* Edit regex expression for both unix and windows.

* Edit regex expression.

* Edit expected log.

* Try stripping whitespace.

* Move test_logging to a separate file.

* Print log for all OS's

* Make rules for passing looser.

* Fix a typo

* Split string before cleaning.

* Remove duplicate test_logging file.

* Move default log directory into media directory.

* Ignored Line Numbers during test.

Added some documentation for why word-for-word comparisons are not used.

* Allow changing of Max width and height of logs via config files.

* Implemented word-for-word tests for log file.

(Except for data that _will_ change between tests)

* Formatted as per black's wishes.

* Add cfg subcmd case for log_width and height.
Modified regex to only ignore numbers and paths.

* Make regex remove list indicators as well.

* Make regex remove timestamps.

* Added a comment about the monstrous regex.

Co-authored-by: Aathish Sivasubrahmanian <aathishs@Aathishs-MacBook-Air.local>
2020-08-03 21:44:37 +02:00