Skip to content

CONFIG cleanup #648

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

Closed
wants to merge 8 commits into from
Closed

CONFIG cleanup #648

wants to merge 8 commits into from

Conversation

leotrs
Copy link
Contributor

@leotrs leotrs commented Oct 31, 2020

Motivation

CONFIG dicts in manim classes are hard to debug, cannot be documented, and are an all around Bad Thing.

List of Changes

Now that the actual global config system is more robust, I finally feel comfortable removing some of the CONFIG stuff. I decided to start in geometry.py since these classes are well tested. I added a bunch of new tests as well.

Testing Status

Local pass

Further Comments

I haven't removed all of the CONFIGs found in geometry.py. The problem is that some of them contain style options such as stroke_width, color, fill_color, fill_opactiy, etc. These in and of themselves are buggy and hard to maintain, and they would require a coordinated effort that goes all the way up to fundamentally modifying Mobject and VMobject. So I'm holding off on those for the time being.

@leotrs
Copy link
Contributor Author

leotrs commented Oct 31, 2020

This has brought up an unexpected issue. We will need to determine which constructor arguments are positional vs which ones are keyword arguments. For example, in the past we could do this

Arrow(vec1, vec2)

But in the current pass of this PR we need to do this

Arrow(start=vec1, end=vec2)

I personally think this is fine as it's more explicit, but others might think differently.

The reason for this change is that it's easier to pass constructor keyword arguments up to the parent class. Whenever a child class sets the default value of a positional argument (thereby turning it into a keyword argument), things get messy.

@behackl
Copy link
Member

behackl commented Oct 31, 2020

I think this is a major change that will break tons and tons of user code. If there is some possibility; any at all to preserve the current behavior, I'd really like to see that.

@behackl
Copy link
Member

behackl commented Oct 31, 2020

... okay, now I've looked at the code as well.

I am not sure about the best course of action. Objects in geometry might actually profit from adding *args that are passed to the call of __init__ of the inherited class; especially in cases like Line and Arrow.

@leotrs
Copy link
Contributor Author

leotrs commented Oct 31, 2020 via email

@leotrs
Copy link
Contributor Author

leotrs commented Nov 9, 2020

Closing this as @cobordism and I are going to take another try at it.

@leotrs leotrs closed this Nov 9, 2020
@leotrs leotrs deleted the remove-CONFIG branch November 10, 2020 12:52
@leotrs leotrs mentioned this pull request Nov 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants