Skip to content
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

Add new method of specifying seed and using warnings.warn #3908

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

JasonGrace2282
Copy link
Member

@JasonGrace2282 JasonGrace2282 commented Aug 14, 2024

Overview: What does this pull request change?

This pull request

  • Changes random_seed from a __init__ argument to a class variable, and deprecates the argument in __init__
  • Typehints manim.utils.deprecation
  • Configures the python stdlib module warnings to use logging.
  • Changes manim.utils.deprecation to use warnings.warn

Motivation and Explanation: Why and how do your changes improve the library?

It's fairly tedious to set the seed via

class MyScene(Scene):
    def __init__(self):
        super().__init__(random_seed=3)

It's much nicer to do

class MyScene(Scene):
    random_seed = 3

This also is similar to how it works on the experimental branch.

As for using warnings.warn, this allows us to use the pytest warnings mechanism, which gives better error messages when testing warnings.

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

@JasonGrace2282 JasonGrace2282 added the enhancement Additions and improvements in general label Aug 14, 2024
manim/utils/deprecation.py Dismissed Show dismissed Hide dismissed
manim/utils/deprecation.py Fixed Show fixed Hide fixed
@JasonGrace2282 JasonGrace2282 requested a review from behackl August 14, 2024 16:55
manim/utils/deprecation.py Dismissed Show dismissed Hide dismissed
@JasonGrace2282 JasonGrace2282 changed the title Add new method of specifying seed Add new method of specifying seed and using warnings.warn Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Additions and improvements in general
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

1 participant