Skip to content

feat(init): allow manim init project into an existing folder#4858

Open
Chessing234 wants to merge 2 commits into
ManimCommunity:mainfrom
Chessing234:feat/4693-init-existing-folder
Open

feat(init): allow manim init project into an existing folder#4858
Chessing234 wants to merge 2 commits into
ManimCommunity:mainfrom
Chessing234:feat/4693-init-existing-folder

Conversation

@Chessing234

Copy link
Copy Markdown

Summary

  • manim init project refused to run whenever the target directory already existed, breaking the natural flow suggested in Allow manim init project into existing folder #4693:
    uv init . --bare
    uv add manim
    uv run manim init project .
  • Now it only refuses when a file it would create (manim.cfg / main.py) already exists in the target folder; otherwise it initializes into the existing folder (creating it if needed).

Closes #4693

Test plan

  • pytest tests/interface/test_commands.py -k init
    • test_manim_init_project_existing_folder — initializes into a pre-existing, non-conflicting folder
    • test_manim_init_project_conflicting_files — refuses and leaves an existing main.py untouched

Made with Cursor

@GniLudio

GniLudio commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

I think it should be possible to even target folders with conflicting files, by just overriding the existing file(s).

Previously `manim init project` refused any existing directory, so the
common `uv init . && manim init project .` flow failed. Only refuse when
a file we would create (manim.cfg/main.py) already exists; otherwise
create the files in the existing folder.

Closes ManimCommunity#4693

Co-authored-by: Cursor <cursoragent@cursor.com>
@Chessing234 Chessing234 force-pushed the feat/4693-init-existing-folder branch from b145c84 to 8b19db3 Compare July 3, 2026 11:58
@Chessing234

Copy link
Copy Markdown
Author

Good call. I've updated it so a conflicting manim.cfg/main.py now prompts for confirmation and overwrites on "yes", rather than refusing outright.

I kept a prompt (defaulting to no) instead of overwriting silently, since init project . is easy to run in the wrong directory and could clobber someone's work. If you'd prefer it to just overwrite unconditionally, I'm happy to drop the prompt.

Prompt before overwriting an existing manim.cfg/main.py so initializing into
a folder that already has project files is possible, per review feedback.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Chessing234 Chessing234 force-pushed the feat/4693-init-existing-folder branch from dd76593 to 4485f78 Compare July 3, 2026 12:00
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.

Allow manim init project into existing folder

2 participants