posit-dev / posit-dev/py-shiny
Improve module id errors
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 135
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 21
Description
From a documentation issue:
"In the docs for modules (https://shiny.rstudio.com/py/docs/workflow-modules.html) it's not explicitly documented that the first argument for the id must be added silently. (Not sure I'm describing this correctly, or in the most elegant way.)
What I mean is that the function definition in the UI and server has one argument:
def counter_ui(label: str = "Increment counter"):
But when you call this function, you must prepend the ID, like this:
counter_ui("counter1", "Counter 1"),
So, when I say add the id silently, I refer to counter1 in this example. If you forget to do this, you get all kinds of very strange, non-descriptive errors."
I doubt we can solve this with documentation, so we should make the function error more gracefully.
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 with the workflow-modules documentation and the counter_ui and server function examples described in the issue. Reproduce a call that omits the required module ID, then trace the resulting error; done means the missing-ID case produces a clear, descriptive error instead of confusing failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100