Giter VIP home page Giter VIP logo

dash-component-boilerplate's Introduction

Dash Component Boilerplate

This repository contains a Cookiecutter template to create your own Dash components.

Usage

To use this boilerplate:

  1. Install the requirements:
    $ pip install cookiecutter
    $ pip install virtualenv
    
    Node.js/npm is also required.
  2. Run cookiecutter on the boilerplate repo:
    $ cookiecutter gh:plotly/dash-component-boilerplate
    
  3. Answer the questions about the project.
    • project_name: This is the "human-readable" name of your project. For example, "Dash Core Components".
    • project_shortname: is derived from the project name, it is the name of the "Python library" for your project. By default, this is generated from your project_name by lowercasing the name and replacing spaces & - with underscores. For example, for "Dash Core Components" this would be "dash_core_components".
    • component_name: This is the name of the initial component that is generated. As a JavaScript class name it should be in PascalCase. defaults to the PascalCase version of project_shortname.
    • jl_prefix: Optional prefix for Julia components. For example, dash_core_components uses "dcc" so the Python dcc.Input becomes dccInput in Julia, and dash_table uses "dash" to make dashDataTable.
    • r_prefix: Optional prefix for R components. For example, dash_core_components uses "dcc" so the Python dcc.Input becomes dccInput in R, and dash_table uses "dash" to make dashDataTable.
    • author_name and author_email: for package.json and DESCRIPTION (for R) metadata.
    • github_org: If you plan to push this to GitHub, enter the organization or username that will own it (for URLs to the project homepage and bug report page)
    • description: the project description, included in package.json.
    • license: License type for the component library. Plotly recommends the MIT license, but you should read the generated LICENSE file carefully to make sure this is right for you.
    • publish_on_npm: Set to false to only serve locally from the package data.
    • install_dependencies: Set to false to only generate the project structure.
  4. The project will be generated in a folder named with your project_shortname.
  5. Follow the directions in the generated README to start developing your new Dash component.

Installing the dependencies can take a long time. They will be installed in a folder named venv, created by virtualenv. This ensures that dash is installed to generate the components in the build:backends script of the generated package.json.

Advanced customization

Shared cache groups for async chunks

Shared async chunks for code that repeats across multiple async chunks is already supported through our custom webpack.config.js optimizations. You can leverage it by manually the path of {{cookiecutter.project_shortname}}-shared.js to _js_dist inside {{cookiecutter.project_shortname}}/__init__.py (as well as the associated external URL).

More Resources

dash-component-boilerplate's People

Contributors

aeltanawy avatar alexcjohnson avatar anders-kiaer avatar bachibouzouk avatar chriddyp avatar emmanuelle avatar etpinard avatar felix-gauthier avatar gvwilson avatar harryturr avatar idling-mind avatar jbampton avatar justinclift avatar jyotirsharma avatar liamconnors avatar luapi avatar marc-andre-rivet avatar mkcor avatar mousius avatar mungojam avatar ngnpope avatar nicolaskruchten avatar rmarren1 avatar ryanand26 avatar shammamah-zz avatar t4rk1n avatar tcbegley avatar verazab avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dash-component-boilerplate's Issues

Issue with executing dash-component-boilerplate on Windows

Hi I am trying to use dash-component-boilerplate to create a new project with python 2.7 and Anaconda on Windows. However, after using the command cookiecutter https://github.com/plotly/dash-component-boilerplate.git and entering attributes as suggested on the home page, it always fails with error messages shown below. I did not change anything during the process and just let the program to run on its own. I have tried on different computers, and the result is the same. I tried to search online but no one had the some issue as mine. Could someone help me take a look? Thank you so much.

My node version is 10.16.0, npm version is 6.9.0 and webpack version is 4.34.0

Following is the entire log:

