Skip to content

Restore set.ipynb (setup.ipynb)#5

Open
bonsai wants to merge 1 commit intomainfrom
fix/restore-setup
Open

Restore set.ipynb (setup.ipynb)#5
bonsai wants to merge 1 commit intomainfrom
fix/restore-setup

Conversation

@bonsai
Copy link
Owner

@bonsai bonsai commented Jan 21, 2026

Restores the missing setup notebook for Colab.

Summary by CodeRabbit

  • New Features
    • Added a Jupyter notebook for automated Google Colab environment setup, which handles Google Drive integration for data persistence, repository management, dependency installation, model downloads, and verification checks to ensure the environment is properly configured.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Jan 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
mind-mutant Ready Ready Preview, Comment Jan 21, 2026 6:20pm

@gemini-code-assist
Copy link

Summary of Changes

Hello @bonsai, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request reintroduces a crucial setup notebook for Google Colab users of the MindMutant project. Its primary purpose is to streamline the environment configuration process, enabling users to quickly and efficiently prepare their Colab instance with all necessary dependencies, data persistence, and optimized code, thereby enhancing the user experience and reducing manual setup errors.

Highlights

  • Restored Colab Setup Notebook: The set/colab/setup.ipynb notebook, which was previously missing, has been restored to the repository. This notebook is essential for setting up the MindMutant environment within Google Colab.
  • Automated Environment Configuration: The restored notebook automates several critical setup steps, including mounting Google Drive for data persistence, cloning the MindMutant repository, configuring data persistence by linking local data to Drive, switching to Colab-optimized source code (src-colab), installing necessary dependencies, and downloading the ja_core_news_md Spacy model.
  • Setup Verification: The notebook includes a final step to verify the successful setup by loading the Spacy model and importing a core MindMutant module, ensuring the environment is ready for use.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

A new Jupyter notebook is introduced to automate MindMutant environment setup in Google Colab. The notebook orchestrates Drive mounting, repository cloning, dependency installation, and environment verification through shell commands and conditional checks.

Changes

Cohort / File(s) Summary
Colab Setup Automation
set/colab/setup.ipynb
New notebook automating MindMutant environment setup in Colab: mounts Google Drive, clones/updates repo, creates Drive-backed data directory with symlink, switches to Colab-optimized codebase, installs dependencies, downloads SpaCy model, and verifies setup.

Sequence Diagram(s)

sequenceDiagram
    participant User as Colab User
    participant Colab as Colab Runtime
    participant GDrive as Google Drive
    participant GitHub as GitHub
    participant Filesystem as Local Filesystem
    participant Pip as Pip Manager
    participant SpaCy as SpaCy

    User->>Colab: Execute setup notebook
    Colab->>GDrive: Mount Drive
    GDrive-->>Colab: Drive mounted
    Colab->>Filesystem: Check repo existence
    alt Repo exists
        Colab->>GitHub: Pull latest updates
    else Repo missing
        Colab->>GitHub: Clone MindMutant repo
    end
    GitHub-->>Filesystem: Repo ready
    Colab->>Filesystem: Create data directory in Drive
    Colab->>Filesystem: Replace local data with symlink to Drive
    Colab->>Filesystem: Check for src-colab
    alt src-colab available
        Colab->>Filesystem: Switch to Colab-optimized src
    end
    Colab->>Pip: Install requirements from set/colab/requirements.txt
    Pip-->>Colab: Dependencies installed
    Colab->>SpaCy: Download ja_core_news_md model
    SpaCy-->>Colab: Model downloaded
    Colab->>Colab: Verify SpaCy and MindMutant imports
    Colab-->>User: Setup complete
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A Colab dream, now set with care,
Drive mounting swift through virtual air,
Repos cloned with a hop and bound,
SpaCy models safely found!
Setup magic, tested true—
Let the experiments shine through!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Restore set.ipynb (setup.ipynb)' accurately describes the main change: restoring a missing setup notebook file to the repository.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 06472c2b69

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +69 to +71
"if not os.path.exists('data'):\n",
" !ln -s \"$drive_data_path\" data\n",
" print(f\"Linked data directory to {drive_data_path}\")\n",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use python var for symlink target

The !ln -s "$drive_data_path" data line runs in a shell where $drive_data_path is not defined (it’s a Python variable, not an environment variable), so the command expands to an empty string and fails to create the symlink. In Colab this means the data directory is never linked to Drive, so any generated data stays in the ephemeral runtime and is lost on restart. Use os.symlink(drive_data_path, 'data') or !ln -s "{drive_data_path}" data to interpolate the Python variable into the shell command.

Useful? React with 👍 / 👎.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request restores the setup.ipynb notebook for Colab. The notebook provides a good setup flow. My review includes a few suggestions to improve the robustness and idempotency of the shell commands within the notebook cells, particularly for repository cloning and data directory symlinking, to prevent errors on subsequent runs. I've also suggested a minor change to quiet the output of pip install for a cleaner user experience.

Comment on lines +37 to +42
"if not os.path.exists('MindMutant'):\n",
" !git clone https://github.com/bonsai/MindMutant.git\n",
" %cd MindMutant\n",
"else:\n",
" %cd MindMutant\n",
" !git pull"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The current logic for cloning the repository is not idempotent. If this cell is run a second time, the current working directory will likely be inside the repository, causing os.path.exists('MindMutant') to be False and the script to erroneously attempt to clone the repository inside itself. Using absolute paths makes the script more robust and ensures it behaves correctly on subsequent runs.

repo_path = '/content/MindMutant'
if not os.path.exists(repo_path):
    !git clone https://github.com/bonsai/MindMutant.git $repo_path

%cd $repo_path
!git pull

Comment on lines +64 to +73
"if os.path.exists('data'):\n",
" if not os.path.islink('data'):\n",
" !rm -rf data\n",
" print(\"Removed default data folder\")\n",
"\n",
"if not os.path.exists('data'):\n",
" !ln -s \"$drive_data_path\" data\n",
" print(f\"Linked data directory to {drive_data_path}\")\n",
"else:\n",
" print(\"Data directory already linked\")"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The current logic for creating the data symlink has a bug when data is a broken symlink. In that case, os.path.exists('data') returns False, and the script proceeds to !ln -s ..., which fails because the broken symlink file still exists. The logic should be made more robust to handle this case correctly.

if os.path.islink('data'):
    # It's a link. If it's broken, os.path.exists is False.
    if os.path.exists('data'):
        print("Data directory already linked")
    else:
        print("Recreating broken data symlink...")
        !rm -f data
        !ln -s "$drive_data_path" data
        print(f"Linked data directory to {drive_data_path}")
else:
    if os.path.lexists('data'): # It's a file or directory
        !rm -rf data
        print("Removed default data folder")
    !ln -s "$drive_data_path" data
    print(f"Linked data directory to {drive_data_path}")

"outputs": [],
"source": [
"# 5. Install Dependencies\n",
"!pip install -r set/colab/requirements.txt"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The pip install command can produce a lot of output. Using the -q (quiet) flag can make the notebook execution cleaner and easier to read by suppressing installation messages.

!pip install -q -r set/colab/requirements.txt

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.

1 participant