Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dash-generate-components for julia on case-insensitive filesystems #1567

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
## Dash and Dash Renderer
### Changed
- [#1611](https://github.com/plotly/dash/pull/1611) Package dash-renderer artifacts and dependencies with Dash, and source renderer resources from within Dash.
- [#1567](https://github.com/plotly/dash/pull/1567) Julia component generator puts components into `src/jl` - fixes an issue on case-insensitive filesystems when the component name and module name match (modulo case) and no prefix is used. Also reduces JS/Julia clutter in the overloaded `src` directory.

### Fixed
- [#1664](https://github.com/plotly/dash/pull/1664) Fix [#1649](https://github.com/plotly/dash/issues/1649), makes the devtools readable with a dark theme.
Expand Down
17 changes: 9 additions & 8 deletions dash/development/_jl_components_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
"DashBase": "0.1",
}

jl_component_include_string = 'include("{name}.jl")'
jl_component_include_string = 'include("jl/{name}.jl")'

jl_resource_tuple_string = """DashBase.Resource(
relative_package_path = {relative_package_path},
Expand Down Expand Up @@ -500,7 +500,13 @@ def generate_struct_file(name, props, description, project_shortname, prefix):

file_name = format_fn_name(prefix, name) + ".jl"

file_path = os.path.join("src", file_name)
# put component files in src/jl subdir,
# this also creates the Julia source directory for the package
# if it is missing
if not os.path.exists("src/jl"):
os.makedirs("src/jl")

file_path = os.path.join("src", "jl", file_name)
with open(file_path, "w") as f:
f.write(import_string)
f.write(class_string)
Expand All @@ -512,12 +518,7 @@ def generate_struct_file(name, props, description, project_shortname, prefix):
def generate_module(
project_shortname, components, metadata, pkg_data, prefix, **kwargs
):
# the Julia source directory for the package won't exist on first call
# create the Julia directory if it is missing
if not os.path.exists("src"):
os.makedirs("src")

# now copy over all JS dependencies from the (Python) components dir
# copy over all JS dependencies from the (Python) components dir
# the inst/lib directory for the package won't exist on first call
# create this directory if it is missing
if os.path.exists("deps"):
Expand Down