Create a New Project with Flexlate

This guide covers creating a new project with Flexlate.

If you already have a project that was previously generated from a template using cookiecutter or copier and you want to update it with Flexlate, you should follow the existing project guide. If you want to use Flexlate to add new templates within an existing project that was not generated from cookiecutter or copier, you should follow the add to project guide.

fxt init-from

The fxt init-from command is used to create a new Flexlate project from a template. It will also create a new folder and initialize a git repository in it before adding the Flexlate output. Let’s give it a try with a very minimal example template:

    $ fxt init-from https://github.com/nickderobertis/copier-simple-example
 Initializing flexlate project with default add mode local and user=False in 
/tmp/tmp3q_6p8dg
  Initializing...
  Initializing...
  Initializing...

✔ Finished initializing flexlate project
 Adding template source...
 Adding template source copier-simple-example from 
https://github.com/nickderobertis/copier-simple-example


 Sucessfully added template source copier-simple-example



 Applying template copier-simple-example to /tmp/tmp3q_6p8dg
 Updating 1 applied templates

question1? Format: yaml
my answer

The second question
question2? Format: float
10

    create  my answer.txt



    create  temp.txt


✔ Successfully updated template output
✔ Successfully applied template copier-simple-example to /tmp/tmp3q_6p8dg
my-project

$ cd my-project

$ ls
 flexlate-project.json	 flexlate.json	'my answer.txt'

We can see that it prompts based on the questions in the template, and then for the name of the generated folder.

Note

Cookiecutter templates will not prompt for a folder name, it is already determined by the template questions.

We can see that it generated the project complete with a Flexlate project config and config for the applied template.

If you want to generate the project from a template at a specific version, --version can be used, for example:

fxt init-from --version c7e1ba1bfb141e9c577e7c21ee4a5d3ae5dde04d https://github.com/nickderobertis/copier-simple-example 

See the command reference for full details.

Next Steps

See how to update your project to a newer template version.