CHORE: Gate PRs on strict mssql_python typing - #827
Jahnvi Thakkar (jahnvi480) wants to merge 1 commit into
Conversation
AB#45120 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
PR Performance Report✅ No regression detectedNo consistent slowdowns detected across all 2 environments. 0 IMPROVEMENTS 0 SLOWDOWNS 2/2 ENVIRONMENTS Coverage: 2 of 2 environments completed. Advisory result; does not block merging. Performance diagnosticsPhase times are inclusive diagnostics and must not be added together. They identify where measured time changed, not why it changed. No affected phases or call-count changes were recorded. All database tasks and timingsUnix / SQL Server 2022
Unix / SQL Server 2025
Build and measurement detailsPR head:
A consistent change requires more than 20% median paired movement, at least 1 ms between the median runtimes, and at least 80% of pairs exceeding the relative threshold in the same direction. A slowdown without enough pair agreement is reported as inconsistent. The displayed change is the median of paired before-and-after ratios. It is not recalculated from the two displayed median runtimes. Both revisions use profiling-enabled builds on the same agent and database, with alternating order and discarded warmups. Results are diagnostic and do not represent production-wheel latency. Raw samples and logs are attached to the ADO run as |
📊 Code Coverage Report
Diff CoverageDiff: main...HEAD, staged and unstaged changes
Summary
📋 Files Needing Attention📉 Files with overall lowest coverage (click to expand)mssql_python.pybind.performance_counter.hpp: 0.7%
mssql_python.pybind.logger_bridge.cpp: 57.9%
mssql_python.pybind.ddbc_bindings.h: 62.6%
mssql_python.pybind.logger_bridge.hpp: 70.8%
mssql_python.pybind.ddbc_bindings.cpp: 79.3%
mssql_python.pybind.connection.connection_pool.cpp: 82.3%
mssql_python.pybind.connection.connection.cpp: 83.1%
mssql_python.logging.py: 86.2%
mssql_python.pooling.py: 90.1%
mssql_python.pybind.fetch_temporal.hpp: 92.1%🔗 Quick Links
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Decimal column inference still accepts singleton and mixed-type non-finite values.
Review effort: Balanced
Findings: 1
What changed in this PR
This PR adds a blocking strict-typing gate for mssql_python to PR validation and aligns the driver’s type declarations with its Python and native interfaces.
Changes:
- Add a package-scoped mypy harness and run it in the Ubuntu PR-validation job.
- Add native-interface stubs, source annotations, and targeted regression tests.
- Update packaging and contributor guidance for the typing gate.
| File | Description |
|---|---|
| tests/test_typing.py | Adds the strict-typing harness. |
| tests/test_005_connection_cursor_lifecycle.py | Tests closed-connection guards. |
| tests/test_004_cursor.py | Adds Decimal and row regression checks. |
| tests/test_004_cursor_arrow.py | Tests Arrow reader cleanup. |
| tests/test_000_dependencies.py | Checks declaration and runtime exports. |
| setup.py | Packages stub files. |
| requirements.txt | Adds pinned mypy and typing stubs. |
| pytest.ini | Separates typing checks from default tests. |
| mssql_python/type.py | Annotates DB-API type objects. |
| mssql_python/row.py | Annotates rows and mapping access. |
| mssql_python/pooling.py | Annotates pooling shutdown. |
| mssql_python/perf_timer.py | Types profiler results and methods. |
| mssql_python/parameter_helper.py | Types parameter conversion. |
| mssql_python/mssql_python.pyi | Aligns public API declarations. |
| mssql_python/logging.py | Annotates logging APIs. |
| mssql_python/helpers.py | Types connection-string translation. |
| mssql_python/exceptions.py | Types exception reconstruction. |
| mssql_python/decimal_config.py | Types decimal-setting callbacks. |
| mssql_python/ddbc_bindings.py | Types the native loader boundary. |
| mssql_python/db_connection.py | Clarifies the connection re-export. |
| mssql_python/cursor.py | Annotates cursor paths and adds guards. |
| mssql_python/constants.py | Declares dynamic constant types. |
| mssql_python/connection.py | Annotates connection state and guards. |
| mssql_python/auth.py | Types credential and token handling. |
| mssql_python/async_query/exception_translator.py | Types exception classification. |
| mssql_python/async_query/async_fetch.py | Types the native cursor accessor. |
| mssql_python/async_query/async_cursor.py | Types the async cursor wrapper. |
| mssql_python/async_query/async_connection.py | Types the async connection wrapper. |
| mssql_python/async_query/_native.py | Types native-core loading. |
| mssql_python/async_query/__init__.py | Clarifies async re-exports. |
| mssql_python/_pycore_types.pyi | Declares Rust-core interfaces. |
| mssql_python/_ddbc_types.pyi | Declares C++ binding interfaces. |
| mssql_python/__init__.py | Annotates package helpers. |
| eng/pipelines/pr-validation-pipeline.yml | Adds the blocking typing job step. |
| CONTRIBUTING.md | Documents the typing workflow. |
| .github/prompts/run-tests.prompt.md | Documents how to run typing checks. |
| .github/copilot-instructions.md | Updates validation guidance. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| return columnwise, row_count | ||
|
|
||
| def _compute_column_type(self, column): | ||
| def _compute_column_type( |

Work Item / Issue Reference
Summary
Add a blocking strict-mypy check to the existing Ubuntu PR-validation
job, targeting only Python source and stubs under mssql_python.
Exclude tests and mssql_python_odbc from this typing gate while
preserving existing runtime test jobs.
Resolve driver typing diagnostics, add native-interface declarations,
and align public stubs, packaging, documentation, and regression coverage.
Draft follow-up: refresh the Linux dependency lockfile; the current
attempt is blocked by PyPI TLS connection failures.