posit-dev / posit-dev/py-shiny
Should have version of `isolate()` which takes a function as an argument
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 135
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 21
Description
The existing with isolate(): syntax is good for running blocks of code, but it is not convenient when you simply want to get a value and use it in line. For example, suppose we want to get the value of `input.x
@output
@render.text
def txt():
with isolate():
capitalize = input.capitalize()
if capitalize:
return input.txt().upper()
else:
return input.txt()
In many cases, we just want to fetch a reactive value (or reactive Calc) inline, but the with isolate(): syntax makes that clunky and requires an extra variable to store the result.
It would be nice to be able to simply pass a function to isolate(), or perhaps a different function with a name like run_isolated().
For example:
@output
@render.text
def txt():
if run_isolated(input.capitalize):
return input.txt().upper()
else:
return input.txt()
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 isolate() implementation and its surrounding reactive entry points. Compare the requested callable form with the current with isolate(): behavior, then determine the API and verification needed for inline isolated reads to return the callable's value without creating a temporary variable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100