Skip to content

FEAT: Linux Support #110

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

Draft
wants to merge 13 commits into
base: saumya/mac
Choose a base branch
from
Draft

FEAT: Linux Support #110

wants to merge 13 commits into from

Conversation

bewithgaurav
Copy link
Collaborator

@bewithgaurav bewithgaurav commented Jun 27, 2025

Draft PR: NOT FOR REVIEW

ADO Work Item Reference

AB#34978


Summary

This pull request introduces significant updates to the pr-validation-pipeline.yml file and the mssql_python module, focusing on streamlining pipeline jobs, improving cross-platform compatibility, and removing deprecated code. The most important changes include removing Windows-specific pipeline jobs, enhancing support for Linux in build scripts, and simplifying the mssql_python module by eliminating platform-specific code.

Pipeline Updates:

Cross-Platform Compatibility:

  • Updated the build.sh script to support both macOS and Linux, including dynamic OS detection and corresponding build configurations. (mssql_python/pybind/build.sh, [1] [2] [3]
  • Enhanced ddbc_bindings.py to handle Linux architectures (x86_64 and arm64) and raise errors for unsupported architectures. (mssql_python/ddbc_bindings.py, mssql_python/ddbc_bindings.pyR15-R21)

Codebase Simplification:

  • Removed the connection_mac.py file entirely, consolidating platform-specific connection logic into a single connection.py file. (mssql_python/connection_mac.py, mssql_python/connection_mac.pyL1-L327)
  • Simplified CMakeLists.txt by removing macOS-specific source file handling and using a unified source file for all platforms. (mssql_python/pybind/CMakeLists.txt, mssql_python/pybind/CMakeLists.txtL181-R185)

@Copilot Copilot AI review requested due to automatic review settings June 27, 2025 06:25
@bewithgaurav bewithgaurav changed the base branch from main to saumya/mac June 27, 2025 06:25
Copy link
Contributor

@Copilot Copilot AI left a 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 PR implements Linux support by unifying build scripts and ODBC bindings across macOS and Linux, removes Windows-specific pipeline jobs, and consolidates platform-specific modules.

  • Removes Windows-only pipeline job and Docker-based macOS steps, streamlining CI.
  • Updates build scripts (build.sh, CMakeLists) and Python module loader for Linux.
  • Consolidates and refactors ODBC binding code to be cross-platform and drops deprecated files.

Reviewed Changes

Copilot reviewed 15 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/test_003_connection.py Added pooling performance and basic tests
mssql_python/pybind/mac_utils.h Expanded platform guard to include Linux
mssql_python/pybind/mac_utils.cpp Unified macOS/Linux utility definitions
mssql_python/pybind/ddbc_bindings.h Introduced cross-platform dynamic loader and converters
mssql_python/pybind/ddbc_bindings.cpp Refactored driver loading, logging, and removed Windows includes
mssql_python/pybind/build.sh Extended build script to detect Linux and macOS
mssql_python/pybind/CMakeLists.txt Removed macOS-only source branching
mssql_python/ddbc_bindings.py Added Linux architecture mapping
mssql_python/db_connection.py Simplified imports to unified connection module
eng/pipelines/pr-validation-pipeline.yml Dropped Windows job, simplified macOS job
Comments suppressed due to low confidence (3)

tests/test_003_connection.py:221

  • [nitpick] In test_connection_pooling_basic, catching Exception without asserting expected failure leaves the test unclear. Use pytest.raises to explicitly verify that acquiring a third connection exceeds the pool limit.
    except Exception as e:

mssql_python/pybind/mac_utils.cpp:4

  • [nitpick] The comment refers to a header, but this is a .cpp file. Update the comment to correctly describe the implementation file.
// This header defines utility functions for safely handling SQLWCHAR-based

mssql_python/pybind/ddbc_bindings.h:68

  • The file mac_buffers.h is included but not present in the diff. Ensure this header exists or remove the include to prevent compilation errors.
#include "mac_buffers.h"  // For macOS-specific buffer handling

@@ -10,7 +18,7 @@

namespace py = pybind11;

#if defined(__APPLE__)
#if defined(__APPLE__) || defined(__linux__)
Copy link
Preview

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The filename mac_utils.h suggests macOS-only utilities, but it now includes Linux logic. Consider renaming to os_utils.h or similar to reflect cross-platform support.

Copilot uses AI. Check for mistakes.

Comment on lines 645 to 646
std::cout << "Detected platform: " << platformName << std::endl;
std::cout << "Detected driver file name: " << driverFileName << std::endl;
Copy link
Preview

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Avoid using std::cout in library code; switch to the LOG() function or a dedicated logger for consistent, configurable output.

Suggested change
std::cout << "Detected platform: " << platformName << std::endl;
std::cout << "Detected driver file name: " << driverFileName << std::endl;
LOG("Detected platform: {}", platformName);
LOG("Detected driver file name: {}", driverFileName);

Copilot uses AI. Check for mistakes.

message(STATUS "Using standard source file: ${DDBC_SOURCE}")
# Include connection module for Windows
add_library(ddbc_bindings MODULE ${DDBC_SOURCE} connection/connection.cpp connection/connection_pool.cpp)
# endif()
Copy link
Preview

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a commented '# endif()' without a matching 'if' block. Remove or correct this leftover comment to avoid confusion.

Suggested change
# endif()

Copilot uses AI. Check for mistakes.

@bewithgaurav bewithgaurav mentioned this pull request Jun 27, 2025
1 task
@bewithgaurav bewithgaurav marked this pull request as draft June 27, 2025 06:27
@bewithgaurav
Copy link
Collaborator Author

/azp run

Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@bewithgaurav bewithgaurav changed the base branch from saumya/mac to main June 30, 2025 19:55
@bewithgaurav bewithgaurav changed the base branch from main to saumya/mac June 30, 2025 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant