Repository: ManimCommunity/manim

Issue:
Setting Filename using cfg file
## Description of proposed feature
Having a `manim.cfg` in a folder should be enough for manim to run. For example, users can run `manim .` in that folder and the `.cfg` file should contain the file name. Also, running `manim some.cfg` should also work. Doing this would simply make it so that people no need to remember the file name 😉 instead they would move to their workspace (say a folder) and then run `manim .` which should get the file name from the `manim.cfg` present in the folder and render that. This would help me a lot though.


## How can the new feature be used?
Supporting the command
```sh
manim .
```
and
```sh
manim
```
also 
```sh
manim my.cfg
```
for passing custom configuration files.


## Additional comments
I have seen this it the `pip` tries to do when we do `pip install .`.



Discussion:
There are three things to do here:

1. Right now, the input file name is a obligatory command line argument. For this to work, it should be optional. (This will add to our argparse woes...)

2. The ManimConfig should hold a reference to the input file. [This is already possible](https://docs.manim.community/en/latest/reference/manim._config.utils.ManimConfig.html#manim._config.utils.ManimConfig.input_file).

2. `__main__.py` must read the input file from the ManimConfig, and not from the command line arguments.
I am marking this as "good first issue".
@leotrs @naveen521kk Im planning on doing this as a first issue(if that's fine by you?).
assigning you :)
Unassigned due to inactivity. 
I'll give it a go

Resolving patch:
diff --git a/manim/_config/utils.py b/manim/_config/utils.py
--- a/manim/_config/utils.py
+++ b/manim/_config/utils.py
@@ -662,14 +662,24 @@ def digest_args(self, args: argparse.Namespace) -> "ManimConfig":
         digesting any other CLI arguments.
 
         """
+        # if the input file is a config file, parse it properly
+        if args.file.suffix == ".cfg":
+            args.config_file = args.file
+
+        # if args.file is `-`, the animation code has to be taken from STDIN, so the
+        # input file path shouldn't be absolute, since that file won't be read.
+        if str(args.file) == "-":
+            self.input_file = args.file
+
         # if a config file has been passed, digest it first so that other CLI
         # flags supersede it
         if args.config_file:
             self.digest_file(args.config_file)
 
-        # If args.file is `-`, the animation code has to be taken from STDIN, so the
-        # input file path shouldn't be absolute, since that file won't be read.
-        self.input_file = Path(args.file).absolute() if args.file != "-" else args.file
+        # read input_file from the args if it wasn't set by the config file
+        if not self.input_file:
+            self.input_file = Path(args.file).absolute()
+
         self.scene_names = args.scene_names if args.scene_names is not None else []
         self.output_file = args.output_file
 
diff --git a/manim/cli/render/commands.py b/manim/cli/render/commands.py
--- a/manim/cli/render/commands.py
+++ b/manim/cli/render/commands.py
@@ -37,7 +37,7 @@ def render(
 ):
     """Render SCENE(S) from the input FILE.
 
-    FILE is the file path of the script.
+    FILE is the file path of the script or a config file.
 
     SCENES is an optional list of scenes in the file.
     """
@@ -95,7 +95,7 @@ def __repr__(self):
         return click_args
 
     config.digest_args(click_args)
-    file = args["file"]
+    file = Path(config.input_file)
     if config.renderer == "opengl":
         from manim.renderer.opengl_renderer import OpenGLRenderer
 


Test patch:
diff --git a/tests/control_data/videos_data/InputFileViaCfg.json b/tests/control_data/videos_data/InputFileViaCfg.json
new file mode 100644
--- /dev/null
+++ b/tests/control_data/videos_data/InputFileViaCfg.json
@@ -0,0 +1,13 @@
+{
+    "name": "InputFileViaCfg",
+    "movie_metadata": {
+        "codec_name": "h264",
+        "width": 854,
+        "height": 480,
+        "avg_frame_rate": "15/1",
+        "duration": "1.000000",
+        "nb_frames": "15"
+    },
+    "section_dir_layout": [],
+    "section_index": []
+}
diff --git a/tests/test_scene_rendering/test_cli_flags.py b/tests/test_scene_rendering/test_cli_flags.py
--- a/tests/test_scene_rendering/test_cli_flags.py
+++ b/tests/test_scene_rendering/test_cli_flags.py
@@ -1,4 +1,5 @@
 import itertools
+import os
 import sys
 from pathlib import Path
 
@@ -638,3 +639,32 @@ def test_mov_can_be_set_as_output_format(tmp_path, manim_cfg_file, simple_scenes
     assert expected_mov_path.exists(), "expected .mov file not found at " + str(
         expected_mov_path,
     )
+
+
+@pytest.mark.slow
+@video_comparison(
+    "InputFileViaCfg.json",
+    "videos/simple_scenes/480p15/SquareToCircle.mp4",
+)
+def test_input_file_via_cfg(tmp_path, manim_cfg_file, simple_scenes_path):
+    scene_name = "SquareToCircle"
+    with open(os.path.join(tmp_path, "manim.cfg"), "w") as file:
+        file.write(
+            f"""
+[CLI]
+input_file = {simple_scenes_path}
+            """
+        )
+
+    command = [
+        sys.executable,
+        "-m",
+        "manim",
+        "-ql",
+        "--media_dir",
+        ".",
+        str(tmp_path),
+        scene_name,
+    ]
+    out, err, exit_code = capture(command, cwd=tmp_path)
+    assert exit_code == 0, err