Skip to content
24 changes: 24 additions & 0 deletions .devcontainer/devcontainer-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"version": "2.5.9",
"resolved": "ghcr.io/devcontainers/features/common-utils@sha256:cb0c4d3c276f157eed17935747e364178d75fee17f55c4e129966f64633deb3a",
"integrity": "sha256:cb0c4d3c276f157eed17935747e364178d75fee17f55c4e129966f64633deb3a"
},
"ghcr.io/devcontainers/features/docker-in-docker:4": {
"version": "4.0.0",
"resolved": "ghcr.io/devcontainers/features/docker-in-docker@sha256:4fa87399214366e320d489991769c4f3f461e1ffe461f54eea78a41b34945bb5",
"integrity": "sha256:4fa87399214366e320d489991769c4f3f461e1ffe461f54eea78a41b34945bb5"
},
"ghcr.io/devcontainers/features/java:1": {
"version": "1.8.0",
"resolved": "ghcr.io/devcontainers/features/java@sha256:9663ce0219ff85786e87901ce5f0a59f488edd5f99b46015192cda48468b233a",
"integrity": "sha256:9663ce0219ff85786e87901ce5f0a59f488edd5f99b46015192cda48468b233a"
},
"ghcr.io/devcontainers/features/python:1": {
"version": "1.8.0",
"resolved": "ghcr.io/devcontainers/features/python@sha256:fbcad6955caeecc5ad3f7886baf652e25cba5225a6c4c2287c536de2e5607511",
"integrity": "sha256:fbcad6955caeecc5ad3f7886baf652e25cba5225a6c4c2287c536de2e5607511"
}
}
}
24 changes: 24 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "SQLMesh Python Dev",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {},
"ghcr.io/devcontainers/features/python:1": {
"version": "3.12"
},
"ghcr.io/devcontainers/features/java:1": {
"version": "21"
},
"ghcr.io/devcontainers/features/docker-in-docker:4": {}
},
"postCreateCommand": "bash .devcontainer/post-create-command.sh",
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance"
]
}
},
"remoteUser": "vscode"
}
17 changes: 17 additions & 0 deletions .devcontainer/post-create-command.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# This script is intended to be run by an Ubuntu dev container

# Exit immediately if any command returns a non-zero code
set -e

# Install OS-level dependencies

# Note that msodbcsql18 install requires the Microsoft APT repo to be available to this script. If this script is used
# in conjunction with a container image from the Microsoft container registry this should already be the case.
ALL_DEPENDENCIES="libpq-dev netcat-traditional unixodbc-dev default-jdk msodbcsql18"

sudo apt-get clean && sudo apt-get -y update && sudo ACCEPT_EULA='Y' apt-get -y install $ALL_DEPENDENCIES

# Install Python dependencies
make install-dev
16 changes: 16 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@ Before you begin, ensure you have the following installed on your machine. Exact
* OpenJDK >= 11
* Python >= 3.9 < 3.13

### Windows Prerequisites

The development environment of SQLMesh depends both on:

* Symbolic links in the repository which, whilst available on Windows, typically require additional permissions for the process running git, and;
* Some Python functionality (e.g. `SIGUSR1`) that is only available on UNIX systems. Whilst this functionality is gated so shouldn't error on Windows, the development container enables its use.

For the Python functionality, a dev container is provided to develop against Ubuntu 24 with Python 3.12.

For symbolic links, you must ensure that when checking out the repository:

* The git configuration `core.symlinks` is set to `true` (this also needs to be done before bind mount, i.e. when the dev container is started)
* The process that git runs as is permitted to create symbolic links. This can typically be done by running git as an administrator, or enabling [developer mode on Windows](https://learn.microsoft.com/en-us/windows/advanced-settings/developer-mode).

Dev containers are supported by [a number of IDEs](https://containers.dev/supporting.html). For developers using VSCode, [Microsoft has a tutorial on how to use dev containers](https://code.visualstudio.com/docs/devcontainers/tutorial).

## Virtual environment setup

We do recommend using a virtual environment to develop SQLMesh.
Expand Down
Loading