Package: parboil
:rice: ParboilProject Boilerplate GeneratorWithParboilyou can create reusable boilerplate templates to kickstart your next project.!!! note ""_Parboil_ is a Python rewrite of [boilr](https://github.com/tmrts/boilr) by [Tamer Tas](https://github.com/tmrts)pipx install parboilSuccessfully installed parboilboil install -d jneug/parboil-license[✓] Installed recipeparboil-license[i]Use withboil use parboil-licenseboil use parboil-license[i] Used prefilled value for "Author"[i] Used prefilled value for "Email"[?] Enter a value for "Year"(2022):[?] Choose a value for "License"1-Apache License 2.02-MIT3-ISC4-GNU GPL v3.05-GNU GPL v2.06-CC-BY 4.07-CC-BY-SA 4.08-CC-0 1.0Select from1..92[i] Generated project for recipe "parboil-license" in/Users/xyz/Projects/fooInstallationInstallPython 3and thenParboilwithpip:pip install parboilParboilwill install aboilcommand on your system. Runboil --versionto see, if it worked.Getting startedUseboil --helpto see the list ofavailable commandsandboil <command> --helpto see usage information for any command.Installing your first templateParboilmaintains a local repository of project templates. To useParboilyou first need to install a template. You can install templates from a local directory or download them from GitHub.For your first template installjneug/parboil-templatefrom GitHub - a project template to create parboil project templates.boil install -d jneug/parboil-template pbtThis will download the template fromjneug/parboil-templateand makes it available under the namepbt. (The-dflag tells Parboil, that you want to download from GitHub and not from a local directory.)Verify the install withboil list.Using a templateTo use your new template runboil use pbt new_templateThis will create the boilerplate project in thenew_templatedirectory. (Omitting the directory will add the template to the current working dir.)Parboilasks you to input some data and then writes the project files.Uninstall and updateTo remove a template runboil uninstall <templatename>and to update from its original source (either a local directory or a GitHub repository) runboil update <templatename>.Creating your first recipeTheparboil-templateis a good starting point to create your own template.ParboilusesJinja2to parse the template files and dynamically insert the user information into the template files. That means, you can use all of Jinjas features (and some more), to create your template files.Let's create a simple project template for meeting logs from scratch.First, create a directory for your new template. Let's call itmeeting_log. Then creat a directory calledtemplateand a file calledproject.jsonin it.meeting_log/
├── template/
└── parboil.jsonThis is the basic structure of a parboil recipe.parboil.jsonholds the recipe configuration andtemplatethe actual template files.Now openparboil.jsonin any editor and copy the following text into it:!!! example``` json
{
	// Ingredients for the meeting log recipe
	"Author": "",
	"Meeting": "Daily meeting",
	"MeetingNo": 1,
	"Topic": "Planning the day",
	"IamModerator": false,
	"NumberOfTops": 2
}
```This is a basic recipe that defines fiveingredients. Ingredients are essentially variables that are filled in by the user and inserted into the template files. The key of each entry is the field name, the value is the default. An empty string means, the key is required everytime.!!! tipAs you can see in the example above, a recipe is defined in json with comments format.Now we need to add the file(s) that should be created by Parboil. Create{{Meeting}}_log.mdin thetemplatedirectory. And enter this text:# Meeting notes for{{Meeting|title}}#{{MeetingNo}}> Date:{%time'%Y-%m-%d'%}> Topic:{{Topic}}> Author:{{Author}}{%ifIamModerator%}> Moderator:{{Author}}{%endif%}## Topics{%fortinrange(NumberOfTops)%}{{t|format('{:<2}')}}.{%endfor%}## NotesThe template usesJinjas syntaxto add the field values. For example{{ Author }}will be replaced with the name you entered while prompted. Note that you can use the fields in filenames, too.You can use any Jinjamacrosandfiltersin your templates.{{ Meeting|title }}will tranform the value of "Meeting" into titlecase.{% if IamModerator %}is a conditional.For more information readthe wiki page on template creation.Some more template creationYou can do some more complex stuff with templates. For example you might want to name the logfile in the example above with the current date and the meetings number padded with zeros to two digits. Also, the meeting name should be filtered for use in filenames. You would need to name the file like this:{% time '%Y-%m-%d' }_{{ '{:02}'.format(MeetingNo) }}-{{ Meeting|fileify }}.mdThe use of special chars works on many systems, but now all. Also, the filename becomes hard to read.To deal with this, you can rename your files from theproject.jsonconfig file. Add afilesobject next to thefieldsand map the filenames to the rename pattern:{
	"fields": {
		...
	},
	"files": {
		"meeting-log.md": "{% time '%Y-%m-%d' }_{{ '{:02}'.format(MeetingNo) }}-{{ Meeting|fileify }}.md"
	}
}Now you can name the log filemeeting-log.mdand will get something like2021-03-10_04-Daily Standup.mdas a result.There are some more features for creating complex templates, like subtemplates (for example run a template to generate a license file inside differnt app project templates), selective file inclusion, template inheritance or dealing with empty files.