Nim New Project Template
that friction to using different languages comes from not so much the
differences in syntax, or even the ideas, but being
in the environment of the language. The knowledge of one language’s
build system (say python’s
) to another
) is not exactly transferable. So
the developer goes back to using their
zone and doesn’t make progress in using the new language.
Nim is a language I would like to use more of. But, I always appear to get stuck when trying to use nimble to start a new project. I wanted to exercise writing a new project from start, but also make it easy for myself “not to think too much” when I wanted to start a small app or even a script next time. In Python, it is almost muscle memory now to use poetry to kickstart a project. For nim, there is a project template called nimptemplate that you can use to create a fresh project. I studied that project, and a couple of nim projects on github to figure out the necessary and common elements, and created a cookiecutter template that can be invoked like this:
Cookiecutter then asks a few questions (project name, author, license) to generate a fresh project.
What I learnt about nim/nimble project setup from doing this:
Essential fields that go into a project’s
How to add common tasks (eg: release, debug builds) to the
Directory structure (
src, docs, examples, tests)
How to write a simple assertion test and run it using nimble.
doAssert 1 + 1 == 2and `nimble test)
Add third party Dependencies. (