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

[WIP] cookiecutter for the boilerplate #14

Merged
merged 59 commits into from
Oct 16, 2018
Merged

[WIP] cookiecutter for the boilerplate #14

merged 59 commits into from
Oct 16, 2018

Conversation

T4rk1n
Copy link
Contributor

@T4rk1n T4rk1n commented Sep 27, 2018

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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]: [email protected]
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
Copy link
Contributor Author

T4rk1n commented Sep 27, 2018

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.

@T4rk1n T4rk1n changed the title cookiecutter for the boilerplate [WIP] cookiecutter for the boilerplate Sep 28, 2018
@valentijnnieman
Copy link

I'm getting this error running cookiecutter [email protected]:plotly/dash-component-boilerplate.git --checkout=cookie-cutter
screen shot 2018-10-01 at 12 06 15 pm

@T4rk1n
Copy link
Contributor Author

T4rk1n commented Oct 1, 2018

@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
Copy link

@T4rk1n That worked, thanks :)

@T4rk1n
Copy link
Contributor Author

T4rk1n commented Oct 15, 2018

@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:

  • hooks/*
  • tests/*
  • both readme.
  • {{cookiecutter.project_shortname}}/_validate_init.py
  • {{cookiecutter.extract-meta.js}} -> added docstring validation.

@@ -0,0 +1,86 @@
# {{cookiecutter.project_name}}

This project was generated by the [dash-component-boilerplate](https://github.com/plotly/dash-component-boilerplate) it contains the minimal set of code required to create your own custom Dash component.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should move this to CONTRIBUTING.md and then have README.md contain something like:

# {{cookiecutter.project_name}}

{{cookiecutter.project_name}} is a Dash component library.

Get started with:
1. Install Dash and its dependencies: https://dash.plot.ly/installation
2. Run `python usage.py`
3. Visit http://localhost:8050 in your web browser

### Contributing

See [CONTRIBUTING.md](/CONTRIBUTING.md)


3. Test your tarball by copying it into a new environment and installing it locally:
```
$ pip install my_dash_component-0.0.1.tar.gz
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be templated too?

- 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 the folder of `project_shortname`.
5. Follow the directions in the generated README to start developing your new Dash component.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we create a little ascii-cenima recording of this process and include it here? https://asciinema.org/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to but it's not for windows, if someone wants to do it after merge and include it, I'll create an issue for it.

README.md Outdated
$ cookiecutter [email protected]:plotly/dash-component-boilerplate.git
```
3. Answer the questions about the project.
- project name: Clean project name, can contains spaces and special characters.
Copy link
Member

@chriddyp chriddyp Oct 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's say:

- Project name: This is the "human-readable" name of your project. For example, "Dash Core Components".
- Component library name: This is the "python library" name of 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".

And just in case you missed it, let's rename "Component name" to "Component library name".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, the library name is project_shortname derived from project_name, the component_name is the name of the generated initial Component.

README.md Outdated
- component name: derived from project_name, lowercase, spaces and '-' are replaced by '_', ascii only.
- author info: author_name and author_email for package.json metadata.
- description: the project description, included in package.json.
- version: The initial version.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we leave this out and just default this to 0.0.1?

README.md Outdated
- author info: author_name and author_email for package.json metadata.
- description: the project description, included in package.json.
- version: The initial version.
- license: License type for the component lib.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

component library

@kmader
Copy link

kmader commented Oct 16, 2018

This looks really great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants