# Setting up the local environment and workspace

## Table of Contents

1. Prerequisites

2. Install the package

3. Install the CLI

4. Install the query

5. Create a initial application

6. Create a initial library

7. Start the application

8. What’s next

## Prerequisites

To get most out of this tutorial you should already have a basic understanding of the following.

- Python

Also you need to have the following installed.

- Python

- Pip

## Install the package

To install the package, open a terminal window and run the following command:

    pip install sh_cpl-core --extra-index-url https://pip.sh-edraft.de

## Install the CLI

You use the CPL CLI to create projects, generate application and library code. You also use the CLI to build and publish your python packages.

To install the CLI, open a terminal window and run the following command:

    pip install sh_cpl-cli --extra-index-url https://pip.sh-edraft.de

## Install the query

To install the package, open a terminal window and run the following command:

    pip install sh_cpl-query --extra-index-url https://pip.sh-edraft.de

## Create initial console app

You develop apps and packages in the context of an CPL project which is defined in an cpl_core.json.

1. Run the CLI command `cpl new console` and provide the name my-app, as shown here:

       cpl new console my-app

2. The cpl new command prompts you for information about features to include in the initial app. Decline the defaults by enter ‘n’ and press the Enter key.

The CLI create a new workspace and a simple ‘Hello World’ app, ready to run.

## Create initial library

You develop apps and packages in the context of an CPL project which is defined in an cpl_core.json.

1. Run the CLI command `cpl new library` and provide the name my-lib, as shown here:

       cpl new library my-lib

2. The cpl new command prompts you for information about features to include in the initial library. Decline the defaults by enter ‘n’ and press the Enter key.

The CLI create a new workspace and a simple ‘Hello World’ library with CLI, ready to run.

## Start the app

The CLI includes a live development server, so that you can run your app locally.

1. Open a terminal window

2. To navigate to your project workspace, run the following command:

       cd /path/to/project/name

3. To run the app run:

       cpl start

The `cpl start` command launches the server, watches your source files, and restarts the app as you make chnages to thoses source files.

If your installation and setup was successful, you should see a output similar to the following:

    Hello World

## What’s next

- To learn more about the CPL CLI, see the CLI Overview

- Fore more informations about the Pyhton files generated by `cpl new`, see New Command