From a4a0c16b8ebaa9fa70a2d92096a892d1d09cdec4 Mon Sep 17 00:00:00 2001 From: davem-bis <68955845+davem-bis@users.noreply.github.com> Date: Wed, 8 Jul 2026 12:48:24 +0100 Subject: [PATCH 1/3] Added dev container definition. Signed-off-by: davem-bis <68955845+davem-bis@users.noreply.github.com> --- .devcontainer/devcontainer.json | 25 ++++++++++++++++++++++ .devcontainer/post-create-command.sh | 15 +++++++++++++ .devcontainer/post-start-command.sh | 32 ++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/post-create-command.sh create mode 100644 .devcontainer/post-start-command.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..a769539194 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,25 @@ +{ + "name": "SQLMesh 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", + "postStartCommand": "bash .devcontainer/post-start-command.sh", + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python", + "ms-python.vscode-pylance" + ] + } + }, + "remoteUser": "vscode" +} diff --git a/.devcontainer/post-create-command.sh b/.devcontainer/post-create-command.sh new file mode 100644 index 0000000000..7104c5bd99 --- /dev/null +++ b/.devcontainer/post-create-command.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# This script is intended to be run by an Ubuntu dev container +# The goal is to install OS-level dependencies that are required before trying to install Python dependencies + +echo "Installing Microsoft package repository" + +# ref: https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server +curl -sSL -O https://packages.microsoft.com/config/ubuntu/$(grep VERSION_ID /etc/os-release | cut -d '"' -f 2)/packages-microsoft-prod.deb +sudo dpkg -i packages-microsoft-prod.deb +rm packages-microsoft-prod.deb + +$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 \ No newline at end of file diff --git a/.devcontainer/post-start-command.sh b/.devcontainer/post-start-command.sh new file mode 100644 index 0000000000..afcfe6f711 --- /dev/null +++ b/.devcontainer/post-start-command.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# This script is intended to be run by an Ubuntu dev container +# The goal is to ensure that symlinks are appropriately set in git, and that development dependencies are installed. + +# Check current value of core.symlinks +current_value =$(git config --get core.symlinks) + +if [ "$current_value" != "true "]; then + echo "core.symlinks is '$current_value', setting to true." + git confit core.symlinks true + + # Detect all symlinks tracked in git and refresh them. + symlinks=$(git ls-files -s | awk '/^120000/ {print $4}') + if [ -n "$symlinks" ]; then + count=$(echo "$symlinks" | wc -l) + echo "Found $count symlink(s). Refreshing now..." + + # Pass all paths to git checkout at once + echo "$symlinks" | xargs git checkout HEAD -- + + echo "Successfully refreshed all symlinks via Git." + else + echo "No symlinks found in this Git repository." + fi +else + echo "core.symlinks is '$current_value'." +fi + + +# Ensure development dependencies are installed +make install-dev \ No newline at end of file From 2276b3b05885d78e2833d93daa42696b0c872b9e Mon Sep 17 00:00:00 2001 From: davem-bis <68955845+davem-bis@users.noreply.github.com> Date: Wed, 8 Jul 2026 15:59:06 +0100 Subject: [PATCH 2/3] Move symlink details into documentation, as opposed to in post start command in devcontainer. Signed-off-by: davem-bis <68955845+davem-bis@users.noreply.github.com> --- .devcontainer/devcontainer-lock.json | 24 +++++++++++++++++++++ .devcontainer/devcontainer.json | 1 - .devcontainer/post-create-command.sh | 14 +++++------- .devcontainer/post-start-command.sh | 32 ---------------------------- docs/development.md | 14 ++++++++++++ 5 files changed, 43 insertions(+), 42 deletions(-) create mode 100644 .devcontainer/devcontainer-lock.json delete mode 100644 .devcontainer/post-start-command.sh diff --git a/.devcontainer/devcontainer-lock.json b/.devcontainer/devcontainer-lock.json new file mode 100644 index 0000000000..87c877278f --- /dev/null +++ b/.devcontainer/devcontainer-lock.json @@ -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" + } + } +} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a769539194..0ad110f6ec 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -12,7 +12,6 @@ "ghcr.io/devcontainers/features/docker-in-docker:4": {} }, "postCreateCommand": "bash .devcontainer/post-create-command.sh", - "postStartCommand": "bash .devcontainer/post-start-command.sh", "customizations": { "vscode": { "extensions": [ diff --git a/.devcontainer/post-create-command.sh b/.devcontainer/post-create-command.sh index 7104c5bd99..1726b7d3cd 100644 --- a/.devcontainer/post-create-command.sh +++ b/.devcontainer/post-create-command.sh @@ -1,15 +1,11 @@ #!/bin/bash # This script is intended to be run by an Ubuntu dev container -# The goal is to install OS-level dependencies that are required before trying to install Python dependencies -echo "Installing Microsoft package repository" +# Install OS-level dependencies +$ALL_DEPENDENCIES = "libpq-dev netcat-traditional unixodbc-dev default-jdk msodbcsql18 libodbc" -# ref: https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server -curl -sSL -O https://packages.microsoft.com/config/ubuntu/$(grep VERSION_ID /etc/os-release | cut -d '"' -f 2)/packages-microsoft-prod.deb -sudo dpkg -i packages-microsoft-prod.deb -rm packages-microsoft-prod.deb +sudo apt-get clean && sudo apt-get -y update && sudo ACCEPT_EULA='Y' apt-get -y install $ALL_DEPENDENCIES -$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 \ No newline at end of file +# Install Python dependencies +make install-dev \ No newline at end of file diff --git a/.devcontainer/post-start-command.sh b/.devcontainer/post-start-command.sh deleted file mode 100644 index afcfe6f711..0000000000 --- a/.devcontainer/post-start-command.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -# This script is intended to be run by an Ubuntu dev container -# The goal is to ensure that symlinks are appropriately set in git, and that development dependencies are installed. - -# Check current value of core.symlinks -current_value =$(git config --get core.symlinks) - -if [ "$current_value" != "true "]; then - echo "core.symlinks is '$current_value', setting to true." - git confit core.symlinks true - - # Detect all symlinks tracked in git and refresh them. - symlinks=$(git ls-files -s | awk '/^120000/ {print $4}') - if [ -n "$symlinks" ]; then - count=$(echo "$symlinks" | wc -l) - echo "Found $count symlink(s). Refreshing now..." - - # Pass all paths to git checkout at once - echo "$symlinks" | xargs git checkout HEAD -- - - echo "Successfully refreshed all symlinks via Git." - else - echo "No symlinks found in this Git repository." - fi -else - echo "core.symlinks is '$current_value'." -fi - - -# Ensure development dependencies are installed -make install-dev \ No newline at end of file diff --git a/docs/development.md b/docs/development.md index ff8b250d87..9fc6a9725b 100644 --- a/docs/development.md +++ b/docs/development.md @@ -11,6 +11,20 @@ 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: + +* Python functionality (e.g. `SIGUSR1`) that is only available on UNIX systems, and; +* Symbolic links, which whilst available on Windows, are more involved that on Linux or MacOS. + +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: + +- The git configuration `core.symlinks` is set to `true` +- The process that git runs as is permitted to create symbolic links. This can be done via running git as an administrator, or enabling developer mode on Windows. + ## Virtual environment setup We do recommend using a virtual environment to develop SQLMesh. From 917829a19ea7f069e08e2c46031947940d1b5e70 Mon Sep 17 00:00:00 2001 From: davem-bis <68955845+davem-bis@users.noreply.github.com> Date: Thu, 9 Jul 2026 14:28:51 +0100 Subject: [PATCH 3/3] Corrected post create command syntax and updated documentation. Signed-off-by: davem-bis <68955845+davem-bis@users.noreply.github.com> --- .devcontainer/devcontainer.json | 2 +- .devcontainer/post-create-command.sh | 2 +- docs/development.md | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0ad110f6ec..d0c250eb41 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,5 +1,5 @@ { - "name": "SQLMesh Dev", + "name": "SQLMesh Python Dev", "image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04", "features": { "ghcr.io/devcontainers/features/common-utils:2": {}, diff --git a/.devcontainer/post-create-command.sh b/.devcontainer/post-create-command.sh index 1726b7d3cd..c305651379 100644 --- a/.devcontainer/post-create-command.sh +++ b/.devcontainer/post-create-command.sh @@ -3,7 +3,7 @@ # This script is intended to be run by an Ubuntu dev container # Install OS-level dependencies -$ALL_DEPENDENCIES = "libpq-dev netcat-traditional unixodbc-dev default-jdk msodbcsql18 libodbc" +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 diff --git a/docs/development.md b/docs/development.md index 9fc6a9725b..bd33c5b675 100644 --- a/docs/development.md +++ b/docs/development.md @@ -16,14 +16,14 @@ Before you begin, ensure you have the following installed on your machine. Exact The development environment of SQLMesh depends both on: * Python functionality (e.g. `SIGUSR1`) that is only available on UNIX systems, and; -* Symbolic links, which whilst available on Windows, are more involved that on Linux or MacOS. +* Symbolic links in the repository which, whilst available on Windows, typically require additional permissions for the process running git. 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: +For symbolic links, you must ensure that when checking out the repository: - The git configuration `core.symlinks` is set to `true` -- The process that git runs as is permitted to create symbolic links. This can be done via running git as an administrator, or enabling developer mode on Windows. +- 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). ## Virtual environment setup