Repository: ManimCommunity/manim

Issue:
Fix pre-commit pipeline
<!--
Thanks for your contribution to ManimCommunity!

Before filling in the details, ensure:
- Your local changes are up-to-date with ManimCommunity/manim
  
- The title of your PR gives a descriptive summary to end-users. Some examples:
  - Fixed last animations not running to completion
  - Added gradient support and documentation for SVG files
  Examples of what *NOT* to do:
  - "fixed that styling issue" - not descriptive enough
  - "fixed issue #XYZ" - end-user needs to do further research
-->
## Changelog / Overview



<!-- Optional (Recommended): a detailed overview of the PR for the upcoming
release's changelog entry. Useful for when the PR title isn't enough. 

DO NOT REMOVE THE FOLLOWING CHANGELOG LINES, EVEN IF YOU DON'T USE THEM.-->
<!--changelog-start-->

<!--changelog-end-->

## Motivation
Flake8 is currently checking all files in a pr, where it only should check the changed files.
Maybe this pr will fix this problem
<!-- In what way do your changes improve the library? -->

## Explanation for Changes
<!-- How do your changes improve the library?

For PRs introducing new features, please provide code snippets using the
newly introduced functionality and ideally even the expected rendered output.
-->

## Testing Status
<!-- Optional (Recommended): your computer specs and what tests you ran with
their results, if any. This section is also intended for other
testing-related comments. -->

## Further Comments
<!-- Optional: any further comments that might be useful for reviewers. -->

## Checklist
- [ ] I have read the [Contributing Guidelines](https://docs.manim.community/en/latest/contributing.html)
- [ ] I have written a descriptive PR title (see top of PR template for examples)
- [ ] I have written a changelog entry for the PR or deem it unnecessary
- [ ] My new functions/classes either have a docstring or are private
- [ ] My new functions/classes have [tests](https://github.com/ManimCommunity/manim/wiki/Testing) added and (optional) examples in the docs
- [ ] My new documentation builds, looks correctly formatted, and adds no additional build warnings
<!-- Once again, thanks for contributing to ManimCommunity! -->


<!-- Do not modify the lines below. These are for the reviewers of your PR -->
## Reviewer Checklist
- [ ] The PR title is descriptive enough
- [ ] The PR is labeled correctly
- [ ] The changelog entry is completed if necessary
- [ ] Newly added functions/classes either have a docstring or are private
- [ ] Newly added functions/classes have [tests](https://github.com/ManimCommunity/manim/wiki/Testing) added and (optional) examples in the docs
- [ ] Newly added documentation builds, looks correctly formatted, and adds no additional build warnings

flake8 check by pre-commit.ci and flake8 check in our normal pipeline don't yield same result
## Description of bug / unexpected behavior

As requested by @kolibril13, I have enabled pre-commit.ci for this repository. It seems that the flake8 check we run usually in our pipeline, and the check run by pre-commit.ci are configured differently: compare

https://results.pre-commit.ci/run/github/265122478/1617749086.1i_sQPmmTjeknEIW3BXU8A

with

https://github.com/ManimCommunity/manim/pull/1262/checks?check_run_id=2282701850

Also, on a related note: if we have the status check by pre-commit.ci, do we still need to run our custom back/isort/flake8 pipelines, or could they be removed then? CC @naveen521kk.

## Expected behavior

`flake8` should be run with the same configuration in both cases, except if there is a good reason not to do so.





Discussion:
I think I found now a satisfying solution.
It was not possible for me to make pre-commit/flake8 to only consider the changed files (note, for isort and black, this is working).
But on my local machine, there were no errors.
So I decided to add a "skip" option only for github:
```
ci:
    skip: [flake8]
```
That only skips the flake8 pre-commit hook on github. 
Locally it is still there, as I tested with this example:
```py
def notGoodFunction(  bad ,styling, is_t, bad):
    wow = None
    if wow == True:
       return True
    else:
       return "A" + "Super long line that flake probably won't like" + "at" + "    all"
``` 
(thanks to @jsonvillanueva )
![Unbenannt](https://user-images.githubusercontent.com/44469195/113837157-d97d9100-978d-11eb-8991-f90e8149bc32.png)
And now the good part:
As we have flake8 checking already in our current git workflow, we don't need it on the git pre-commit.
With this said, I think we can then remove the isort and black format check from github, as pre-commit takes care of it. (Maybe we wait one week to make sure that no other bugs are there.)
Is there a disadvantage to simply fixing the files which make pre-commit.ci currently fail and removing our separate black / flake8 / isort checks in the pipeline?

Fewer of our own custom setup pipelines also means fewer breaking points.
> simply fixing the files which make pre-commit.ci currently fail

If it was easy to fix these lines, then I would totally with you to remove flake8 from the custom pipeline.
Unfortunately, I am not able to find this line.
Also, the documentation about the flake8 is not very large: https://flake8.pycqa.org/en/latest/user/using-hooks.html
As this current solution is working properly, I would stick to it.
But if someone has an idea to fix it, we can still try to make it work.
Or we open an issue at https://github.com/pre-commit/pre-commit , because as can be seen in the screenshot above, the local behaviour is different than the GitHub behaviour.
Maybe the old flake pipeline checks this file, while the new one doesn't.
https://github.com/ManimCommunity/manim/blob/4331817879dfee1c5b273a28e7329c913c9e53f5/.flake8#L1-L24
There is a simple difference between the two. Github Actions checks only for the `manim` folder and pre-commit checks for all the python files.
Ok, I just looked at other prs,
isort is only checking the changes: https://github.com/ManimCommunity/manim/pull/1275/commits/3e47251a8d764b578b666b91d2ad0a0a832c52c8
black is only checking the changes:
https://github.com/ManimCommunity/manim/pull/1122/commits/58b4f9508f2cd4a7f44a9eb0a045bac1ed4abf38
so it is only flake8 that considers all files.
I will investigate this.
It's fine when pre-commit.ci checks all files, I don't think that we have to change that. But we need a PR fixing the failing files.
https://github.com/ManimCommunity/manim/pull/1276 I got a nice solution here

Resolving patch:
diff --git a/docs/source/conf.py b/docs/source/conf.py
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -15,6 +15,8 @@
 from distutils.sysconfig import get_python_lib
 from pathlib import Path
 
+import guzzle_sphinx_theme
+
 sys.path.insert(0, os.path.abspath("."))
 
 
@@ -85,7 +87,6 @@
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
 #
-import guzzle_sphinx_theme
 
 html_theme_path = guzzle_sphinx_theme.html_theme_path()
 html_theme = "guzzle_sphinx_theme"
@@ -107,6 +108,7 @@
 # This specifies any additional css files that will override the theme's
 html_css_files = ["custom.css"]
 
+
 # source links to github
 def linkcode_resolve(domain, info):
     if domain != "py":
diff --git a/example_scenes/advanced_tex_fonts.py b/example_scenes/advanced_tex_fonts.py
--- a/example_scenes/advanced_tex_fonts.py
+++ b/example_scenes/advanced_tex_fonts.py
@@ -126,7 +126,7 @@ def write_one_line(template):
         for font in examples:
             try:
                 write_one_line(font)
-            except:
+            except Exception:
                 print("FAILURE on ", font.description, " - skipping.")
 
         self.play(


Test patch:
diff --git a/tests/conftest.py b/tests/conftest.py
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -1,12 +1,8 @@
-import logging
 import os
 import sys
 
-import numpy as np
 import pytest
 
-from manim import config
-
 
 def pytest_addoption(parser):
     parser.addoption(