rsconnect-python icon indicating copy to clipboard operation
rsconnect-python copied to clipboard

Follow symlinks when building bundle

Open jcheng5 opened this issue 6 months ago • 3 comments

I have NOT tested this on Windows, only Mac. Please nobody merge until I've tested.

Intent

Fixes #414. When building a bundle, follow symlinks. This allows apps to include directories that might live somewhere else for deduplication/centralization reasons.

Type of Change

  • [x] Bug Fix
  • [ ] New Feature
  • [ ] Breaking Change

Approach

os.walk takes a followlinks argument that defaults to False. I simply set this to True. Note that from googling, os.walk doesn't check for circular references--I'm happy to add that if we think it's important.

Automated Tests

TODO

Directions for Reviewers

Create two sibling directories, one called data and one called shinytest.

shinytest/app.py:

from pathlib import Path
from shiny.express import input, ui

msg_path = Path(__file__).parent / "data/message.txt"

with open(msg_path) as f:
    f.read()

data/message.txt:

Hello, world!

Then, from within the shinytest directory, run ln -s ../data data.

Deploy from within the shinytest directory as usual, and see if it crashes on startup or the message correctly appears instead.

Checklist

  • [ ] I have updated CHANGELOG.md to cover notable changes.
  • [ ] I have updated all related GitHub issues to reflect their current state.

jcheng5 avatar Feb 22 '24 19:02 jcheng5