boilee

An easy way to create a tool to generate code boilerplates like "npm init" and "vue create" for any programming language.


Keywords
boilerplate, cli, generator, templating, boilerplates, cross-platform, gitpod, pyoxidizer
License
GPL-3.0
Install
pip install boilee==1.0.0

Documentation

Boilee

License GitHub release (latest by date) Python version Last commit Code style: black Gitpod ready-to-code Say Thanks!

An easy way to create a tool to generate code boilerplates like npm init and vue create for any programming and markup language.

Features

  • Cross-platform: You can use it on Windows, Mac and Linux, and...
  • You don't need to have Python installed!
  • Simple and beautiful command line interface!
  • Manipulate files with template engine: Only knowing a model engine can create boilers for any programming and markup language. Currently...
  • Jinja, Mako and Genshi are supported!
  • Manipulate files with template engine and YAML: You can choose which files and directories will be written and define their content intuitively with a YAML file
  • Complete: You have several options to manipulate from input and arguments to commands to be executed and the behavior of the template engine
  • You can add boilerplates to use offline, just run: boilee add <boilerplate-name>
  • The outputs are true complete cli's: The boilers generated can receive arguments, receive inputs, show help, show boilerplate information, get information from the system and execute commands. This makes them true cli's, as well as npm init and vue-create.

Boilee or Cookiecutter

This project was not created with the intention of being a competitor of cookiecutter, but it has some advantages in relation to it, just look at items 2, 3, 5, 6, 7, 8 and 9 of the list above.

Installation

Obtain the executable

You can get here the executables for Windows, Linux and Mac OS

Installing via pip

You can install boilee via pip on your system (or on a venv) with the following command:

pip install boilee

Installing from source code

To get the executable from the source see the build section

Usage

# Create a zip file that contains all the information of the boilerplate:
boilee make <input-directory> <boilerplate-name>
# Generate boilerplate
boilee run <input-file> <output-directory> [...boilerplate-options]

QuickStart

Create the following files:

# example_boilerplate/project/scripts/python3.py

def main():
    print("Message from Python 3:")
    print("{{ message }}")

if __name__ == "__main__":
    main()
# example_boilerplate/project/scripts/python2.py

def main():
    print "Message from Python 2:"
    print "{{ message }}"

if __name__ == "__main__":
    main()
# example_boilerplate/.boilee/structure.yml

- {{ project_name }} @content="project": # Creates a directory with a name provided by the user with the content of the "project" directory
    - scripts: # "scripts" directory
        - python{{ python-version }}.py
# example_boilerplate/.boilee/parameters.yml

project_name:
    input-type: input
    parameter_type: argument
    message: Enter the project name
python-version:
    input-type: list
    message: Select a Python version
    choices:
        - Python 3:
            value: 3
        - Python 2:
            value: 2
message:
    input-type: input
    message: Enter a message

Create a zip file that contains all the information of the boilerplate:

boilee make example_boilerplate example

Generate boilerplate and test:

boilee run example.zip example_python3 --python-version=3 --message=Hi!
python3 example_python3/scripts/python3.py

# Result
Message from Python 3:
Hi!
boilee run example.zip example_python2 --python-version=2 --message=Hi!
python2 example_python2/scripts/python2.py

# Result
Message from Python 2:
Hi!

If a parameter is not provided it will be requested later.

"boilee run" example

Development

To open this project in a development environment see the Preparation section in the Contributor Guidelines

You can also open this project in an automated development environment in gitpod:

Open in Gitpod

Contributing

See Contributor Guidelines

Build

By default boilee uses pyoxidizer to generate an executable.

To generate an executable with pyoxidizer (if pyoxidizer is already installed) run the command:

pyoxidizer build

The executable will be generated inside the "build" directory

License

GNU General Public License v3.0