question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

constants.py cleanup and improvement

See original GitHub issue

manimlib/media_dir.txt is deprecated and should be removed, and the constants.py file should be brushed up as well.

Most notably the constant MEDIA_DIR currently gets completely ignored due to always being overwritten by this part of the code:

        if config["media_dir"]:
            MEDIA_DIR = config["media_dir"]
        else:
            MEDIA_DIR = os.path.join(
                os.path.expanduser('~'),
                "Dropbox (3Blue1Brown)/3Blue1Brown Team Folder"

This causes manim to always create a media folder in the location of the executed py file containing the rendered scenes. Just removing the else statement is enough.

The original DIR lines might also be changed to immediately imply raw text input for obvious reasons (you know, with \ being used for win folders, but also escape characters).

MEDIA_DIR = ""

MEDIA_DIR = r""

Adding a 4K rendering constant might be prudent, although linking it to an argument would happen in some other file I don’t know out of my head.

I’ve also spotted at least two text issues:

  1. Two times ‘both’ in a sentence that triggers when media_dir is redundantly specified in the terminal.
  2. -p referring to low quality output, even though it’s only triggering a preview, that is firing the mp4 into its assigned program.

And the file could use some serious commenting to make it easier for others to get into what’s going on. I’m willing to work on that and submit a PR for that.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
XorUnisoncommented, May 21, 2020

Oh right, we might also want to get the review and merge on #26 done first if we do the whole .cfg business here.

1reaction
PgBielcommented, May 21, 2020

Any PR takers?

I’d be willing to help on this one

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python Constants: Improve Your Code's Maintainability
Use constants to improve your code's readability, reusability, and maintainability; Apply different approaches to organize and manage constants ...
Read more >
Clean code about constants in Python
My question regards to constants in Python. Which is more "convenient" or "acceptable" among software engineers in general:.
Read more >
Python - Best/Cleanest way to define constant lists or dictionarys
Put your constants into their own module: # constants.py RED = 1 BLUE = 2 GREEN = 3. Then import that module and...
Read more >
Python code cleanup for beginners. 12 steps to readable and ...
Python code cleanup for beginners. 12 steps to readable and maintainable code. · Step 1. Declutter the repo · Step 2. No passwords...
Read more >
PEP 329 – Treating Builtins as Constants in the Standard Library
In short, if the proposal is adopted, the code will become cleaner and performance will improve across the board. Proposal. Add a module...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found