Skip to content

Conversation

@t0mdavid-m
Copy link
Member

@t0mdavid-m t0mdavid-m commented Jan 26, 2026

Summary

Optimize file handling on Linux by using symlinks instead of copying demo workspaces and example files. This reduces disk space usage and improves performance while maintaining the ability for users to add new files to workspace directories.

Key Changes

  • Added _symlink_tree() helper function to recursively create directory structures with symlinked files
  • Modified copy_demo_workspace() to use symlinks on Linux and traditional copying on other platforms
  • Updated demo data loading in change_workspace() to use symlinks on Linux
  • Updated load_example_mzML_files() to use symlinks on Linux
  • Updated docstrings to document the platform-specific behavior

Implementation Details

  • Symlinks are created to resolved absolute paths to ensure they work correctly
  • Real directories are created (not symlinked) to allow users to add new files without affecting the original demo/example data
  • The implementation checks OS_PLATFORM == "linux" to determine which approach to use
  • Existing target files/directories are properly cleaned up before creating symlinks
  • Non-Linux platforms continue to use the original shutil.copytree() and shutil.copy() behavior

Summary by CodeRabbit

Release Notes

  • Improvements
    • Demo workspaces on Linux now use symlinks for more efficient file handling.
    • Example files are symlinked on Linux systems instead of being copied; standard copying behavior continues on other platforms.

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

On Linux, create symlinks instead of copying files when setting up
demo workspaces. This improves efficiency by saving disk space and
reducing setup time. Directory structure is still created normally
to allow users to add files without affecting the original demo data.
@t0mdavid-m t0mdavid-m merged commit 98b147f into main Jan 26, 2026
4 of 7 checks passed
@coderabbitai
Copy link

coderabbitai bot commented Jan 26, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The changes introduce platform-specific file handling for demo workspaces and example files. On Linux systems, a new _symlink_tree() helper recursively creates directory structures with symlinked files, while non-Linux platforms continue using traditional file copying. This affects both the demo workspace loading and example mzML file handling.

Changes

Cohort / File(s) Summary
Symlink Infrastructure
src/common/common.py
Added _symlink_tree() helper function to recursively mirror directory structures with symlinks on Linux. Modified copy_demo_workspace() to conditionally use symlinks (Linux) or shutil.copytree() (other platforms). Includes docstring updates describing platform-specific behavior.
Platform-Aware File Handling
src/fileupload.py
Imported OS_PLATFORM constant and enhanced load_example_mzML_files() to create symlinks on Linux or copy files on other platforms. Added explanatory docstring note documenting the symlink behavior.

Poem

🐰 A rabbit's hop through symlinks so fine,
On Linux they weave, a web of design,
While others still copy their paths tried and true,
One codebase now dances in platforms brand new!

✨ Finishing touches
  • 📝 Generate docstrings

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.

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.

3 participants