Skip to main content

Convert any git repo into a cookiecutter projects template.

Project description

https://github.com/MacHu-GWU/cookiecutter_maker-project/workflows/CI/badge.svg https://codecov.io/gh/MacHu-GWU/cookiecutter_maker-project/branch/main/graph/badge.svg https://img.shields.io/pypi/v/cookiecutter_maker.svg https://img.shields.io/pypi/l/cookiecutter_maker.svg https://img.shields.io/pypi/pyversions/cookiecutter_maker.svg https://img.shields.io/badge/STAR_Me_on_GitHub!--None.svg?style=social
https://img.shields.io/badge/Link-Install-blue.svg https://img.shields.io/badge/Link-GitHub-blue.svg https://img.shields.io/badge/Link-Submit_Issue-blue.svg https://img.shields.io/badge/Link-Request_Feature-blue.svg https://img.shields.io/badge/Link-Download-blue.svg

Welcome to cookiecutter_maker Documentation

Summary

Python Cookiecutter is an awesome library that can create projects from templates. In an enterprise setting, people typically start with a concrete, working project and then convert it into a template that serves as the internal standard for future use (Template -> Project).

📋 Cookiecutter Maker is the inverse of cookiecutter (Project -> Template). It is a Python open source tool that can convert any given folder structure into a cookiecutter project.

Usage Example

Run the following python script to convert your concrete project into a template project:

from cookiecutter_maker.api import Maker

maker = Maker.new(
    # the input concrete project directory
    input_dir="/path-to-input-dir/my_awesome_project",
    # the output template project directory
    output_dir="/path-to-output-dir",
    # define the ``string to replace``, ``parameter name`` and ``default parameter value``
    mapper=[
        ("my_awesome_project", "package_name", "default_package_name"),
    ],
    # define what to include in the input directory
    # it is the relative path from the input directory
    # the rule is 'explicit exclude' > 'explicit include' > 'default include'
    # if empty, then include all files and directories
    include=[],
    # define what to exclude in the input directory
    # it is the relative path from the input directory
    exclude=[
        # dir
        ".venv",
        ".pytest_cache",
        ".git",
        ".idea",
        "build",
        "dist",
        "htmlcov",
        # file
        ".coverage",
    ],
    # define what to copy as it is without rending
    # usually you should ignore jinja template files
    no_render=[
        "*.tpl",
    ],
    # over write the output location if already exists
    overwrite=True,
    # mapper could have one key is substring of another key
    # if this is True, it will ignore the error
    ignore_mapper_error=False,
    # when mapper could have one key is substring of another key
    # it will prompt you to confirm to continue
    skip_mapper_prompt=True,
    # do you want to print debug information?
    debug=True,
)
maker.templaterize()

In this example, it will create a directory {{ cookiecutter.package_name }} and a json file cookiecutter.json. Now you can follow the cookiecutter instruction to generate more concrete projects.

Install

cookiecutter_maker is released on PyPI, so all you need is:

$ pip install cookiecutter_maker

To upgrade to latest version:

$ pip install --upgrade cookiecutter_maker

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

cookiecutter_maker-0.3.1.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

cookiecutter_maker-0.3.1-py2.py3-none-any.whl (9.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file cookiecutter_maker-0.3.1.tar.gz.

File metadata

  • Download URL: cookiecutter_maker-0.3.1.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.11

File hashes

Hashes for cookiecutter_maker-0.3.1.tar.gz
Algorithm Hash digest
SHA256 6958d5a969641df276b0d2440ee941737dc2580aca21f8e77b207d48739d7791
MD5 fa32a18dbb67276d175ad61ba7c75159
BLAKE2b-256 d20f9d74cc7db37cfc82a5eef56d5e1161653daa906d6daefc9c83c7fa0c2fd7

See more details on using hashes here.

File details

Details for the file cookiecutter_maker-0.3.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for cookiecutter_maker-0.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1823843fcbff1b7367adaaac3e48bcb044d8b594a6b560f6a8da690706fbe411
MD5 2f1cc3a4dfb7c175a267864f57072679
BLAKE2b-256 b23dcf5390c200e4dcca4a3cf8c090dba6baf0ab7743b9568d3fc674ca3e1835

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