https://github.com/rrwen/cookiecutter-template
Personal Python cookiecutter base template
https://github.com/rrwen/cookiecutter-template
base cli command cookiecutter interface json line personal project python template travis
Last synced: about 2 months ago
JSON representation
Personal Python cookiecutter base template
- Host: GitHub
- URL: https://github.com/rrwen/cookiecutter-template
- Owner: rrwen
- License: mit
- Created: 2017-11-10T03:25:35.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-26T08:48:44.000Z (over 8 years ago)
- Last Synced: 2025-04-03T07:20:01.288Z (about 1 year ago)
- Topics: base, cli, command, cookiecutter, interface, json, line, personal, project, python, template, travis
- Homepage:
- Size: 32.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cookiecutter-template
Richard Wen
rrwen.dev@gmail.com
Personal Python cookiecutter base template.
[](https://travis-ci.org/rrwen/cookiecutter-template)
[](https://github.com/rrwen/cookiecutter-template/blob/master/LICENSE)
## Install
1. Install [Python](https://www.python.org/downloads/)
2. Install [cookiecutter](https://pypi.python.org/pypi/cookiecutter) via `pip`
3. Install [Node.js](https://nodejs.org/en/)
```
pip install cookiecutter
```
## Usage
Create a [cookiecutter](https://pypi.python.org/pypi/cookiecutter) template:
```
cookiecutter gh:rrwen/cookiecutter-template
```
See [Implementation](#implementation) for more details.
## Developer Notes
### Create Github Repository
1. Ensure [git](https://git-scm.com/) is installed
2. Change directory to the generated folder `cd `
3. Initialize the repository
4. Add the generated files to commit
5. Create an empty [Github repository](https://help.github.com/articles/create-a-repo/) with the same name as `template_name`
6. Pull any changes if the Github repository is not empty
7. Push the commit from `4.` to your created Github repository
```
git init
git add .
git commit -a -m "Initial commit"
git remote add origin https://github.com//.git
git pull origin master --allow-unrelated-histories
git push -u origin master
```
### Implementation
This code creates folders and files for [cookiecutter](https://pypi.python.org/pypi/cookiecutter) templates.
* The main file is [cookiecutter.json](https://github.com/rrwen/cookiecutter-template/blob/master/cookiecutter.json) which defines the inputs for the command line interface
* The inputs then replace any values surrounded with `{{}}` inside the folder [{{cookiecutter.template_name}}](https://github.com/rrwen/cookiecutter-template/tree/master/%7B%7Bcookiecutter.template_name%7D%7D)
```
cookiecutter <-- template tool
|
cookiecutter.json <-- template inputs
|
{{cookiecutter.template_name}} <-- generated template
```
The following files will be created inside a folder with the same name as the `template_name` input:
File | Description
--- | ---
**{{cookiecutter.template_name}}** | Templating folder with README.md and MIT LICENSE files
**.gitignore** | A Python [.gitignore](https://git-scm.com/docs/gitignore) automatically generated from github
**.travis.yml** | A [.travis.yml](https://docs.travis-ci.com/user/customizing-the-build/) file for automatic builds and tests
**LICENSE** | MIT [license file](https://help.github.com/articles/licensing-a-repository/) automatically created from github
**README.md** | A readme [Markdown](https://daringfireball.net/projects/markdown/) file with header, install, usage, and developer notes sections