Skip to content
KimSia Sim edited this page May 24, 2024 · 2 revisions

Why do this repo?

The impetus is to create a cookiecutter that's usable as a python binary using a tool like PyInstaller.

Unfortunately, there are two ways the current cookiecutter (as of 2024-05-24 Friday, version 2.6.0) cannot be used directly in a python binary.

Using Path in _get_version

In https://github.com/cookiecutter/cookiecutter/blob/4c2acaf7af974fb56ebd0e850184f45204552893/cookiecutter/__init__.py#L8

from pathlib import Path


def _get_version() -> str:
    """Read VERSION.txt and return its contents."""
    path = Path(__file__).parent.resolve()
    version_file = path / "VERSION.txt"
    return version_file.read_text(encoding="utf-8").strip()

The use of Path will break when in a binary.

Pull Request at cookiecutter/cookiecutter to fix this

https://github.com/cookiecutter/cookiecutter/pull/2071

Clone this wiki locally