Skip to content

Commit 19cd73a

Browse files
authored
feat: Add Development Container and Windows specific development pre-requisites (#5894)
Signed-off-by: davem-bis <68955845+davem-bis@users.noreply.github.com>
1 parent 86cd3b7 commit 19cd73a

4 files changed

Lines changed: 91 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"features": {
3+
"ghcr.io/devcontainers/features/common-utils:2": {
4+
"version": "2.5.9",
5+
"resolved": "ghcr.io/devcontainers/features/common-utils@sha256:cb0c4d3c276f157eed17935747e364178d75fee17f55c4e129966f64633deb3a",
6+
"integrity": "sha256:cb0c4d3c276f157eed17935747e364178d75fee17f55c4e129966f64633deb3a"
7+
},
8+
"ghcr.io/devcontainers/features/docker-in-docker:4": {
9+
"version": "4.0.0",
10+
"resolved": "ghcr.io/devcontainers/features/docker-in-docker@sha256:4fa87399214366e320d489991769c4f3f461e1ffe461f54eea78a41b34945bb5",
11+
"integrity": "sha256:4fa87399214366e320d489991769c4f3f461e1ffe461f54eea78a41b34945bb5"
12+
},
13+
"ghcr.io/devcontainers/features/java:1": {
14+
"version": "1.8.1",
15+
"resolved": "ghcr.io/devcontainers/features/java@sha256:8157bab2d8d71e40b2f3128c162fab763e2b11038fdd33784549290a5d386b48",
16+
"integrity": "sha256:8157bab2d8d71e40b2f3128c162fab763e2b11038fdd33784549290a5d386b48"
17+
},
18+
"ghcr.io/devcontainers/features/python:1": {
19+
"version": "1.8.0",
20+
"resolved": "ghcr.io/devcontainers/features/python@sha256:fbcad6955caeecc5ad3f7886baf652e25cba5225a6c4c2287c536de2e5607511",
21+
"integrity": "sha256:fbcad6955caeecc5ad3f7886baf652e25cba5225a6c4c2287c536de2e5607511"
22+
}
23+
}
24+
}

.devcontainer/devcontainer.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "SQLMesh Python Dev",
3+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
4+
"features": {
5+
"ghcr.io/devcontainers/features/common-utils:2": {},
6+
"ghcr.io/devcontainers/features/python:1": {
7+
"version": "3.12"
8+
},
9+
"ghcr.io/devcontainers/features/java:1": {
10+
"version": "21"
11+
},
12+
"ghcr.io/devcontainers/features/docker-in-docker:4": {}
13+
},
14+
"postCreateCommand": "bash .devcontainer/post-create-command.sh",
15+
"customizations": {
16+
"vscode": {
17+
"extensions": [
18+
"ms-python.python",
19+
"ms-python.vscode-pylance"
20+
]
21+
}
22+
},
23+
"remoteUser": "vscode"
24+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
# This script is intended to be run by an Ubuntu development container
4+
5+
# Exit immediately if any command returns a non-zero code
6+
set -e
7+
8+
# Install OS-level dependencies
9+
10+
## Ensure that the Microsoft package repository is available as it is required for msodbcsql18. Note that the repository
11+
## may have already been added by a development container feature (e.g. docker-in-docker or java).
12+
if apt-cache policy | grep -q 'packages.microsoft.com'; then
13+
echo "Microsoft package repository already present"
14+
else
15+
echo "Microsoft package repository not present, it will be added."
16+
17+
# ref: https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server
18+
curl -sSL -O https://packages.microsoft.com/config/ubuntu/$(grep VERSION_ID /etc/os-release | cut -d '"' -f 2)/packages-microsoft-prod.deb
19+
sudo dpkg -i packages-microsoft-prod.deb
20+
rm packages-microsoft-prod.deb
21+
fi
22+
23+
ALL_DEPENDENCIES="libpq-dev netcat-traditional unixodbc-dev default-jdk msodbcsql18"
24+
sudo apt-get clean && sudo apt-get -y update && sudo ACCEPT_EULA='Y' apt-get -y install $ALL_DEPENDENCIES
25+
26+
# Install Python dependencies
27+
make install-dev

docs/development.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ Before you begin, ensure you have the following installed on your machine. Exact
1111
* OpenJDK >= 11
1212
* Python >= 3.9 < 3.13
1313

14+
### Windows Prerequisites
15+
16+
The development environment of SQLMesh depends both on:
17+
18+
* Symbolic links in the repository which, whilst available on Windows, typically require additional permissions for the process running git, and;
19+
* 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.
20+
21+
For the Python functionality, a development container is provided to develop against Ubuntu 24 with Python 3.12.
22+
23+
For symbolic links, you must ensure that when checking out the repository:
24+
25+
* The git configuration `core.symlinks` is set to `true` (this also needs to be done before bind mount, i.e. when the development container is started)
26+
* 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).
27+
28+
Development 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 development containers](https://code.visualstudio.com/docs/devcontainers/tutorial).
29+
1430
## Virtual environment setup
1531

1632
We do recommend using a virtual environment to develop SQLMesh.

0 commit comments

Comments
 (0)