I'm looking for a utility that is something like cookiecutter, in that it 
generates a "template" project for me. However, I would like the ability to 
have a template add content based on runtime questions, something like

   Do you want to include a C extension? [yes/no]
   ... adds Extension() to setup.py, adds a C source file, etc
   Do you want to include tests? [yes/no]
   ... add a test directory with a sample test
   Tests to run under tox? [yes/no]
   ... add tox support (this question shouldn't be asked if the previous answer 
was "no")

As far as I know, this sort of feature isn't available in cookiecutter, nor is 
it planned.

Does anyone know of any similar utility that has this feature? If not, how do 
people handle it themselves? The "obvious" solution is just to have a 
full-featured template and cut out what's not needed, but for simple tasks, I 
find that cutting out the unneeded stuff can be a bigger job than writing the 
actual code.

Some examples of use cases I hit:

1. I need a trivial Python only, single-file project, to test some packaging 
issue.
2. Same, but I need a C module, that implements a single trivial function.
3. Added to either of the above, I need to include tests. Maybe with tox, maybe 
just standalone.
4. For a bigger project I might want Sphinx included as well.
5. Maybe add standard build scripts. At the moment I don't do this, but if I 
*had* a utility like I describe, this is one thing I'd like to do.

For all of these cases, I only really want to maintain a single template, as I 
don't want to have to maintain all of the common boilerplate (author 
name/email, version handling, classifiers etc) multiple times.

I don't use (or particularly want to switch to) an IDE. Generally I code using 
VS Code or Vim, on Windows, and run tests, builds etc from the command line.

Is there any such utility that I'm not aware of? If not, then what do people 
use to manage this sort of thing?

Paul
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to