|
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 | + |
| 29 | +Optionally, you can use pre-commit to automatically run linters/formatters: |
| 30 | + |
| 31 | +```bash |
| 32 | +make install-pre-commit |
| 33 | +``` |
| 34 | + |
| 35 | +## Python development |
| 36 | + |
16 | 37 | Run linters and formatters: |
| 38 | + |
17 | 39 | ```bash |
18 | 40 | make style |
19 | 41 | ``` |
| 42 | + |
20 | 43 | Run faster tests for quicker local feedback: |
| 44 | + |
21 | 45 | ```bash |
22 | 46 | make fast-test |
23 | 47 | ``` |
| 48 | + |
24 | 49 | Run more comprehensive tests that run on each commit: |
| 50 | + |
25 | 51 | ```bash |
26 | 52 | make slow-test |
27 | 53 | ``` |
| 54 | + |
28 | 55 | Run Airflow tests that will run when PR is merged to main: |
| 56 | + |
29 | 57 | ```bash |
30 | 58 | make airflow-docker-test-with-env |
31 | 59 | ``` |
32 | | -Install docs dependencies: |
| 60 | + |
| 61 | +## Documentation |
| 62 | + |
| 63 | +In order to run the documentation server, you will need to install the dependencies by running the following command. |
| 64 | + |
33 | 65 | ```bash |
34 | 66 | make install-doc |
35 | 67 | ``` |
36 | | -Run docs server: |
| 68 | + |
| 69 | +Once you have installed the dependencies, you can run the documentation server by running the following command. |
| 70 | + |
37 | 71 | ```bash |
38 | 72 | make docs-serve |
39 | 73 | ``` |
| 74 | + |
40 | 75 | Run docs tests: |
| 76 | + |
41 | 77 | ```bash |
42 | 78 | make doc-test |
43 | 79 | ``` |
| 80 | + |
| 81 | +## UI development |
| 82 | + |
| 83 | +In addition to the Python development, you can also develop the UI. |
| 84 | + |
| 85 | +The UI is built using React and Typescript. To run the UI, you will need to install the dependencies by running the following command. |
| 86 | + |
| 87 | +```bash |
| 88 | +npm install |
| 89 | +``` |
| 90 | + |
44 | 91 | Run ide: |
| 92 | + |
45 | 93 | ```bash |
46 | 94 | make ui-up |
47 | 95 | ``` |
48 | | -(Optional) Use pre-commit to automatically run linters/formatters: |
49 | | -```bash |
50 | | -make install-pre-commit |
| 96 | + |
| 97 | +## Developing the VSCode extension |
| 98 | + |
| 99 | +Developing the VSCode extension is most easily done by launching the debug process from a visual studio code workspace. |
| 100 | + |
| 101 | +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. |
| 102 | + |
| 103 | +Please see the below diagram for a high level overview of the UI. |
| 104 | + |
| 105 | +```mermaid |
| 106 | +graph TD |
| 107 | + A[VSCode Extension] --> |start server| B[SQLMesh Server] |
| 108 | + A --> |creates webviews| C[Webviews] |
| 109 | + C --> |reads react webpages from| B |
| 110 | + A --> |calls lsp| B |
| 111 | + React[React App] --> |embedded in| B |
| 112 | +``` |
| 113 | + |
| 114 | +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. |
| 115 | + |
| 116 | +This makes the architecture diagram at development time look like the following. |
| 117 | + |
| 118 | +```mermaid |
| 119 | +graph TD |
| 120 | + A[VSCode Extension] --> |start server| B[SQLMesh Server] |
| 121 | + A --> |creates webviews| C[Webviews] |
| 122 | + React [React Server] --> |passes on api requests| B |
| 123 | + C --> |reads react webpages from| React |
51 | 124 | ``` |
0 commit comments