`(py2) C:\Users\zianhu\PycharmProjects>cookiecutter dash-component-boilerplate
project_name [my dash component]:
project_shortname [my_dash_component]:
component_name [mydashcomponent]:
author_name [Enter your name (For package.json)]: April
author_email [Enter your email (For package.json)]: [email protected]
description [Project Description]: hh
Select license:
1 - MIT License
2 - BSD License
3 - ISC License
4 - Apache Software License 2.0
5 - GNU General Public License v3
6 - Not open source
Choose from 1, 2, 3, 4, 5, 6 (1, 2, 3, 4, 5, 6) [1]: 6
publish_on_npm [True]:
install_dependencies [True]:
Executing: virtualenv venv
No LICENSE.txt / LICENSE found in source
New python executable in C:\Users\zianhu\PycharmProjects\my_dash_component\venv\Scripts\python.exe
Installing setuptools, pip, wheel...
done.

Installing dependencies

Executing: venv\Scripts\python -m pip install -r requirements.txt
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting dash>=0.38.0 (from -r requirements.txt (line 2))
Collecting lxml (from dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/ef/e2/1968eb678147ef6bb6ef780d317f6eb25ea87bd427bcce1098c251f5461f/lxml-4.3.4-cp27-cp27m-win_amd64.whl
Collecting pytest-sugar (from dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/da/3b/f1e3c8830860c1df8f0e0f6713932475141210cfa021e362ca2774d2bf02/pytest_sugar-0.9.2-py2.py3-none-any.whl
Collecting waitress (from dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/41/e0/366785e4b9b4d212df4c3b084153bf7f5e5ab355928f5465144e5fc98494/waitress-1.3.0-py2.py3-none-any.whl
Collecting beautifulsoup4 (from dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/8b/0e/048a2f88bc4be5e3697df9dc1f7b9d5c9c75be62676feeeb91d2e896c5ea/beautifulsoup4-4.7.1-py2-none-any.whl
Collecting pytest (from dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/b3/eb/df264c0b1ff4aaf263375dc09aabd9093364f66060be9b26f3a2c166d558/pytest-4.6.3-py2.py3-none-any.whl
Collecting flask-compress (from dash>=0.38.0->-r requirements.txt (line 2))
Collecting percy (from dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/d6/39/528e689e21baa4d625cecc326c0d56c976d63855f9d114c07ccaed8a73eb/percy-2.0.2-py2.py3-none-any.whl
Collecting dash-core-components==1.0.0 (from dash>=0.38.0->-r requirements.txt (line 2))
Collecting dash-html-components==1.0.0 (from dash>=0.38.0->-r requirements.txt (line 2))
Collecting Flask>=0.12 (from dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/9a/74/670ae9737d14114753b8c8fdf2e8bd212a05d3b361ab15b44937dfd40985/Flask-1.0.3-py2.py3-none-any.whl
Collecting requests[security] (from dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl
Collecting plotly (from dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/ff/75/3982bac5076d0ce6d23103c03840fcaec90c533409f9d82c19f54512a38a/plotly-3.10.0-py2.py3-none-any.whl
Collecting selenium (from dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/80/d6/4294f0b4bce4de0abf13e17190289f9d0613b0a44e5dd6a7f5ca98459853/selenium-3.141.0-py2.py3-none-any.whl
Collecting pytest-mock (from dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/30/43/8deecb4c123bbc16d25666f1a6d241109c97aeb2e50806b952661c8e4b95/pytest_mock-1.10.4-py2.py3-none-any.whl
Collecting dash-renderer==1.0.0 (from dash>=0.38.0->-r requirements.txt (line 2))
Collecting dash-table==4.0.0 (from dash>=0.38.0->-r requirements.txt (line 2))
Collecting termcolor>=1.1.0 (from pytest-sugar->dash>=0.38.0->-r requirements.txt (line 2))
Collecting packaging>=14.1 (from pytest-sugar->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/91/32/58bc30e646e55eab8b21abf89e353f59c0cc02c417e42929f4a9546e1b1d/packaging-19.0-py2.py3-none-any.whl
Collecting soupsieve>=1.2 (from beautifulsoup4->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/35/e3/25079e8911085ab76a6f2facae0771078260c930216ab0b0c44dc5c9bf31/soupsieve-1.9.2-py2.py3-none-any.whl
Collecting funcsigs>=1.0; python_version < "3.0" (from pytest->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/69/cb/f5be453359271714c01b9bd06126eaf2e368f1fddfff30818754b5ac2328/funcsigs-1.0.2-py2.py3-none-any.whl
Collecting importlib-metadata>=0.12 (from pytest->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/bd/23/dce4879ec58acf3959580bfe769926ed8198727250c5e395e6785c764a02/importlib_metadata-0.18-py2.py3-none-any.whl
Collecting six>=1.10.0 (from pytest->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting attrs>=17.4.0 (from pytest->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/23/96/d828354fa2dbdf216eaa7b7de0db692f12c234f7ef888cc14980ef40d1d2/attrs-19.1.0-py2.py3-none-any.whl
Collecting pluggy<1.0,>=0.12 (from pytest->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/06/ee/de89e0582276e3551df3110088bf20844de2b0e7df2748406876cc78e021/pluggy-0.12.0-py2.py3-none-any.whl
Collecting pathlib2>=2.2.0; python_version < "3.6" (from pytest->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/67/c6/4dbf5dfdbe1140cadf765c3896acc098578626c35721bc7d3eb35f6a8fc1/pathlib2-2.3.4-py2.py3-none-any.whl
Collecting py>=1.5.0 (from pytest->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/76/bc/394ad449851729244a97857ee14d7cba61ddb268dce3db538ba2f2ba1f0f/py-1.8.0-py2.py3-none-any.whl
Collecting atomicwrites>=1.0 (from pytest->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/52/90/6155aa926f43f2b2a22b01be7241be3bfd1ceaf7d0b3267213e8127d41f4/atomicwrites-1.3.0-py2.py3-none-any.whl
Collecting wcwidth (from pytest->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/7e/9f/526a6947247599b084ee5232e4f9190a38f398d7300d866af3ab571a5bfe/wcwidth-0.1.7-py2.py3-none-any.whl
Collecting colorama; sys_platform == "win32" (from pytest->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/4f/a6/728666f39bfff1719fc94c481890b2106837da9318031f71a8424b662e12/colorama-0.4.1-py2.py3-none-any.whl
Collecting more-itertools<6.0.0,>=4.0.0; python_version <= "2.7" (from pytest->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/2f/9d/dcfe59e213093695f108508af1214cf9cd95cc5489e46877ec5cb56369e5/more_itertools-5.0.0-py2-none-any.whl
Collecting click>=5.1 (from Flask>=0.12->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl
Collecting Werkzeug>=0.14 (from Flask>=0.12->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/9f/57/92a497e38161ce40606c27a86759c6b92dd34fcdb33f64171ec559257c02/Werkzeug-0.15.4-py2.py3-none-any.whl
Collecting Jinja2>=2.10 (from Flask>=0.12->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/1d/e7/fd8b501e7a6dfe492a433deb7b9d833d39ca74916fa8bc63dd1a4947a671/Jinja2-2.10.1-py2.py3-none-any.whl
Collecting itsdangerous>=0.24 (from Flask>=0.12->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/76/ae/44b03b253d6fade317f32c24d100b3b35c2239807046a4c953c7b89fa49e/itsdangerous-1.1.0-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests[security]->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/69/1b/b853c7a9d4f6a6d00749e94eb6f3a041e342a885b87340b79c1ef73e3a78/certifi-2019.6.16-py2.py3-none-any.whl
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests[security]->dash>=0.38.0->-r requirements.txt (line 2)) Using cached https://files.pythonhosted.org/packages/e6/60/247f23a7121ae632d62811ba7f273d0e58972d75e58a94d329d51550a47d/urllib3-1.25.3-py2.py3-none-any.whl
Collecting idna<2.9,>=2.5 (from requests[security]->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests[security]->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting cryptography>=1.3.4; extra == "security" (from requests[security]->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/d8/30/6313af106e5abff8bfa78eb2ce630673bb5add4fafd3b28d4bd0271c8e7f/cryptography-2.7-cp27-cp27m-win_amd64.whl
Collecting pyOpenSSL>=0.14; extra == "security" (from requests[security]->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/01/c8/ceb170d81bd3941cbeb9940fc6cc2ef2ca4288d0ca8929ea4db5905d904d/pyOpenSSL-19.0.0-py2.py3-none-any.whl
Collecting nbformat>=4.2 (from plotly->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/da/27/9a654d2b6cc1eaa517d1c5a4405166c7f6d72f04f6e7eea41855fe808a46/nbformat-4.4.0-py2.py3-none-any.whl
Collecting pytz (from plotly->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/3d/73/fe30c2daaaa0713420d0382b16fbb761409f532c56bdcc514bf7b6262bb6/pytz-2019.1-py2.py3-none-any.whl
Collecting decorator>=4.0.6 (from plotly->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/5f/88/0075e461560a1e750a0dcbf77f1d9de775028c37a19a346a6c565a257399/decorator-4.4.0-py2.py3-none-any.whl
Collecting retrying>=1.3.3 (from plotly->dash>=0.38.0->-r requirements.txt (line 2))
Collecting mock; python_version < "3.0" (from pytest-mock->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/05/d2/f94e68be6b17f46d2c353564da56e6fb89ef09faeeff3313a046cb810ca9/mock-3.0.5-py2.py3-none-any.whl
Collecting pyparsing>=2.0.2 (from packaging>=14.1->pytest-sugar->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/dd/d9/3ec19e966301a6e25769976999bd7bbe552016f0d32b577dc9d63d2e0c49/pyparsing-2.4.0-py2.py3-none-any.whl
Collecting backports.functools-lru-cache; python_version < "3" (from soupsieve>=1.2->beautifulsoup4->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/03/8e/2424c0e65c4a066e28f539364deee49b6451f8fcd4f718fefa50cc3dcf48/backports.functools_lru_cache-1.5-py2.py3-none-any.whl
Collecting zipp>=0.5 (from importlib-metadata>=0.12->pytest->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/a0/0f/9bf71d438d2e9d5fd0e4569ea4d1a2b6f5a524c234c6d221b494298bb4d1/zipp-0.5.1-py2.py3-none-any.whl
Collecting contextlib2; python_version < "3" (from importlib-metadata>=0.12->pytest->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/a2/71/8273a7eeed0aff6a854237ab5453bc9aa67deb49df4832801c21f0ff3782/contextlib2-0.5.5-py2.py3-none-any.whl
Collecting configparser>=3.5; python_version < "3" (from importlib-metadata>=0.12->pytest->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/ba/05/6c96328e92e625fc31445d24d75a2c92ef9ba34fc5b037fe69693c362a0d/configparser-3.7.4-py2.py3-none-any.whl
Collecting scandir; python_version < "3.5" (from pathlib2>=2.2.0; python_version < "3.6"->pytest->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/f9/d0/6b7b38eaf9964510f5c32aa5aaf9f419864d2e0ebe34274e6cba5689a0c5/scandir-1.10.0-cp27-cp27m-win_amd64.whl
Collecting MarkupSafe>=0.23 (from Jinja2>=2.10->Flask>=0.12->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/f7/58/85258115ce58190f20c28fbb3b91c3b1a0a42e6375b100e489427c30488a/MarkupSafe-1.1.1-cp27-cp27m-win_amd64.whl
Collecting enum34; python_version < "3" (from cryptography>=1.3.4; extra == "security"->requests[security]->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/c5/db/e56e6b4bbac7c4a06de1c50de6fe1ef3810018ae11732a50f15f62c7d050/enum34-1.1.6-py2-none-any.whl
Collecting asn1crypto>=0.21.0 (from cryptography>=1.3.4; extra == "security"->requests[security]->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/ea/cd/35485615f45f30a510576f1a56d1e0a7ad7bd8ab5ed7cdc600ef7cd06222/asn1crypto-0.24.0-py2.py3-none-any.whl
Collecting ipaddress; python_version < "3" (from cryptography>=1.3.4; extra == "security"->requests[security]->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/fc/d0/7fc3a811e011d4b388be48a0e381db8d990042df54aa4ef4599a31d39853/ipaddress-1.0.22-py2.py3-none-any.whl
Collecting cffi!=1.11.3,>=1.8 (from cryptography>=1.3.4; extra == "security"->requests[security]->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/fa/24/37ec704b98ffc36e7d0ade9e4653539c0b8e6fec34f084f30194609aa10b/cffi-1.12.3-cp27-cp27m-win_amd64.whl
Collecting traitlets>=4.1 (from nbformat>=4.2->plotly->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/93/d6/abcb22de61d78e2fc3959c964628a5771e47e7cc60d53e9342e21ed6cc9a/traitlets-4.3.2-py2.py3-none-any.whl
Collecting jupyter-core (from nbformat>=4.2->plotly->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/e6/25/6ffb0f6e57fa6ef5d2f814377133b361b42a6dd39105f4885a4f1666c2c3/jupyter_core-4.5.0-py2.py3-none-any.whl
Collecting jsonschema!=2.5.0,>=2.4 (from nbformat>=4.2->plotly->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/aa/69/df679dfbdd051568b53c38ec8152a3ab6bc533434fc7ed11ab034bf5e82f/jsonschema-3.0.1-py2.py3-none-any.whl
Collecting ipython-genutils (from nbformat>=4.2->plotly->dash>=0.38.0->-r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/fa/bc/9bd3b5c2b4774d5f33b2d544f1460be9df7df2fe42f352135381c347c69a/ipython_genutils-0.2.0-py2.py3-none-any.whl
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography>=1.3.4; extra == "security"->requests[security]->dash>=0.38.0->-r requirements.txt (line 2))
Collecting pyrsistent>=0.14.0 (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2->plotly->dash>=0.38.0->-r requirements.txt (line 2))
Collecting functools32; python_version < "3" (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2->plotly->dash>=0.38.0->-r requirements.txt (line 2))
Requirement already satisfied: setuptools in c:\users\zianhu\pycharmprojects\my_dash_component\venv\lib\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2->plotly->dash>=0.38.0->-r requirements.txt (line 2)) (41.0.1)
Installing collected packages: lxml, termcolor, pyparsing, six, packaging, funcsigs, zipp, contextlib2, scandir, pathlib2, configparser, importlib-metadata, attrs, pluggy, py, atomicwrites, wcwidth, colorama, more-itertools, pytest, pytest-sugar, waitress, backports.functools-lru-cache, soupsieve, beautifulsoup4, click, Werkzeug, MarkupSafe, Jinja2, itsdangerous, Flask, flask-compress, certifi, urllib3, idna, chardet, enum34, asn1crypto, ipaddress, pycparser, cffi, cryptography, pyOpenSSL, requests, percy, dash-core-components, dash-html-components, decorator, ipython-genutils, traitlets, jupyter-core, pyrsistent, functools32, jsonschema, nbformat, pytz, retrying, plotly, selenium, mock, pytest-mock, dash-renderer, dash-table, dash
Successfully installed Flask-1.0.3 Jinja2-2.10.1 MarkupSafe-1.1.1 Werkzeug-0.15.4 asn1crypto-0.24.0 atomicwrites-1.3.0 attrs-19.1.0 backports.functools-lru-cache-1.5 beautifulsoup4-4.7.1 certifi-2019.6.16 cffi-1.12.3 chardet-3.0.4 click-7.0 colorama-0.4.1 configparser-3.7.4 contextlib2-0.5.5 cryptography-2.7 dash-1.0.0 dash-core-components-1.0.0 dash-html-components-1.0.0 dash-renderer-1.0.0 dash-table-4.0.0 decorator-4.4.0 enum34-1.1.6 flask-compress-1.4.0 funcsigs-1.0.2 functools32-3.2.3.post2 idna-2.8 importlib-metadata-0.18 ipaddress-1.0.22 ipython-genutils-0.2.0 itsdangerous-1.1.0 jsonschema-3.0.1 jupyter-core-4.5.0 lxml-4.3.4 mock-3.0.5 more-itertools-5.0.0 nbformat-4.4.0 packaging-19.0 pathlib2-2.3.4 percy-2.0.2 plotly-3.10.0 pluggy-0.12.0 py-1.8.0 pyOpenSSL-19.0.0 pycparser-2.19 pyparsing-2.4.0 pyrsistent-0.15.2 pytest-4.6.3 pytest-mock-1.10.4 pytest-sugar-0.9.2 pytz-2019.1 requests-2.22.0 retrying-1.3.3 scandir-1.10.0 selenium-3.141.0 six-1.12.0 soupsieve-1.9.2 termcolor-1.1.0 traitlets-4.3.2 urllib3-1.25.3 waitress-1.3.0 wcwidth-0.1.7 zipp-0.5.1
Executing: npm install --ignore-scripts
npm WARN deprecated [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated [email protected]: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated [email protected]: I wrote this module a very long time ago; you should use something else.
npm WARN rollback Rolling back [email protected] failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\Users\zianhu\PycharmProjects\my_dash_component\node_modules\fsevents\node_modules'
npm WARN prepublish-on-install As of npm@5, prepublish scripts are deprecated.
npm WARN prepublish-on-install Use prepare for build steps and prepublishOnly for upload-only.
npm WARN prepublish-on-install See the deprecation note in npm help scripts for more information.
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] requires a peer of acorn@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 1471 packages from 1262 contributors and audited 21320 packages in 94.614s
found 14 vulnerabilities (1 moderate, 13 high)
run npm audit fix to fix them, or npm audit for details
Building initial bundles...
Executing: venv\Scripts\python -m dash.development.component_generator ./src/lib/components my_dash_component
'REQUIRED$' is not recognized as an internal or external command,
operable program or batch file.

Error generating metadata in my_dash_component (status=255)
post_gen_project command failed: venv\Scripts\python -m dash.development.component_generator ./src/lib/components my_dash_component
ERROR: Stopping generation because post_gen_project hook script didn't exit successfully
Hook script failed (exit status: 1)`

