plotly / dash-component-boilerplate

Get started creating your own Dash components here.
269 stars 182 forks source link

[WIP] cookiecutter for the boilerplate #14

Closed T4rk1n closed 5 years ago

T4rk1n commented 6 years ago

This PR transform the repo into a cookiecutter

Try it right now with:

$ pip install cookiecutter (if not installed) $ cookiecutter https://github.com/plotly/dash-component-boilerplate.git --checkout=cookie-cutter

Then follow the instructions in the generated README

Closes #13, closes #12, closes #9

nicolaskruchten commented 6 years ago

This is pretty cool! The readme is pretty confusing though, because it has the {{cookiecutter.project_slug}} etc in it, so if I'm just on Github reading the readme it'll seem kind of confusing?

nicolaskruchten commented 6 years ago

Maybe the readme could say under step 2 something like "the cookiecutter command will ask you some questions, including what your project "slug" is, and then it will create your project in a directory with that name, so for the rest of this README you'll need to substitute your slug wherever you see 'slug' " or something?

nicolaskruchten commented 6 years ago

I also think more guidance would be good during the Q&A step... Does cookiecutter allow us to put explanatory text throughout?

full_name [Enter name]: Nicolas Kruchten
email [Enter email]: nicolas@kruchten.com
description [description]: something?
project_name [my dash component]: njk_comp
project_slug [njk_comp]:
version [0.1.0]:
component_name [njk_comp]:
publish_on_npm [True]: false
Select open_source_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]: 1

I wasn't sure if "full_name" was my name? the name of the project? Email... will someone send me email? Does it add me to a mailing list? How are these things used? What's the difference between description, project name and project slug? (to be clear, I know the answers to most of these, but an average user likely will not).

Finally: I know "slug" is fairly common but is kind of a gross word and a turnoff to most non-/junior-programmers I know. I would prefer "shortname" personally :)

T4rk1n commented 6 years ago

The readme is pretty confusing though

Right, I was changing alot of things in there and just copy/pasted from one to the other, I'll make the root one more readable alone.

Finally: I know "slug" is fairly common but is kind of a gross word and a turnoff to most non-/junior-programmers I know. I would prefer "shortname" personally :)

Ahah, did not think about that, the cookiecutter example used that so I just went with it.

Does cookiecutter allow us to put explanatory text throughout?

It only allows for defaults inbetween the brackets, we could put a better description in there and verify in a hook if it's still the default explanatory text.

valentijnnieman commented 6 years ago

I'm getting this error running cookiecutter git@github.com:plotly/dash-component-boilerplate.git --checkout=cookie-cutter

screen shot 2018-10-01 at 12 06 15 pm
T4rk1n commented 6 years ago

@valentijnnieman can you try with https ?

cookiecutter https://github.com/plotly/dash-component-boilerplate.git --checkout=cookie-cutter

Answer no to install dependencies, it's broken right now it takes a long time.

valentijnnieman commented 6 years ago

@T4rk1n That worked, thanks :)

bpostlethwaite commented 6 years ago

I attempted to use this and received the error:

install_dependencies [True]: 
Patching build command
Executing: virtualenv venv
You must provide a DEST_DIR
Usage: virtualenv [OPTIONS] DEST_DIR

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -v, --verbose         Increase verbosity.
  -q, --quiet           Decrease verbosity.
  -p PYTHON_EXE, --python=PYTHON_EXE
                        The Python interpreter to use, e.g.,
                        --python=python3.5 will use the python3.5 interpreter
                        to create the new environment.  The default is the
                        interpreter that virtualenv was installed with
                        (/usr/bin/python)
  --clear               Clear out the non-root install and start from scratch.
  --no-site-packages    DEPRECATED. Retained only for backward compatibility.
                        Not having access to global site-packages is now the
                        default behavior.
  --system-site-packages
                        Give the virtual environment access to the global
                        site-packages.
  --always-copy         Always copy files rather than symlinking.
  --relocatable         Make an EXISTING virtualenv environment relocatable.
                        This fixes up scripts and makes all .pth files
                        relative.
  --no-setuptools       Do not install setuptools in the new virtualenv.
  --no-pip              Do not install pip in the new virtualenv.
  --no-wheel            Do not install wheel in the new virtualenv.
  --extra-search-dir=DIR
                        Directory to look for setuptools/pip distributions in.
                        This option can be used multiple times.
  --download            Download preinstalled packages from PyPI.
  --no-download, --never-download
                        Do not download preinstalled packages from PyPI.
  --prompt=PROMPT       Provides an alternative prompt prefix for this
                        environment.
  --setuptools          DEPRECATED. Retained only for backward compatibility.
                        This option has no effect.
  --distribute          DEPRECATED. Retained only for backward compatibility.
                        This option has no effect.
  --unzip-setuptools    DEPRECATED.  Retained only for backward compatibility.
                        This option has no effect.
post_gen_project command failed: virtualenv venv
ERROR: Stopping generation because post_gen_project hook script didn't exit successfully
Hook script failed (exit status: 2)

I was already in a virtualenvwrapper env

T4rk1n commented 6 years ago

@plotly/dash I added generation/install tests to this PR, it uses pytest instead of the unittest module. The app fixture I got in tests/test_install.py could be an alternative to our IntegrationTests class.

T4rk1n commented 5 years ago

@plotly/dash I'd like to merge this soon so we can work on more features in subsequent PR's. Please review.

Here's the files I want reviewed:

kmader commented 5 years ago

This looks really great!