Skip to main content

Cookiecutter Project Upgrader

https://img.shields.io/pypi/v/cookiecutter_project_upgrader.svg CI Status - master Documentation Status Code Coverage

Upgrade projects created from a Cookiecutter template.

Features

Cookiecutter Project Upgrader allows upgrading projects that were created using Cookiecutter.

After a project has been created from a Cookiecutter template, changes made to the Cookiecutter template usually have to be applied manually to the project. This tool automates this process.

When run the first time on a project, it creates a new branch from the first commit of the current branch (the oldest one). It then generates the project again using the latest version of the template and creates a new commit that contains the latest cookiecuttered code,

Usage: cookiecutter_project_upgrader [OPTIONS]

Upgrade projects created from a Cookiecutter template

Options:
-c, --context-file PATH

Default: docs/cookiecutter_input.json

-b, --branch TEXT

Default: cookiecutter-template

-u, --upgrade-branch TEXT

Optional branch name of cookiecutter template to checkout before upgrading.

-f, --zip-file TEXT

Zip file Path/URL for Cookiecutter templates.

-i, --interactive

Enter interactive mode. Default behaviour: skip questions, use defaults.

-m, --merge-now BOOLEAN

Execute a git merge after a successful update, default: ask if interactive, otherwise false.

-p, --push-template-branch-changes BOOLEAN

Push changes to the remote Git branch on a successful update, default: ask if interactive, otherwise false.

-e, --exclude TEXT

Git pathspecs to exclude from the update commit, e.g. -e “*.py” -e “tests/”.

-h, --help

Show this message and exit.

Preconditions

The tool requires a JSON file with context that matches the existing service. This file can be created through Cookiecutter with the following contents:

{{ cookiecutter | jsonify }}

You will need a recent version of git for this to work. (it needs –no-checkout on git worktree)

Auto-Completion

The script uses the Click toolkit. Because the script uses Click, you can enable completion for Zsh and Bash.

For Bash, add the following to your .bashrc or some other profile initialization file. eval “$(_COOKIECUTTER_PROJECT_UPGRADER_COMPLETE=source cookiecutter_project_upgrader)”

For Zsh, please read the Click documentation.

Credits

The concept and some code is heavily based on https://github.com/senseyeio/cupper, with some changes to use Click and some flags and default values to ease usage. Also cleanup has been done and automated tests have been added.

This package was created with Cookiecutter and the thomasjahoda/cookiecutter-pypackage project template.

History

1.0.0 (2019-03-22)

  • First release on PyPI.

1.1.0 (2019-03-24)

  • Ask for some options interactively if within interactive shell.

1.2.0 (2020-08-02)

  • Move interactive mode behind -i flag.

  • Add -p flag to push the branch on successful update.

  • Add -e flag to exclude git pathspecs from the update.

  • Do not run pre-commit hooks on the update commit.

  • Expose -h flag in addition to –help.

  • Finish with non-zero exit status if there are no changes to be made (for shell piping).

Metadata

Release files for cookiecutter-project-upgrader 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cookiecutter-project-upgrader 1.3.1
File Size Uploaded Provenance Actions
cookiecutter_project_upgrader-1.3.1.tar.gz 25.2 kB Without provenance Details for cookiecutter_project_upgrader-1.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cookiecutter-project-upgrader 1.3.1
File Interpreter ABI Platform Actions
cookiecutter_project_upgrader-1.3.1-py2.py3-none-any.whl Python 2, Python 3 none any Details for cookiecutter_project_upgrader-1.3.1-py2.py3-none-any.whl

Total release size: 33.9 kB

Release files / cookiecutter_project_upgrader-1.3.1.tar.gz

Download URL cookiecutter_project_upgrader-1.3.1.tar.gz
Size 25.2 kB
Tags Source
SHA-256 checksum
How to use checksums
20c48970acacc5d22a33b7ac0bca74674b2690563748cc9c3c5728048eb97b6d
BLAKE2b-256 checksum
How to use checksums
8511e4bfe94ec93ceeb9dc4871e384a4be0a79ab350eb1c7685e784958cd5485
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Release files / cookiecutter_project_upgrader-1.3.1-py2.py3-none-any.whl

Download URL cookiecutter_project_upgrader-1.3.1-py2.py3-none-any.whl
Size 8.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
bcf9f49e2a66201ce6cfe28aed8f6bf722d82618ace5abbeb5a11b1ad45d7b8e
BLAKE2b-256 checksum
How to use checksums
47e9260a3f98f69903607368193e191855435094546e736fe74d4dc8ed27a94c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Security for cookiecutter-project-upgrader 1.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page