You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/getting-started/local-installation.md
+124-8Lines changed: 124 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,26 @@ Codeflash is installed and configured on a per-project basis.
8
8
9
9
You can install Codeflash locally for a project by running the following command in the project's virtual environment:
10
10
11
+
### Prerequisites
12
+
13
+
Before installing Codeflash, ensure you have:
14
+
15
+
1.**Python 3.9 or above** installed
16
+
2.**A Python project** with a virtual environment
17
+
3.**Project dependencies installed** in your virtual environment
18
+
4.**Tests** (optional) for your code (Codeflash uses tests to verify optimizations)
19
+
20
+
:::important[Virtual Environment Required]
21
+
Always install Codeflash in your project's virtual environment, not globally. Make sure your virtual environment is activated before proceeding.
22
+
23
+
```bash
24
+
# Example: Activate your virtual environment
25
+
source venv/bin/activate # On Linux/Mac
26
+
# or
27
+
#venv\Scripts\activate # On Windows
28
+
```
29
+
:::
30
+
### Step 1: Install Codeflash
11
31
```bash
12
32
pip install codeflash
13
33
```
@@ -16,22 +36,39 @@ pip install codeflash
16
36
We recommend installing Codeflash as a development dependency.
17
37
It doesn't need to be installed as part of your package requirements.
18
38
Codeflash is intended to be used locally and as part of development workflows such as CI.
39
+
If using pyproject.toml:
40
+
```toml
41
+
[tool.poetry.dependencies.dev]
42
+
codeflash = "^latest"
43
+
```
44
+
Or with pip:
45
+
```bash
46
+
pip install --dev codeflash
47
+
````
19
48
:::
20
49
21
-
## Generate a Codeflash API Key
50
+
### Step 2: Generate a Codeflash API Key
22
51
23
-
Since Codeflash uses advanced Large Language Models (LLMs) that are hosted in the cloud, you will need to generate an API key to use Codeflash.
52
+
Codeflash uses cloud-hosted AI models to optimize your code. You'll need an API key to use it.
24
53
25
-
To generate an API key, visit the [Codeflash Web App](https://app.codeflash.ai/) and sign up for an account with GitHub login.
54
+
1. Visit the [Codeflash Web App](https://app.codeflash.ai/)
55
+
2. Sign up with your GitHub account (free)
56
+
3. Navigate to the [API Key](https://app.codeflash.ai/app/apikeys) page to generate your API key
26
57
<!--- TODO: Do we ask for access to specific repositories here? --->
27
-
Once you have signed up, you will be able to generate an API key from the [API Key](https://app.codeflash.ai/app/apikeys) page.
28
-
You will need the API key in the next step.
29
58
30
-
## Automatic Configuration
59
+
:::note[Free Tier Available]
60
+
Codeflash offers a **free tier** with a limited number of optimizations per month. Perfect for trying it out or small projects!
61
+
:::
62
+
63
+
### Step 3: Automatic Configuration
31
64
32
-
To configure Codeflash for a project, in the root directory of your project where your `pyproject.toml` file is located, run the following command :
65
+
Navigate to your project's root directory (where your `pyproject.toml` file is or should be) and run:
33
66
34
67
```bash
68
+
# Make sure you're in your project root
69
+
cd /path/to/your/project
70
+
71
+
# Run the initialization
35
72
codeflash init
36
73
```
37
74
@@ -56,11 +93,90 @@ After you have answered these questions, Codeflash will be configured for your p
56
93
The configuration will be saved in the `pyproject.toml` file in the root directory of your project.
57
94
To understand the configuration options, and set more advanced options, see the [Configuration](/configuration) page.
58
95
59
-
## Install the Codeflash GitHub App
96
+
### Step 4: Install the Codeflash GitHub App
60
97
98
+
<!--- TODO: Justify to users Why we need the user to install Github App even in local Installation or local optimization? --->
61
99
Finally, if you have not done so already, Codeflash will ask you to install the Github App in your repository. The Codeflash GitHub App allows access to your repository to the codeflash-ai bot to open PRs, review code, and provide optimization suggestions.
62
100
63
101
Please [install the Codeflash GitHub
64
102
app](https://github.com/apps/codeflash-ai/installations/select_target) by choosing the repository you want to install
65
103
Codeflash on.
66
104
##
105
+
106
+
## Try It Out!
107
+
108
+
Once configured, you can start optimizing your code:
0 commit comments