You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CHORE: Add standalone mssql-python-odbc package for ODBC driver binaries (#663)
### Work Item / Issue Reference
>
[AB#46217](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/46217)
-------------------------------------------------------------------
### Summary
Splits the ODBC driver binaries out of `mssql-python` into a new
standalone, pure-data package `mssql-python-odbc` (import name
`mssql_python_odbc`, version 18.6.0). This is the code / packaging half
of the split; the ADO release pipelines are in companion PR #664.
#### What is included
- `mssql_python_odbc/__init__.py` - pure-Python package (no native
extension) that ships the ODBC driver `libs/` tree and exposes
`get_driver_path()` and `get_libs_dir()` with the same per-platform
layout the C++ loader expects.
- `setup_odbc.py` - builds the `mssql-python-odbc` wheels. Each wheel is
platform-specific but Python-agnostic (`py3-none-<platform>`), so we
ship 7 wheels total (Windows amd64/arm64, macOS universal2,
manylinux_2_28 x86_64/aarch64, musllinux_1_2 x86_64/aarch64) instead of
a per-Python matrix. On Windows the wheel intentionally ships the VC++
runtime (`vcredist/msvcp140.dll` + license) alongside the driver
binaries - see "VC++ runtime" below.
- `mssql_python/pybind/ddbc_bindings.cpp` -
`LoadDriverOrThrowException()` now resolves the driver / libs base
directory via a new `GetOdbcLibsBaseDir()` helper, which imports
`mssql_python_odbc` when present and falls back to the bundled
`mssql_python` libs when it is not. The fallback is GIL-safe and
Alpine/musl-safe.
- `tests/test_024_odbc_package_split.py` - verifies Python vs C++
driver-path parity.
- `.gitignore` - ignores local `mssql_python_odbc/libs/` build copies
and egg-info.
#### VC++ runtime (`vcredist`) on Windows
The Windows wheel ships `libs/windows/<arch>/vcredist/msvcp140.dll`
(with its license). This is a deliberate, documented choice - **not**
"parity" with the main wheel's file layout, and not a reversal of a
licensing/size decision:
- The main `mssql-python` wheel also ships the VC++ runtime, just
relocated: `build.bat` copies `msvcp140.dll` out of `vcredist/` to the
package root next to the compiled `ddbc_bindings` extension, and
`setup.py` then excludes the now-duplicate `vcredist/` folder. That
exclusion is **de-duplication**, not a removal of the runtime.
- This package has no compiled extension, so there is no package-root
`.pyd` to place the runtime beside. Keeping `msvcp140.dll` in its
original `vcredist/` folder keeps the driver binaries and the runtime
they were built against together, and keeps the wheel self-contained.
- No Phase-2 runtime skew: `msodbcsql18.dll`'s dependency on
`msvcp140.dll` is satisfied in-process by the mssql-python extension
(built `/MD`, which loads `msvcp140.dll` from beside the `.pyd`), so the
external-package and bundled-libs paths behave identically. This copy is
completeness + attribution, which is why `GetOdbcLibsBaseDir()`'s
completeness check verifies the driver + `mssql-auth.dll` but not
`vcredist`.
#### Phasing (no breaking change in this PR)
- Phase 2 (this PR): `mssql-python` prefers the external package but
keeps bundling `libs/` as a fallback, so existing installs keep working.
- Phase 3 (future, v2.0.0): remove the bundled `libs/` and depend on
`mssql-python-odbc` exclusively.
#### Testing
- `test_024` parity suite: 7 passed, 1 skipped.
- Built `mssql_python_odbc-18.6.0-py3-none-win_amd64.whl` locally:
correct wheel tag, `Root-Is-Purelib: false`, driver DLLs present,
`vcredist` (`msvcp140.dll` + license) present, `twine check` passes.
#### Notes
Companion PR (release pipelines): #664. Infra registration (ESRP
onboarding of `mssql-python-odbc`, ADO build-definition id) is tracked
there.
0 commit comments