Skip to main content

Integration of Cookiecutter project templates into PyScaffold (see: https://github.com/cookiecutter/cookiecutter)

Project description

Travis ReadTheDocs Coveralls PyPI-Server

pyscaffoldext-cookiecutter

Extension that combines the flexibility of Cookiecutter templates with the power of PyScaffold.

Cookiecutter is a flexible utility that allows the definition of templates for a diverse range of software projects. On the other hand, PyScaffold is focused in a good out-of-the-box experience for developing distributable Python packages (exclusively). Despite the different objectives, it is possible to combine the power of both tools to create a custom Python project setup.

Quickstart

This extension can be directly installed with pip:

$ pip install pyscaffoldext-cookiecutter

Or, if you prefer pipx:

$ pipx install pyscaffold  # if you haven't installed pyscaffold yet
$ pipx inject pyscaffold pyscaffoldext-cookiecutter

Note that, after the installation, putup -h will show a new option --cookiecutter TEMPLATE. Use this option to point out which template you want to use (path or url). The file structure created by Cookiecutter will be refined by PyScaffold afterwards. For example:

$ putup my-proj1 --cookiecutter ~/my-templates/default
$ putup my-proj2 --cookiecutter gh:something/from-github

Please refer to Cookiecutter documentation for more details on possible URLs and abbreviations.

Cookiecutter templates with PyScaffold

The following example shows how to create a new package named mypkg, that uses a Cookiecutter template, but is enhanced by PyScaffold’s features:

$ putup mypkg --cookiecutter gh:pyscaffold/cookiecutter-pypackage

This is roughly equivalent to first create a project using the Cookiecutter template and convert it to PyScaffold afterwards:

$ cookiecutter --no-input gh:pyscaffold/cookiecutter-pypackage project_name=mypkg
$ putup mypkg --force

Suitable templates

Note that PyScaffold will overwrite some files generated by Cookiecutter, like setup.py, the __init__.py file under the package folder and most of the docs folder, in order to provide setuptools_scm and sphinx integration. Therefore not all Cookiecutter templates are suitable for this approach.

Ideally, interoperable templates should focus on the file structure inside the src folder instead of packaging or distributing, since PyScaffold already handles it under-the-hood. This also means that your template should adhere to the src-layout if you want to generate files within your Python package.

In addition, PyScaffold runs Cookiecutter with the --no-input flag activated and thus the user is not prompted for manual configuration. Instead, PyScaffold injects the following parameters:

author
email
project_name
package_name
project_short_description

Accordingly, the template file structure should be similar to:

cookiecutter-something/
└── {{cookiecutter.project_name}}/
    └── src/
        └── {{cookiecutter.package_name}}/
            └── ...

See Cookiecutter for more information about template creation.

Note

This project has been set up using PyScaffold 3.2. For details and usage information on PyScaffold see https://pyscaffold.org/.

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

pyscaffoldext-cookiecutter-0.1b1.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

pyscaffoldext_cookiecutter-0.1b1-py2.py3-none-any.whl (7.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pyscaffoldext-cookiecutter-0.1b1.tar.gz.

File metadata

  • Download URL: pyscaffoldext-cookiecutter-0.1b1.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for pyscaffoldext-cookiecutter-0.1b1.tar.gz
Algorithm Hash digest
SHA256 0888ef454e125b96058c3c9d4dd2e656dcd99222e4bd52a884a674e63650d150
MD5 1c2ab76eceaae1ab94f2294fc52dbf71
BLAKE2b-256 8ca54b057c59f8db7db54044347dc54992f6b0e480b13036b01676979b29acd3

See more details on using hashes here.

File details

Details for the file pyscaffoldext_cookiecutter-0.1b1-py2.py3-none-any.whl.

File metadata

  • Download URL: pyscaffoldext_cookiecutter-0.1b1-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for pyscaffoldext_cookiecutter-0.1b1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4054bf3e42097ed125662cb61fd2b29946ef552db256585741c6ee98b503bb3e
MD5 aa5f177c68d03b963ff0c32e235171e7
BLAKE2b-256 0d1538fae753641908780992dcfc1a324ed465bb8477dbc5f20719442782d7a1

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