Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions dash/development/_r_components_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@
"""


def _get_package_name(project_shortname):
# this helper function enables building of projects that do not keep their
# package.json or generated .py files in the top level of the package
return project_shortname.split("/", 1)[0]


# pylint: disable=R0914
def generate_class_string(name, props, project_shortname, prefix):
# Here we convert from snake case to camel case
Expand Down Expand Up @@ -454,6 +460,7 @@ def write_class_file(
# from within Python
write_help_file(name, props, description, prefix, rpkg_data)

project_shortname = _get_package_name(project_shortname)
import_string = "# AUTO GENERATED FILE - DO NOT EDIT\n\n"
class_string = generate_class_string(name, props, project_shortname, prefix)

Expand All @@ -479,7 +486,8 @@ def write_js_metadata(pkg_data, project_shortname, has_wildcards):
-------
"""
function_string = generate_js_metadata(
pkg_data=pkg_data, project_shortname=project_shortname
pkg_data=pkg_data,
project_shortname=_get_package_name(project_shortname),
)
file_name = "internal.R"

Expand Down Expand Up @@ -543,7 +551,9 @@ def generate_rpkg(
# to R package that we're generating here, use .get in case the key
# does not exist in package.json

package_name = snake_case_to_camel_case(project_shortname)
package_name = snake_case_to_camel_case(
_get_package_name(project_shortname)
)
lib_name = pkg_data.get("name")

if rpkg_data is not None:
Expand Down