posit-dev / posit-dev/py-shiny
[Feature]: Create `shiny.app_dir()`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 135
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 21
Description
Category
Other
Scope
Quality of Life
Problem
Knowing where a Shiny application is running is quite difficult.
Some situations, we know where the app.py file is. Others, we do not.
It would be nice to have access to the "application directory" for things like bookmarking or finding files relatively.
Solution
I'd like for shiny.app_dir() to a function that returns a directory.
This directory is defined as the first value of:
- The value of
SHINY_APP_DIRsys environ - The parent directory of the input file being processed
- The current working directory.
Todo:
-
App.app_dirshould be initialized to the value ofapp_dir(). - Add the "show notification and update clipboard" method to
session.bookmark
Alternatives (Optional)
- Just use the current working directory.
This fails for multiple app applications.
Example (Optional)
Impact (Optional)
No response
Contribution? (Optional)
None
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the existing app.App and session.bookmark entry points, then trace how the application input file and current working directory are handled. Define the precedence for SHINY_APP_DIR, the input file's parent, and the working directory, initialize App.app_dir from it, and address the listed session.bookmark notification and clipboard work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100