Documentation error in `assets_folder` parameter of dash.Dash
@LiamConnors is already working on this.
Since Jul 17, 2024.
- Dominant language
- Python
- Stars
- 24.4k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 13
Description
Context:
The error is present in the dev branch of the dash repo. A quick grep will show where the issue is:
grep -rn 'assets_folder: a path, relative to the current working directory' .
results in ./dash/dash.py:127: :param assets_folder: a path, relative to the current working directory,
Bug:
The assets_folder is relative to a path that is not straightforward to determine. However if you read the documentation in flask.Flask and also check out the function flask calls to find the base path (get_root_path in flask/helpers.py (flask here is the folder in your Python site-packages folder), it looks like it tries to find the path to the file in which (basically) dash.Dash(__name__) was called in.
From what I understand, it seems if you call with dash.Dash(__name__) it should always be able to find the file in which dash.Dash(__name__) is called and in that case the assets folder should reside in the same folder that contains the script that called dash.Dash(__name__).
However if you call dash.Dash("some_package_name") it will try and find a path to this package and make the root path the path to the folder containing the package (I'm not totally sure how this would be used in practice).
Finally if you call dash.Dash("arbitrary_string") and from that string the path to the file in which it was called nor the package can be determined, the root path is the path in the shell from which you invoked python (e.g., cd /some/path/; python sub/path/myapp.py : the root path will be /some/path/)
This might help with issue #399 and #536
Expected behaviour:
The documentation should somehow summarize this behaviour and put that as the documentation for assets_folder in dash.Dash
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.
Assessment
This issue has not been assessed yet.