Unfortunately, it looks like raising an exception causes cookiecutter to print a traceback which makes the error output most confusing:
Traceback (most recent call last):
File "/var/folders/08/n47xk4pn63s7x5c4bp31kxx00000gn/T/tmpjru8avi6.py", line 14, in <module>
f"ERROR: The collection slug ({collection_slug}) is not a valid Python module name. "
ValueError: ERROR: The collection slug (prefect-collection) is not a valid Python module name. Please do not use - and use _ instead
ERROR: Stopping generation because pre_gen_project hook script didn't exit successfully
Hook script failed (exit status: 1)
I think we should stick with the print + sys.exit so that we can print clean error messages.
In the interest of readable error messages, we could use rich to color our output so it's clear to the user what the underlying issue is.
Unfortunately, it looks like raising an exception causes cookiecutter to print a traceback which makes the error output most confusing:
I think we should stick with the print + sys.exit so that we can print clean error messages.
In the interest of readable error messages, we could use rich to color our output so it's clear to the user what the underlying issue is.