|
1 | 1 | # Contribute to development |
2 | | -SQLMesh is licensed under [Apache 2.0](https://github.com/TobikoData/sqlmesh/blob/main/LICENSE). We encourage community contribution and would love for you to get involved. |
| 2 | + |
| 3 | +SQLMesh is licensed under [Apache 2.0](https://github.com/TobikoData/sqlmesh/blob/main/LICENSE). We encourage community contribution and would love for you to get involved. The following document outlines the process to contribute to SQLMesh. |
3 | 4 |
|
4 | 5 | ## Prerequisites |
| 6 | + |
| 7 | +Before you begin, ensure you have the following installed on your machine. Exacltly how to install these is dependent on your operating system. |
| 8 | + |
5 | 9 | * Docker |
6 | 10 | * Docker Compose V2 |
7 | 11 | * OpenJDK >= 11 |
8 | 12 | * Python >= 3.9 < 3.13 |
9 | 13 |
|
10 | | -## Commands reference |
| 14 | +## Virtual environment setup |
| 15 | + |
| 16 | +We do recommend using a virtual environment to develop SQLMesh. |
| 17 | + |
| 18 | +```bash |
| 19 | +python -m venv .venv |
| 20 | +source .venv/bin/activate |
| 21 | +``` |
| 22 | + |
| 23 | +Once you have activated your virtual environment, you can install the dependencies by running the following command. |
11 | 24 |
|
12 | | -Install dev dependencies: |
13 | 25 | ```bash |
14 | 26 | make install-dev |
15 | 27 | ``` |
| 28 | +<<<<<<< HEAD |
16 | 29 | Run linters and formatters: |
17 | 30 | ```bash |
18 | 31 | make style |
@@ -42,6 +55,108 @@ Run ide: |
42 | 55 | make ui-up |
43 | 56 | ``` |
44 | 57 | (Optional) Use pre-commit to automatically run linters/formatters: |
| 58 | +======= |
| 59 | + |
| 60 | +Optionally, you can use pre-commit to automatically run linters/formatters: |
| 61 | + |
| 62 | +>>>>>>> 61520e5a (creating the docs) |
45 | 63 | ```bash |
46 | 64 | make install-pre-commit |
47 | 65 | ``` |
| 66 | + |
| 67 | +## Python development |
| 68 | + |
| 69 | +Run linters and formatters: |
| 70 | + |
| 71 | +```bash |
| 72 | +make style |
| 73 | +``` |
| 74 | + |
| 75 | +Run faster tests for quicker local feedback: |
| 76 | + |
| 77 | +```bash |
| 78 | +make fast-test |
| 79 | +``` |
| 80 | + |
| 81 | +Run more comprehensive tests that run on each commit: |
| 82 | + |
| 83 | +```bash |
| 84 | +make slow-test |
| 85 | +``` |
| 86 | + |
| 87 | +Run Airflow tests that will run when PR is merged to main: |
| 88 | + |
| 89 | +```bash |
| 90 | +make airflow-docker-test-with-env |
| 91 | +``` |
| 92 | + |
| 93 | +## Documentation |
| 94 | + |
| 95 | +In order to run the documentation server, you will need to install the dependencies by running the following command. |
| 96 | + |
| 97 | +```bash |
| 98 | +make install-doc |
| 99 | +``` |
| 100 | + |
| 101 | +Once you have installed the dependencies, you can run the documentation server by running the following command. |
| 102 | + |
| 103 | +```bash |
| 104 | +make docs-serve |
| 105 | +``` |
| 106 | + |
| 107 | +Run docs tests: |
| 108 | + |
| 109 | +```bash |
| 110 | +make doc-test |
| 111 | +``` |
| 112 | + |
| 113 | +## UI development |
| 114 | + |
| 115 | +In addition to the Python development, you can also develop the UI. |
| 116 | + |
| 117 | +The UI is built using React and Typescript. To run the UI, you will need to install the dependencies by running the following command. |
| 118 | + |
| 119 | +```bash |
| 120 | +npm install |
| 121 | +``` |
| 122 | + |
| 123 | +Run ide: |
| 124 | + |
| 125 | +```bash |
| 126 | +make ui-up |
| 127 | +``` |
| 128 | + |
| 129 | +## Developing the VSCode extension |
| 130 | + |
| 131 | +Developing the VSCode extension is most easily done by launching the debug process from a visual studio code workspace. |
| 132 | + |
| 133 | +By default, the VSCode extension will run the SQLMesh server locally and open a new visual studio code window that allows you to try out the SQLMesh IDE. It by default opens the `examples/sushi` project. |
| 134 | + |
| 135 | +Please see the below diagram for a high level overview of the UI. |
| 136 | + |
| 137 | +```mermaid |
| 138 | +graph TD |
| 139 | + A[VSCode Extension] --> |start server| B[SQLMesh Server] |
| 140 | + A --> |creates webviews| C[Webviews] |
| 141 | + C --> |reads react webpages from| B |
| 142 | + A --> |calls lsp| B |
| 143 | + React[React App] --> |embedded in| B |
| 144 | +``` |
| 145 | + |
| 146 | +For development purposes, the React app is not embedded into the python server. Instead a separate instance of the React app is run. This allows you to make changes to the UI and see them immediately. |
| 147 | + |
| 148 | +This makes the architecture diagram at development time look like the following. |
| 149 | + |
| 150 | +```mermaid |
| 151 | +graph TD |
| 152 | + A[VSCode Extension] --> |start server| B[SQLMesh Server] |
| 153 | + A --> |creates webviews| C[Webviews] |
| 154 | + React [React Server] --> |passes on api requests| B |
| 155 | + C --> |reads react webpages from| React |
| 156 | +``` |
| 157 | + |
| 158 | +In development mode, the React app is not embedded into the python server. Instead a separate instance of the React app is run. This allows you to make changes to the UI and see them immediately. |
| 159 | + |
| 160 | +The React App runs on the port 5173. The VSCode extension will automatically open the React app in a new tab. |
| 161 | +The python server will run on the port 5174. |
| 162 | + |
0 commit comments