/create_app

A tool that allows you to quickly get your basic project structure ready, while adopting the best technologies, tools, and practices.

Primary LanguagePythonMIT LicenseMIT

Create App logo

Test Workflow Status Linting Workflow Status PyPI Publication Workflow Status Coverage Status PyPI Code style: black

create_app is a tool for creating applications from templates.

When developers start a new project, they perform some repetitive tasks to build the basic project structure before actually start coding features. This basic structure involves things like: Well, the project structure, unit testing, code coverage, containerization, code linting and formatting, GIT hooks, building code documentation, among many others.

create_app is a tool that allows to quickly get your basic project structure ready. It provides a set of templates from which you can get your project started, plus it's super easy to use and encourages the adoption of the best technologies, tools, and practices.

At the moment, there are only Python templates available. But create_app can generate projects of any language, as it uses cookiecutter.

Installation

Just install it with PIP:

python -m pip install create_app

Usage

Learn how to use the create_app command:

python -m create_app --help

You can use the --help option for all subcommands too.

List templates

Use the list subcommand to know which templates you can use:

python -m create_app list

Create your project from a template

Use the create subcommand and specify the TEMPLATE_NAME you wish to use:

create_app create TEMPLATE_NAME

Using the template defaults

If you don't want to configure your project and just want to create it from the template using all the default values, use the --use-defaults flag:

create_app create TEMPLATE_NAME --use-defaults

Using a configuration file

When creating a project, you are asked to type your project configuration in. If you already know which the template settings are and the values you want to use, you can use the --config-file option to specify these values from a JSON file. This option is specially useful for scripting:

create_app create TEMPLATE_NAME --config-file=config.json

Using a custom templates index

You or your organization may need to keep a separate index with your own templates.

If that's the case, you can list the templates in the custom index by running:

create_app list --index="https://www.somewhere.com/templates-index"

And create your project from a template in that index:

create_app create TEMPLATE_NAME --index="https://www.somewhere.com/templates-index"

Using create_app from Python

You can import create_app from Python too, which is great for scripting or creating multiple projects at once:

from create_app.main import create_app

# Create from a template named "python_simple"
create_app("python_simple")

How it works

It uses a great tool named cookiecutter to build your project from a template. The templates are cookiecutters, so you could simply use cookiecutter to build your project from the template repo URL:

python -m cookiecutter https://github.com/application-creators/python_simple

create_app is just an entry point to a set of templates, and I was inspired by create-react-app, which lets you create your project from a template by just specifying a template name.

The main goal though, and what I would like to focus on, is to come up with great project templates. Then people can choose to directly use cookiecutter to build their projects, or could use this tool to discover which templates are available and to create their project.

Index of Available Templates

There's an index of templates, from which you can get your project started:

Template Description
python_simple Python project with unit tests, GIT hooks (pre-commit, black, isort, and flake8), and Docker
python_compose Python project with unit tests, GIT hooks (pre-commit, black, isort, and flake8), and Docker Compose
python_fastapi FastAPI project with unit tests, GIT hooks (pre-commit, black, isort, and flake8), and Docker
python_fastapi_with_database FastAPI project with unit tests, GIT hooks (pre-commit, black, isort, and flake8), Docker Compose, a PostgreSQL database (which can be very easily changed for any other), SQLAlchemy, and Alembic migrations

Contribute

Application Creators is a new GitHub organization I've created to host, debate, and maintain this tool and the project templates. Its goal is to generate state-of-the-art templates useful to everyone. Feel free to express you opinion and contribute!