sh_cpl/docs/build/html/_sources/setup.md.txt

114 lines
3.2 KiB
Plaintext
Raw Permalink Normal View History

2021-05-17 18:32:09 +02:00
# Setting up the local environment and workspace
## Table of Contents
1. [Prerequisites](#prerequisites)
2. [Install the package](#install-the-package)
3. [Install the CLI](#install-the-cli)
2021-12-02 08:20:38 +01:00
3. [Install the query](#install-the-query)
2021-05-17 18:32:09 +02:00
4. [Create a initial application](#create-initial-console-app)
5. [Create a initial library](#create-initial-library)
6. [Start the application](#start-the-app)
7. [What's next](#whats-next)
## Prerequisites
To get most out of this tutorial you should already have a basic understanding of the following.
- [Python][python]
Also you need to have the following installed.
- [Python][python]
- [Pip][pip-url]
## Install the package
To install the package, open a terminal window and run the following command:
```sh
2022-12-04 00:50:24 +01:00
pip install cpl-core --extra-index-url https://pip.sh-edraft.de
2021-05-17 18:32:09 +02:00
```
## 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:
```sh
2022-12-04 00:50:24 +01:00
pip install cpl-cli --extra-index-url https://pip.sh-edraft.de
2021-05-17 18:32:09 +02:00
```
2021-12-02 08:20:38 +01:00
## Install the query
To install the package, open a terminal window and run the following command:
```sh
2022-12-04 00:50:24 +01:00
pip install cpl-query --extra-index-url https://pip.sh-edraft.de
2021-12-02 08:20:38 +01:00
```
2021-05-17 18:32:09 +02:00
## Create initial console app
2021-11-01 20:43:25 +01:00
You develop apps and packages in the context of an CPL project which is defined in an cpl_core.json.
2021-05-17 18:32:09 +02:00
1. Run the CLI command ```cpl new console``` and provide the name my-app, as shown here:
```sh
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
2021-11-01 20:43:25 +01:00
You develop apps and packages in the context of an CPL project which is defined in an cpl_core.json.
2021-05-17 18:32:09 +02:00
1. Run the CLI command ```cpl new library``` and provide the name my-lib, as shown here:
```sh
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:
```sh
cd /path/to/project/name
```
3. To run the app run:
```sh
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:
```sh
Hello World
```
## What's next
2023-02-20 15:55:20 +01:00
- To learn more about the CPL CLI, see the [CLI Overview](cpl_cli.overview)
- Fore more informations about the Pyhton files generated by ```cpl new```, see [New Command](cpl_cli.new)
2021-05-17 18:32:09 +02:00
<!-- LINKS -->
[pip-url]: https://pip.sh-edraft.de
[python]: https://www.python.org/
[pip]: https://pypi.org/project/pip/