Projects

Project Management

Introduction

Creating new projects is an important feature of the Lean CLI. The CLI can automatically scaffold basic Python and C# projects, creating basic algorithm files, research notebooks, and the required editor configuration. Projects scaffolded by the CLI are similar to the ones created on QuantConnect, making it easy to switch between your local environment and the cloud.

Create Projects

Follow these steps to create a new Python project:

  1. Open a terminal in one of your workspaces.
  2. Run lean project-create --language python "<projectName>" to create a new project named <projectName>.
    $ lean project-create --language python "My Python Project"
    Successfully created Python project 'My Python Project'
    This command creates the ./<projectName> directory and creates a simple main.py file, a Python-based research notebook, a project configuration file, and editor configuration for PyCharm and VS Code.

Follow these steps to create a new C# project:

  1. Open a terminal in one of your workspaces.
  2. Run lean project-create --language csharp "<projectName>" to create a new C# project named <projectName>.
    $ lean project-create --language csharp "My CSharp Project"
    Successfully created C# project 'My CSharp Project'
    This command creates the ./<projectName> directory and creates a simple Main.cs file, a C#-based research notebook, a project configuration file, and editor configuration for Visual Studio, Rider, and VS Code.
The project name must only contain -, _, letters, number, and spaces. The project name can't start with a space or be any of the following reserved names: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, or LPT9.

You can provide a project name containing forward slashes to create a project in a sub-directory. In case any of the given sub-directories does not exist yet, the CLI creates them for you.

Set the Default Language

It is also possible to set the default language to use when running lean project-create:

  • Run lean config set default-language python to set the default language to Python, after which you no longer need to provide the --language python option to create Python projects.
    $ lean config set default-language python
    $ lean project-create "My Python Project"
    Successfully created Python project 'My Python Project'
  • Run lean config set default-language csharp to set the default language to C#, after which you no longer need to provide the --language csharp option to create C# projects.
    $ lean config set default-language csharp
    $ lean project-create "My CSharp Project"
    Successfully created C# project 'My CSharp Project'

Rename Projects

Follow these steps to rename a project that you have on your local machine and in QC Cloud:

  1. Open the workspaces on your local machine where you store the project.
  2. Rename the project file.
  3. The project name must only contain -, _, letters, number, and spaces. The project name can't start with a space or be any of the following reserved names: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, or LPT9.

  4. Log in to the CLI if you haven't done so already.
  5. Open a terminal in the same workspace.
  6. Run lean cloud push --project "<projectName>".
$ lean cloud push --project "My Renamed Project"
[1/1] Pushing "My Renamed Project"
Renaming project in the cloud from 'My Project' to 'My Renamed Project'
Successfully updated name and files and libraries for 'My Project'

Alternatively, you can rename the project in QC Cloud and then pull the project to your local machine.

Delete Projects

Follow these steps to delete a project:

  1. Log in to the CLI if you haven't done so already.
  2. Open a terminal in the workspace that stores the project.
  3. Run lean project-delete "<projectName>".
$ lean project-delete "My Project"
Successfully deleted project 'My Project'

This command deletes the project on your local machine and in QC Cloud.

If you are a collaborator on the project, this command doesn't delete the project for the other collaborators, but it removes you as a collaborator.

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: