-
Notifications
You must be signed in to change notification settings - Fork 14
CHORE: Create devcontainer for repo #147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…n of virtual environment
@microsoft-github-policy-service agree company="Microsoft" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request establishes a comprehensive Docker-based development environment for the MSSQL Python Driver project using VS Code devcontainer technology. The setup enables developers to quickly spin up a consistent development environment with all necessary dependencies pre-configured.
- Creates a complete devcontainer configuration with Python 3.10, Microsoft ODBC drivers, and development tools
- Implements automated environment setup through post-creation scripts and Docker configuration
- Adds Docker build optimization through comprehensive file exclusion patterns
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 13 comments.
File | Description |
---|---|
.dockerignore |
Excludes build artifacts, caches, and IDE files from Docker context |
.devcontainer/Dockerfile |
Defines container with Python 3.10, MSSQL drivers, and development tools |
.devcontainer/devcontainer.json |
Configures VS Code settings, extensions, and container features |
.devcontainer/post-create.sh |
Automates post-container setup including dependencies and virtual environment |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some refactoring & optimization comments
pkg-config \ | ||
ninja-build \ | ||
# Additional tools | ||
curl \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the pre-installations are part of the post-create script as well.. just checking, can we maybe remove things from either here or post-create? there might be any redundancies which can add to build time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I will remove the redundant dependencies from Post-create.
The idea is to install the system utils like curl/wget in Dockerfile and keep python / project specific installation in post-create.sh
# Upgrade pip and install common Python development tools | ||
RUN python -m pip install --upgrade pip setuptools wheel \ | ||
&& pip install \ | ||
black \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have the minimum requirements available in requirements.txt
- as seen in post-create script we're using pip install -r requirements.txt
already. we can skip this here/there probably.
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \ | ||
&& curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list \ | ||
&& apt-get update \ | ||
&& ACCEPT_EULA=Y apt-get install -y msodbcsql18 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for odbc installation
*.cmake | ||
|
||
# Build artifacts | ||
*.so |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the .so files for linux odbc, .dylib files for macos odbc and .dll files for windows odbc are needed for build and execution. putting this in gitignore will skip them and remove that from build context. we might need to remove these files from dockerignore.
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
safer to remove lib/ from here as well since lib dirs are present inside odbc directory
Summary
This pull request introduces a comprehensive development environment setup for the MSSQL Python Driver project using a devcontainer. The changes include creating a Docker-based development environment, configuring VS Code for Python development, and adding scripts and files to streamline development workflows. Below are the most important changes grouped by theme:
Devcontainer Setup
Dockerfile
to define the development container, including Python 3.11, essential build tools, Microsoft ODBC Driver for SQL Server, and Python development tools (.devcontainer/Dockerfile
).devcontainer.json
file to configure the container, including VS Code settings, extensions, and features like GitHub CLI and Docker-in-Docker support (.devcontainer/devcontainer.json
).Post-Creation Script
post-create.sh
script to automate environment setup after container creation. This includes installing system dependencies, setting up a Python virtual environment, and configuring useful aliases (.devcontainer/post-create.sh
).Development Workflow Enhancements
.dockerignore
file to exclude unnecessary files and directories from the Docker build context, such as Python caches, build artifacts, and IDE-specific files (.dockerignore
).Impact:
With this, any developer can spin up a Github code space and work in a dev container, without needing all the steps for an environment setup.
Docker in docker plugin for dev container even allows SQL in docker to run in the devcontainer, for local testing
Fixes #146