Can't define components in submodules
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 24.4k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 13
Description
Describe your context
dash==2.6.1
dash-bootstrap-components==1.2.1
dash-core-components==2.0.0
dash-html-components==2.0.0
dash-table==5.0.0
Describe the bug
I have an application that is deployed using a namespace package. It has multiple parts, and each of them is a different package, but all of them in the same namespace:
my_namespace.scripts holds data retrieval scripts, while my_namespace.web holds the dash application to show the data. I also created a new package to hold the components, called my_namespace.components. This means that there's no __init__.py inside the my_namespace folder.
I can import components like from my_namespace.components import MyComponent, but when I visit the webpage it raises an Error: <my components namespace name> was not found. This is because the script needed is not loaded. And the script is not loaded because the module my_namespace.components is not added to the registry (see line 38).
Expected behavior
To be able to define my components in a namespace package, like dash does with dash.html and dash.dcc
Contributor guide
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 in dash/development/base_component.py around lines 33-50 and trace how component modules are added to the registry. Reproduce the failure with a namespace package containing my_namespace.components, then compare the behavior with dash.html and dash.dcc. Done means components in a namespace package are registered and their required script loads when the Dash page is visited.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100