Skip to main content

Generate code without writing any.

Project description

Generoo

When we start new projects, we often go through a similar set of steps to bootstrap it. As a developer, we want to spend time developing. That's where generoo comes in. Generoo allows developers to write a project template once and then generate new projects from that template in seconds. Project templating without any additional coding gives time back to developers so they can focus on writing core business logic.

For an in-depth look at Generoo and it's use, see the documentation.

Installation

PIP

Install the package from pip:

pip install generoo

Run from the module:

python -m generoo <goal> <scope> <name>

Source

Clone the project. Navigate to the directory on your machine.

Note: Generoo must be run in Python 3.6 and above.

You can run from the python interpreter by using the following command:

python generoo.py <goal> <scope> <name>

How does it work?

Generoo is simple. Create a template using Mustache's syntax for string replacement.

The template could be a file called examples/hello-world/hello_world.py that looks like:

print('Hello, {{who}}')

Then, a template configuration file in JSON or YAML defines prompts for the user when they run Generoo. Here's an example file called examples/hello-world/template-config.json:

{
  "prompts": [
    {
      "name": "who",
      "text": "Enter who you want to say hello to"
    }
  ]
}

The text is what the user will see when the prompt is shown and the name is the template value that will be replaced.

Running python3 generoo.py generate project hello-world --template examples/hello-world/hello_world.py --template-config examples/hello-world/template-config.json will prompt the user:

$ Say hello to:

When user enters: World, then the template is filled out and written to hello-world/hello_world.py and looks like:

print('Hello, World')

For more information about how the templating system works, see the Generoo documentation.

Usage

Using generoo is simple. The CLI or python script takes 3 positional arguments:

generoo <goal> <scope> <name> [options...]

  • goal - what you want generoo to do. Example: generate
  • scope - what you want generoo to create. Example: project
  • name - what you want to name what generoo is creating. This will be used as the root directory name. Example: example

Positional Arguments (in the order they appear):

Goals

Argument Description Aliases
generate Fill in templates for an archetype or custom user project. gen, g

Scopes

Argument Description Aliases
project Generates a new project with the given name. project, proj, pro, p

Options

Option Description
-n, --no-config Will run generoo without a pre-existing configuration.
-a, --auto-config Will run generoo using the pre-existing configuration and only prompt for values not present in the configuration.
-c, --template-config Points to a location on the system that contains a custom template config.
-t, --template Points to a directory on the system that contains templates for a corresponding template config.
-r, --run-configuration Points to a file on the system that contains a run configuration for a corresponding template config.

Built-In Templates

If no --template or --template-config arguments are given, then Generoo will generate from its built-in templates. Check out the archetypes directory to see the templates yourself. Or, better yet, try generating one.

Contributing

Have a template that you'd like to share? Submit a PR with the template and we'll see about getting it into the built-in templates for this project.

Want some new functionality? Open an issue or a PR with the changes you'd like to see.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

generoo-2019.7.24.6.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

generoo-2019.7.24.6-py3-none-any.whl (27.3 kB view details)

Uploaded Python 3

File details

Details for the file generoo-2019.7.24.6.tar.gz.

File metadata

  • Download URL: generoo-2019.7.24.6.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.4

File hashes

Hashes for generoo-2019.7.24.6.tar.gz
Algorithm Hash digest
SHA256 98833814b4897e8f0ec0f2838a93a99096f7dabc0d8daffca6f8b49016bc49a1
MD5 4a27838be72e102f338a729596184bdc
BLAKE2b-256 7195aab7cbfff302ff214afddd78a9afba9bb100907fbabfa8ddef227e48eecd

See more details on using hashes here.

File details

Details for the file generoo-2019.7.24.6-py3-none-any.whl.

File metadata

  • Download URL: generoo-2019.7.24.6-py3-none-any.whl
  • Upload date:
  • Size: 27.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.4

File hashes

Hashes for generoo-2019.7.24.6-py3-none-any.whl
Algorithm Hash digest
SHA256 33e611ad3fdf1a6f14dc0c7fa25b4c42fd927f43ed175bde88266d4919324c50
MD5 1ebf1fc4c759d633027f79f2aec61f18
BLAKE2b-256 ff7c37aa7f0a6f7bb7e5d0f4dd22475ceaa028cd60b6f1d39ddee892c7439ad7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page