posit-dev / posit-dev/py-shiny

[Feature]: Create `shiny.app_dir()`

Open
#1,900 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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_DIR sys environ
  • The parent directory of the input file being processed
  • The current working directory.

Todo:

  • App.app_dir should be initialized to the value of app_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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.