-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Refactor config and related stuff #3473
Draft
Viicos
wants to merge
12
commits into
ManimCommunity:main
Choose a base branch
from
Viicos:3466-refactor-config
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Looking forward to this change! |
Viicos
force-pushed
the
3466-refactor-config
branch
from
December 11, 2023 17:12
9ae9936
to
8e26d05
Compare
Merged
4 tasks
Viicos
force-pushed
the
3466-refactor-config
branch
from
May 8, 2024 16:03
764a864
to
2305816
Compare
for more information, see https://pre-commit.ci
Fix several issues discovered from pyright
for more information, see https://pre-commit.ci
Heyo, are there any updates as to how the progress here is going? I'm interested in helping out here :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #3466.
What technically changed:
pydantic
to create a newManimConfig
class, providing built-in type hints, validation. This eliminates the need to define properties for each parameter.default.cfg
file where defaults were stored. Instead, default values are set on theManimConfig
class directly (making it easier to keep in sync).ManimColor
was the only exception, so a custom annotation was created (see docs for more details; TLDR theManimColor
class in untouched and not tied to Pydantic in any way, the custom annotation simply provides info about how to validate/parse input, and how JSON schema should be generated).What functionally changed:
ConfigProvider
class was added, exposing aget_config
method. Each subclass ofConfigProvider
is responsible for parsing a specific config format (for now, onlyCfgProvider
is implemented and provides an instance ofManimConfig
parsed from.cfg
files).cfg
,TOML
is well-specified and easier to parse because of the built-in types it supports. Thanks to the use of Pydantic, a JSON schema can be generated and used in IDEs to provide autocomplete when writing configuration files.ManimConfig
class has slightly changed. Mainly:ffmeg_loglevel
ffmpeg.loglevel
ffmpeg_executable
ffmpeg.executable
verbosity
logging.verbosity
media_embed
jupyter.media_embed
media_width
jupyter.media_width
properties with deprecation warnings where added to avoid any breaking changes.
CLI_CTX
section is now made available in the config, through thecli_formatting
attribute.cloup
context settings are made accessible through thecli_formatting.context_settings
property.TODO
tex_template
/tex_template_file
custom_folders
. Needs investigation, confusing? Still required?input_file
/output_file
(only set through the CLI)get_dir
ManimFrame
digest_args
)tex_template
/tex_template_file
: Might need some refactor to the related tex classes.ManimColor
CLI switch
toCLI flag
in docstrings?Reviewer Checklist