Unable to run Cookiecutter without Python 2

Not sure if that's an intended behavior. I only have Python 3 installed, along with latest cookiecutter and virtualenv versions. Here's the full output:

C:\Users\xingh\git>cookiecutter dash-component-boilerplate
project_name [my dash component]:
project_shortname [my_dash_component]:
component_name [mydashcomponent]:
author_name [Enter your name (For package.json)]: xhlulu
author_email [Enter your email (For package.json)]: [email protected]
description [Project Description]: draggable
Select license:
1 - MIT License
2 - BSD License
3 - ISC License
4 - Apache Software License 2.0
5 - GNU General Public License v3
6 - Not open source
Choose from 1, 2, 3, 4, 5, 6 [1]: 1
publish_on_npm [True]:
install_dependencies [True]:
Patching build command
Executing: python -m venv venv
Error: Command '['C:\\Users\\xingh\\git\\my_dash_component\\venv\\Scripts\\python.exe', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
post_gen_project command failed: python -m venv venv

        venv creation failed.
        Make sure you have installed virtualenv on python 2.

ERROR: Stopping generation because post_gen_project hook script didn't exit successfully
Hook script failed (exit status: 1)

C:\Users\xingh\git>pip install virtualenv
Requirement already satisfied: virtualenv in c:\users\xingh\appdata\local\continuum\anaconda3\lib\site-packages (15.2.0)

