114 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			114 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| # 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)
 | |
| 3. [Install the query](#install-the-query)
 | |
| 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
 | |
| pip install 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:
 | |
| 
 | |
| ```sh
 | |
| pip install 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:
 | |
| 
 | |
| ```sh
 | |
| pip install 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:
 | |
| 
 | |
|     ```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
 | |
| 
 | |
| 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:
 | |
| 
 | |
|     ```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
 | |
| 
 | |
| - To learn more about the CPL CLI, see the [CLI Overview](cli.overview)
 | |
| - Fore more informations about the Pyhton files generated by ```cpl new```, see [New Command](cli.new)
 | |
| 
 | |
| <!-- LINKS -->
 | |
| [pip-url]: https://pip.sh-edraft.de
 | |
| [python]: https://www.python.org/
 | |
| [pip]: https://pypi.org/project/pip/
 |