plotly / plotly/dash

Dictionary format of author in package.json not supported

Open
#1,577 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
Python
Stars
24.4k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
13

Description

This is a minor issue, but I discovered that package.json files (for custom Dash component projects) that uses author field on the more "json-native format"

{
  "name" : "Barney Rubble",
  "email" : "b@rubble.com",
  "url" : "http://barnyrubble.tumblr.com/"
}

instead of

{
  "author": "Barney Rubble <b@rubble.com> (http://barnyrubble.tumblr.com/)"
}

fails with

Traceback (most recent call last):
  File "[...]/bin/dash-generate-components", line 11, in <module>
    load_entry_point('dash==1.19.0', 'console_scripts', 'dash-generate-components')()
  File "[...]/site-packages/dash/development/component_generator.py", line 213, in cli
    jlprefix=args.jl_prefix,
  File "[...]/site-packages/dash/development/component_generator.py", line 137, in generate_components
    rsuggests,
  File "[...]/site-packages/dash/development/_r_components_generation.py", line 777, in generate_exports
    has_wildcards,
  File "[...]/site-packages/dash/development/_r_components_generation.py", line 625, in generate_rpkg
    package_author_name = package_author.split(" <")[0]
AttributeError: 'collections.OrderedDict' object has no attribute 'split'

Related minor thing is that e-mail is also optional from npm's package.json side, but required by https://github.com/plotly/dash/blob/e8ac94919105a91c76a966c21aca2ec7b0297e22/dash/development/_r_components_generation.py#L626

EDIT: Which by looking at the code I see might fail also if the author string includes homepage, due to [:-1] filtering only.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at dash/development/_r_components_generation.py, especially generate_rpkg and the dash-generate-components entry point shown in the traceback. Reproduce the failure with a package.json using the dictionary author form, then verify generation also handles the optional email or homepage fields without raising the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.