Watch mode to rebuild all files & restart everything on file changes

Hi,

So I am a big fan of tooling that auto-reloads everything on a change.
Thus I'm currently using this simple setup to automatically rebuild the JS and Python bundles + restart the web server.

1) Running webpack in watch mode

npx webpack --mode development -w

2) Rebuilding the meta information on every change

while true; do
    npm run build:py;
    inotifywait --event modify,create,delete,delete_self,close_write,move,move_self -q **/*.js ;
done
  1. Reloading the server on external changes

gunicorn supports this partially out of the box, e.g.

gunicorn --reload --reload-extra-file my_dash_component/ExampleComponent.py usage:server 

Though of course this won't refresh your browser.

Ideas

While for many users the webpack-serve (as part of npm run start) will do just fine, I think the user experience could be improved with:

  1. The metajson generation could be hooked into Webpack's lifecycle as a plugin (see e.g. https://webpack.js.org/concepts/plugins/) to achieve a single npm run app in an easy way.

2a) build:py could touch usage.py, s.t. even an out of the box Flask does a reload when a new meta extraction has been run
2b) Alternatively, one could pass the generated Python modules in my_dash_component to Flask as extra_files, s.t. its built-in reloader takes notice of them (see e.g. http://werkzeug.pocoo.org/docs/0.14/serving and http://flask.pocoo.org/docs/1.0/api/#flask.Flask.run)

  1. Not sure what your plans on supporting hot reloading in the browser with Dash, but that would make it awesome to develop (though I can see it's on your list: plotly/dash#292)

What are your thoughts on this? (1) and (2) are easy and I would be happy to send quick PRs for this.

Boilerplate should include R component metadata

Once @rpkyle is done adding R code generation to dash (see plotly/dash#445) this repo will need to be updated to:

  1. Contain all the necessary directories required for the R classes to be put into the right place
  2. Contain all the necessary boilerplate files that an R package needs such that it can be installed via install_github() from https://github.com/r-lib/devtools
  3. The NPM scripts and README are updated such that both the Python and R packages are generated simultaneously

Note: nothing in this issue implies that the boilerplate should depend on any part of the R ecosystem being installed on the system of the component developer.

Terser version causing build issues

npm run build:all was throwing the following error:

ERROR in dash_react_table.min.js from Terser
TypeError: Cannot read property 'minify' of undefined
    at minify (/Users/mbk/dash_react_table/node_modules/terser-webpack-plugin/dist/minify.js:175:23)
    at module.exports (/Users/mbk/dash_react_table/node_modules/terser-webpack-plugin/dist/worker.js:13:40)
    at handle (/Users/mbk/dash_react_table/node_modules/worker-farm/lib/child/index.js:44:8)
    at process.<anonymous> (/Users/mbk/dash_react_table/node_modules/worker-farm/lib/child/index.js:51:3)
    at process.emit (events.js:182:13)
    at emit (internal/child_process.js:812:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

This issue was brought up in vue as well and the advice there, which was to install npm install [email protected] was able to fix this issue for me. Thought I would put this out on the radar.

Components not auto-generated

I installed the boilerplate successfully, but I don't get the auto-generated files.

npm run build also runs successfully, but only creates the javascript files.

npm run build

> [email protected] build C:\customcomp
> npm run build:js && npm run build:py_and_r


> [email protected] build:js C:\customcomp
> webpack --mode production

Hash: 78562a9a02ac926d1bf7
Version: webpack 4.36.1
Time: 544ms
Built at: 08/29/2019 6:20:05 PM
                Asset      Size  Chunks             Chunk Names
    customcomp.min.js  2.75 KiB       0  [emitted]  main
customcomp.min.js.map  7.52 KiB       0  [emitted]  main
Entrypoint main = customcomp.min.js customcomp.min.js.map
[0] external "PropTypes" 42 bytes {0} [built]
[1] external "React" 42 bytes {0} [built]
[2] ./src/lib/index.js + 1 modules 4.29 KiB {0} [built]
    | ./src/lib/index.js 122 bytes [built]
    |     + 1 hidden module

> [email protected] build:py_and_r C:\customcomp
> dash-generate-components ./src/lib/components customcomp -p package-info.json --r-prefix 'xq_'

Warning: a URL for bug reports was not provided. Empty string inserted.
Warning: a homepage URL was not provided. Empty string inserted.

Error with cookiecutter

Hello! I'm running into an issue when I try and run cookiecutter on the repo. I've went through the steps outlined in the ReadMe. I am running Python 3, and have successfully installed npm and node. However, my code returns an error when trying to run cookiecutter https://github.com/plotly/dash-component-boilerplate.git.

I've seen #23 and I'm still not quite sure if I'm running into the same issue.

Thanks in advance!


(venv) C:\p\venv\Scripts>npm -v
6.4.1

(venv) C:\p\venv\Scripts>node -v
v10.15.3

(venv) C:\p\venv\Scripts>cookiecutter https://github.com/plotly/dash-component-boilerplate.git
Traceback (most recent call last):
  File "C:\Users\GTX914\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\GTX914\anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\p\venv\Scripts\cookiecutter.exe\__main__.py", line 9, in <module>
  File "c:\p\venv\lib\site-packages\click\core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "c:\p\venv\lib\site-packages\click\core.py", line 717, in main
    rv = self.invoke(ctx)
  File "c:\p\venv\lib\site-packages\click\core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\p\venv\lib\site-packages\click\core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "c:\p\venv\lib\site-packages\cookiecutter\cli.py", line 120, in main
    password=os.environ.get('COOKIECUTTER_REPO_PASSWORD')
  File "c:\p\venv\lib\site-packages\cookiecutter\main.py", line 63, in cookiecutter
    password=password
  File "c:\p\venv\lib\site-packages\cookiecutter\repository.py", line 103, in determine_repo_dir
    no_input=no_input,
  File "c:\p\venv\lib\site-packages\cookiecutter\vcs.py", line 99, in clone
    stderr=subprocess.STDOUT,
  File "C:\Users\GTX914\anaconda3\lib\subprocess.py", line 336, in check_output
    **kwargs).stdout
  File "C:\Users\GTX914\anaconda3\lib\subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['git', 'clone', 'https://github.com/plotly/dash-component-boilerplate.git']' returned non-zero exit status 128.


Running python usage.py isn't working

Python component doesn't have _js_dist defined.
When hosting flask app bundle.js for the component isn't being sent to browser.

Steps:

  • git clone the repo
  • npm install
  • npm build:all
  • python usage.py

dash==0.2.6.5
dash-core-components==0.28.0
dash-html-components==0.12.0
dash-renderer==0.12.1

Option to use "-" for repo name

At the moment, the project shortname is forced to be dash_component. However, writing dash-component for the repository name is pretty usually (e.g. dash-core-components), but currently the option is not given for the cookiecutter. It would be a nice addition.

Type Error with Example

Currently I am unable to run the vanilla boilerplate without any changes. I run cookiecutter with all default options except for the author name and email address. If I run "npm run start" on the newly generated project, it should display the example input component. However, I get the following error:

TypeError: res.getHeader is not a function
at processRequest (C:\source\my_dash_component\node_modules\webpack-dev-middleware\lib\middleware.js:82:18)
at cbs.forEach (C:\source\my_dash_component\node_modules\webpack-dev-middleware\lib\context.js:52:9)
at Array.forEach ()
at process.nextTick (C:\source\my_dash_component\node_modules\webpack-dev-middleware\lib\context.js:51:11)
at process._tickCallback (internal/process/next_tick.js:61:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: webpack-serve ./webpack.serve.config.js --open
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\myUser\AppData\Roaming\npm-cache_logs\2019-03-13T10_04_36_318Z-debug.log

I assume there's something wrong with the dependencies. However, I am unable to resolve it myself.

Improve Readme

Hi everyone,

I made a few suggestions on the Readme. For a beginner like me, I had a lot of questions when I tried to create my own component. I have listed them below. My apologies if some suggestions are dumb/super-obvious: I had a difficult time figuring them out.

Pointer 2.
Find-and-replace:
my_dash_component with your component library name.
I think it should be made clear about replacing it everywhere: for eg: in package.json, manifest.ini. setup.py etc.

Pointer 3:
Note: Relevant dependencies must be isntalled for the component you are creating.

Pointer 4:
It wasnt very clear when I read ' it opens the JS Demo environment' - like does npm start would open a demo-environment. I then realized that it would be running the App.js in the demo folder under src. Ask the users to go through the package.json to see what the npm commands are setup to do.

Pointer 5:
Please link the

React Document - React for python devs

to help create the component. Also please mention how the version of React is critical. I realized that there are big changes to how code is written in React 15 and 16. Also refer to the react code for dash-core-components, so that users can see how the react component is written.

Pointer 7 iii:
Add Note: If the MANIFEST.INI does not have the correct references, the tarball would still be created without error but wouldn't work in the local environment. For eg. In my case, the error said that package.json was not found in my_dash_component, but when I looked into the my_dash_component in the repo, it was there. This means, the files did not get correctly copied to the tarball.

Pointer 7 iv:
npm run publish did not work for me. I had to use npm publish.

BEFORE publishing the component, the user needs to first login using npm adduser. If not, npm throws a misleading error "Please try running this command again as root/Administrator." Please refer to this for more details on this issue: npm/npm#20450.

Do a similar thing for PyPi: login before publishing.

No Module named 'yaml'

post_gen_project command failed: venv\Scripts\python -m dash.development.component_generator ./src/lib/components test -p package-info.json --r-prefix ''

ImportError: No module named dash

The readme doesn't say anything about installing Dash, and there is no requirements.txt :)

nk$ npm run build:py                                                         

> [email protected] build:py /Users/nicolas/plotly/dash-component-boilerplate
> node ./extract-meta src/lib/components > my_dash_component/metadata.json && copyfiles package.json my_dash_component && python -c "import dash; dash.development.component_loader.generate_classes('my_dash_component', 'my_dash_component/metadata.json')"

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named dash

Add auto-generated files in <my_dash_component> to the .gitignore

Hi there,

So I was just interested whether there's a reasoning behind committing the auto-generated files in my_dash_component into git and not adding them to the .gitignore?
And subsequently whether you would accept a PR to the .gitignore for this?
(Though it probably makes sense to wait for #14 if that PR will be merged in the near future.)

Anyhow, I'm guessing that committing the generated files into git has the motivation that it simplifies deployment to e.g. Heroku?

Though for Heroku it's easy to add multiple buildpacks, e.g.

heroku buildpacks:set https://github.com/heroku/heroku-buildpack-multi.git
cat > .buildpacks << EOF
https://github.com/heroku/heroku-buildpack-nodejs.git
https://github.com/heroku/heroku-buildpack-python.git
EOF

The only "tricky" bit is to split up the build:py into a step that can be run during the nodejs build stage and one that can be run later during the Python build stage:

  "scripts": {
...
    "build:py-js": "node ./extract-meta src/lib/components > my_dash_component/metadata.json && copyfiles package.json my_dash_component",
    "build:py-py": "python -c \"import dash; dash.development.component_loader.generate_classes('my_dash_component', 'my_dash_component/metadata.json')\"",
    "build:py": "npm run build:py-js && npm run build:py-py",
...
    "postinstall": "npm run build:js && npm run build:py-js"
  },
mkdir bin
cat > bin/post-compile << EOF
#!/bin/bash
# Generates the Dash components (requires all Python dependencies to be installed)

npm run build:py-py
EOF

How to use _css_dist?

I am trying to add a .css to my project following the instructions on the readme file.

Make sure the stylesheets are added to the _css_dist dict in deckglplotly/__init__.py so dash will serve them automatically when the component suite is requested.

However, I do not know what is the key of the dict. When I try to put any key

_css_dist = [{'anykey': 'stlye.css'}]

I get the following error:

Traceback (most recent call last):
  File "/Users/joaoc/Documents/Projects/deckglplotly/venv/lib/python3.6/site-packages/flask/app.py", line 2309, in __call__
    return self.wsgi_app(environ, start_response)
  File "/Users/joaoc/Documents/Projects/deckglplotly/venv/lib/python3.6/site-packages/flask/app.py", line 2295, in wsgi_app
    response = self.handle_exception(e)
  File "/Users/joaoc/Documents/Projects/deckglplotly/venv/lib/python3.6/site-packages/flask/app.py", line 1741, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/joaoc/Documents/Projects/deckglplotly/venv/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/Users/joaoc/Documents/Projects/deckglplotly/venv/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/joaoc/Documents/Projects/deckglplotly/venv/lib/python3.6/site-packages/flask/app.py", line 1808, in full_dispatch_request
    self.try_trigger_before_first_request_functions()
  File "/Users/joaoc/Documents/Projects/deckglplotly/venv/lib/python3.6/site-packages/flask/app.py", line 1855, in try_trigger_before_first_request_functions
    func()
  File "/Users/joaoc/Documents/Projects/deckglplotly/venv/lib/python3.6/site-packages/dash/dash.py", line 997, in _setup_server
    self._generate_css_dist_html()
  File "/Users/joaoc/Documents/Projects/deckglplotly/venv/lib/python3.6/site-packages/dash/dash.py", line 412, in _generate_css_dist_html
    self._collect_and_register_resources(self.css.get_all_css())
  File "/Users/joaoc/Documents/Projects/deckglplotly/venv/lib/python3.6/site-packages/dash/resources.py", line 81, in get_all_css
    return self._resources.get_all_resources()
  File "/Users/joaoc/Documents/Projects/deckglplotly/venv/lib/python3.6/site-packages/dash/resources.py", line 66, in get_all_resources
    return self._filter_resources(all_resources, dev_bundles)
  File "/Users/joaoc/Documents/Projects/deckglplotly/venv/lib/python3.6/site-packages/dash/resources.py", line 45, in _filter_resources
    s['external_url']
TypeError: 'set' object is not subscriptable

React table component for dash

Hi,

I am trying to use react-table and dash-component-boiler plate to generate dash component. Please find the code here. In particular, I am testing pivoting and aggregation rows of react-table component. It seems to be working fine when I test it using "npm run start" but it doesn't work as a dash component using "python usage.py"

To expand more, react-table uses "aggregate" property with in column proptype to do aggregations. Since proptype func is not allowed in dash as per recommendation here, I am using a string property to introduce a function in react for aggregation. Aggregation seems to be working fine but on click is not expanding row in python dash component.

Can you please tell me what could be the possible reasons for this? I just started with react and not sure where to start with this problem. I don't see any errors in console if this helps.

Error in installing BoilerPlate

Executing: venv/bin/python -m dash.development.component_generator ./src/lib/components examplecomp -p package-info.json --r-prefix 'dc'
Traceback (most recent call last):
File "/Users/admin/anaconda3/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/Users/admin/anaconda3/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/admin/Desktop/BoilerPlate/examplecomp/venv/lib/python3.6/site-packages/dash/development/component_generator.py", line 14, in
import yaml
ModuleNotFoundError: No module named 'yaml'
post_gen_project command failed: venv/bin/python -m dash.development.component_generator ./src/lib/components examplecomp -p package-info.json --r-prefix 'dc'
ERROR: Stopping generation because post_gen_project hook script didn't exit successfully
Hook script failed (exit status: 1)

Support data-dash-is-loading API

Would it be possible to add default support for the data-dash-is-loading data attribute through the loading_state.is_loading prop?

It's not clear from the Dash docs that this API doesn't work out of the box with arbitrary Dash components. I took quite a while working out that my lack of loading spinner for a component was due to using a Dash Bootstrap Component (facultyai/dash-bootstrap-components#165), which I have a mental model of being replaceable with Dash HTML Components.

Adding support in this boilerplate would increase the level of support for this API in other third-party components.

Convert an existing React component with a script?

Hi, thanks for dash and this component creation helper, great ideas both.

Right now, I just want to use someone else's React component (https://github.com/allenai/hierplane) in my dash app, but I can't find documentation for doing that. This repo is the closest I've gotten.

I saw once an issue about creating a nice command-line script/interface for converting React apps. I think that'd be awesome, the ideal solution to this problem. Since I'm not confident with my React/npm etc, it'd be nice if I didn't have to upload my components to npm and so on, especially when they are third-party. I don't know how possible this is, but I would love if I simply do:

dash react-to-python hierplane

Anyway, I'm wondering if someone could advise me on how to convert this existing component to dash component. In the alternative, I think it'd be very valuable if someone a quick document (to go in dash docs?) guiding devs on how to do this. The current docs are good if we're creating from scratch, but I don't know how to incorporate/wrap someone else's component.

Extra package.json?

I think that the second package.json is exteraneous, the one at /{{cookiecutter.project_shortname}}/{{cookiecutter.project_shortname}}/package.json.

It's being read from setup.py but I think that setup.py should read the /{{cookiecutter.project_shortname}}/package.json instead, no?

cannot import external libraries

i am confronted to an unsolved problem when I want to import external react libs (e.g. material-ui among others). it works well with npm run start (or webpack-serve ./webpack.serve.config.js -hot) but not with npm run build:all (or venv/bin/python usage.py) as it cannot find _react.default.createContext();.

debugging the webpack-serve version (which works) i can see that the function is in react.development.js:1266

while with venv/bin/python usage.py i have the following stacktrace:

    at eval (FormControlContext.js?f516:15)
    at Object../node_modules/@material-ui/core/FormControl/FormControlContext.js (enter_triggered_text_input.dev.js?v=0.0.1&m=1543579949:241)
    at __webpack_require__ (enter_triggered_text_input.dev.js?v=0.0.1&m=1543579949:21)
    at eval (InputBase.js?f12e:34)
    at Object../node_modules/@material-ui/core/InputBase/InputBase.js (enter_triggered_text_input.dev.js?v=0.0.1&m=1543579949:301)
    at __webpack_require__ (enter_triggered_text_input.dev.js?v=0.0.1&m=1543579949:21)
    at eval (index.js?26dc:15)
    at Object../node_modules/@material-ui/core/InputBase/index.js (enter_triggered_text_input.dev.js?v=0.0.1&m=1543579949:325)
    at __webpack_require__ (enter_triggered_text_input.dev.js?v=0.0.1&m=1543579949:21)
    at eval (Input.js?3722:22)

Originally posted by @qubolino in https://github.com/plotly/dash-docs/issues/194#issuecomment-443241827

Improve JS facing packaging

Ran into some issues packaging the dash-table for JS consumption and would like to suggest making these modifications to the boilerplate in order to make the npm packages cleaner.

  1. Generate the package.json "main" property to be
  "main": {{cookiecutter.project_shortname}}/bundle.js

This makes import MyComponent from 'my-component' return the expected value (with libraryTarget='umd', most probably the component itself)

  1. Do away with blacklisting through .npmignore, use whitelisting instead through package.json "files" property

Default value could be

  "files": [
    "/{{cookiecutter.project_shortname}}/bundle*.js"
  ],

This would cover future bundle.dev.js, bundle.min.js, etc.
Package.json and *.md files are picked up automatically by npm.

  1. Modify the build:py script command to copy package.json into another file name (e.g. bundle.json) + update impacted setup.py and init.py files

This allows npm publish to pick up the file in {{cookiecutter.project_shortname}} correctly (otherwise since a package.json is present, the folder's content will be ignored -- configuring .npmignore to ignore that package.json will not modify this behavior)

  1. Do not promote the use of shrinkwrap for fully self-contained builds -- the shrinkwrap will override the peer & dev dependencies behavior and will install on wrapped dependencies on npm install

  2. Make it optional to set libraryTarget to 'umd' (maybe this is too specific to dash-table)

output: {
    libraryTarget: 'umd'
}

And modify react and react-dom external dependency resolution to cover the various use cases

        externals: {
            react: {
                commonjs: "react",
                commonjs2: "react",
                amd: "React",
                root: "React"
            },
            "react-dom": {
                commonjs: "react-dom",
                commonjs2: "react-dom",
                amd: "ReactDOM",
                root: "ReactDOM"
            }
        }

Move extract-meta into its own NPM module

It would be great if the entire meta-generation pipeline would be separated in its own package, s.t. upgrade to future versions of dash-component-boilerplate will be as easy as bumping the version number.

In other words, I think at least extract-meta should be shipped as a package and not be part of the boilerplate. This would also make the pipeline more future proof in case you will change/improve the extract-meta script.

A more radical script would be to move in the direction of react-scripts which also abstracts away most of the configuration (like e.g. the webpack configuration - https://github.com/facebook/create-react-app/tree/master/packages/react-scripts/config) and thus allows them to ship new pipeline improvements to all users.
This is sth. that due to the ever-growing complexity of JS build tools (hello Babel 7) the majority of the user base really likes.

Build Python in Windows

Looking through package.json, I noticed we build Python the following way:

"build:py": "(. venv/bin/activate || venv\\scripts\\activate) && dash-generate-components ./src/lib/components {{ cookiecutter.project_shortname }}"

Does this work for both linux and windows?

Updating scripts to match dash-core-components

We should update the scripts in package.json the same way as we did for dash-core-components. However, I don't think we should force prettier on the users, since some people are not a fan (although I noticed it's pretty much set up already in this repo, except there's no prettier package in package.json's dependencies. If we do want it, we could use the format and format:test scripts). We should copy over the publish script however, or perhaps add it to a scripts repo as mentioned in #17. We should also copy the build:watch script, which rebuilds the bundle on src/ files changes, the 'lint and test scripts are also nice to have here.

Using external libraries

It seems to be impossible to import and work with external libraries in custom react components. I pinned the issue down on Webpack, which does not include the imported libraries in the final JS which is used by dash in Python.

Expected Behaviour

Code that runs fine using 'npm run start' can be converted to valid python code using 'npm run build:all'. 'python usage.py' can then be used to display the code using Dash.

Actual Behaviour

Code runs fine using 'npm run start'. It can be converted to a dash component, however on using this component calling 'python usage.py' the message: "Error loading dependencies" is shown. The browser console shows, that the component from the external library was not found (TypeError: Cannot read property 'Map' of undefined).

Steps to reproduce

  1. Run boilerplate and create example component.
  2. Import external library in custom component and call it in App.js
  3. Make sure it runs in 'npm run start'.
  4. Convert to python using 'npm run build:all'
  5. Call 'python usage.py'

Attached to this report you'll find the necessary files to reproduce the issue with the react-leaflet library. The files included are ['usage.py', 'webpack.config.js', 'App.js', 'index.js', 'DashLeaflet.js', 'index.js', 'package.json']. Make sure to install both react-leaflet and leaflet using npm. Furthermore, file-loader is needed to read an external css sheet for leaflet.

files_to_reproduce.zip

Update pytest-dash README usage

  • Need to have the chrome driver on the path (or any other driver)
  • Change the run example to pytests tests --driver Chrome.

capitalize component name

hi, while creating a new project it asks for component_name, if i give a name that starts with lowercase, it creates react component with lowercase, which is wrong from react component standards. React component must starts with uppercase.

web shell Component

I'm developing an data platform with dash which helps me a lot to build the interactive UI. However, I haven't found a web shell component implemented using dash framework.

A web shell is very useful when the users want to do some bash command just like the console in jupyter environment.

So, is there anyone who have some experience or information related? Any information is appreciated. Thanks

Component doc strings do not show in VSCODE

Hi,

I've noticed that the component doc strings are not showing correctly in VSCODE (on windows). This is also the case with the docstrings in the Dash html and core components libraties. All
you see is a one line header, eg:

html

The docstrings in the dash-bootstrap-components do show correctly:

dbc

The problem must be part of the dash-component-boilerplate build process but I've not
been able to spot it.

dash-generate-components doesn't allow whitespaces in path

Hi! Thank you for this neat boilerplate that brings me into the interplay of React and dash.
After all set up I tried to generate necessary python classes by running npm run build:py. There is an error with Cannot find module <part of my project path>. I guess the reason is that there is a whitespace in my working path and the dash-generate-componentsmodule (in Scripts) cannot recognize the complete path. Sorry I can't change it because it is set by our IT, but I think there could be a way to make this compatible.

TypeError: Cannot read property 'properties' of undefined

Walking through the README from top to bottom, I hit an error with npm run build:js-dev:


> [email protected] build:js-dev /Users/nicolas/plotly/dash-component-boilerplate
> webpack --mode development

/Users/nicolas/plotly/dash-component-boilerplate/node_modules/webpack-cli/bin/config-yargs.js:89
                                describe: optionsSchema.definitions.output.properties.path.description,
                                                                           ^

TypeError: Cannot read property 'properties' of undefined
    at module.exports (/Users/nicolas/plotly/dash-component-boilerplate/node_modules/webpack-cli/bin/config-yargs.js:89:48)
    at /Users/nicolas/plotly/dash-component-boilerplate/node_modules/webpack-cli/bin/webpack.js:60:27
    at Object.<anonymous> (/Users/nicolas/plotly/dash-component-boilerplate/node_modules/webpack-cli/bin/webpack.js:515:3)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:js-dev: `webpack --mode development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build:js-dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/nicolas/.npm/_logs/2018-09-26T19_27_29_669Z-debug.log

Consider tracking React version used by dash-renderer

Hello,

I recently had to help out building some custom React components for a Dash application and one big time sink I fell into was related to a React version discrepancy. It seems like other people probably run into this eventually too (#11).

The way in which I came to realise React 16 is yet to be supported was by checking the version of React being loaded the Dash application. This led me to the dash-renderer.

I suggest having the React version of this boilerplate track the one used by dash-renderer as an added measure to indicate which version is supported. For example, if any React 16 features are used, a user would see build failures when starting the app sandbox for developing a custom component.

venv is deprecated since python 3.6

I have installed python 3.7.1 in my notebook. I want to use dash-component-boilerplate as base project for my company. Unfortunately I got error like this.

Executing: python -m venv venv
/usr/bin/python: No module named venv
post_gen_project command failed: python -m venv venv

        venv creation failed.
        Make sure you have installed virtualenv on python 2.

ERROR: Stopping generation because post_gen_project hook script didn't exit successfully
Hook script failed (exit status: 1)

Hope this issue will be resolved soon.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.