Skip to main content

A user-friendly wrapper to cookiecutter

Project description

pieceofcake - a user-friendly cookiecutter wrapper

This is a wrapper around the cookiecutter tool which provides a more user-friendly way of asking questions.

With cookiecutter, the user is not presented with any questions, just the names of the parameters to set:

% cookiecutter gh:astrofrog/fake-template
package_name [example]: test-package
include_example_code [n]: y

With pieceofcake, the user is shown a series of verbose questions which provide more context as to the meaning/implications of each parameter:

% cookiecutter gh:astrofrog/fake-template final-package

Welcome to the pieceofcake, a user-friendly cookiecutter wrapper!

This script will now ask you a series of questions to help you set up
your package.

What is the name of your package? This is the name that will appear on
PyPI and which users will use when installing the package with e.g.
pip or conda.
> Package name [example]: test-package

Should example code be included? This will consist of sample Python
and Cython files in the package, demonstrating how to create different
sub-modules and importing between them.
> Include example code? [n]: y

Running cookiecutter...

You should now be all set! Your generated package is in final-package

Installing

To install, run:

pip install pieceofcake

Using

To use pieceofcake:

pieceofcake template output_directory

where template follows the same syntax as for cookiecutter, and can be the path to a local directory, or e.g. gh:astrofrog/fake-template to use a GitHub repository.

Note that pieceofcake will work with all cookiecutter templates, but nice questions will only be shown if the cookiecutter.json file contains the _parameters key as described below in For template creators.

For template creators

To define questions for each parameter, add a new _parameters key in your cookiecutter.json file, which should then contain a dictionary for each parameter:

"_parameters": {
    "package_name": {
        "default_value": "test-package",
        "prompt": "Package name",
        "help": "What is the name of your package? This is the name that will appear on PyPI and which users will use when installing the package with e.g. pip or conda."
    },
    "include_example_code": {
        "prompt": "Include example code?",
        "help": "Should example code be included? This will consist of sample Python and Cython files in the package, demonstrating how to create different sub-modules and importing between them."
    }
}

The default_value, prompt, and help keys are all optional - if default_value is not defined, the default value is taken from the main cookiecutter section. If prompt is not included, it is set to the parameter name, and if help is not included, no help/question is shown.

This approach was inspired by cookiecutter/cookiecutter#794

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pieceofcake-0.1a2.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

pieceofcake-0.1a2-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file pieceofcake-0.1a2.tar.gz.

File metadata

  • Download URL: pieceofcake-0.1a2.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200123 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.8.0

File hashes

Hashes for pieceofcake-0.1a2.tar.gz
Algorithm Hash digest
SHA256 7c71a12b7f2008f2a830cf473135db169cb2e1313b96c6a4d70bed0b6a0c6003
MD5 6feda58cc27d9c1699b587de76ab9876
BLAKE2b-256 a99dc07768ab925e4706a0b82a8e511dabe967c402d5f9eacbea32b5da32f4a5

See more details on using hashes here.

File details

Details for the file pieceofcake-0.1a2-py3-none-any.whl.

File metadata

  • Download URL: pieceofcake-0.1a2-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200123 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.8.0

File hashes

Hashes for pieceofcake-0.1a2-py3-none-any.whl
Algorithm Hash digest
SHA256 6c83ad74c0ffd568426f8e0aab2d3252a4fb3c71997ca5c74e58b04ae6fbcf1f
MD5 2f4d8736ab5a086d6aada5d6616ac1be
BLAKE2b-256 1787c96ebf7616ff50485c465c0490267b87fabab8f70ce2bd6aa90a5604ce89

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page