Skip to content

Make azure-identity an optional dependency #862

Open

Description

@oscarrobertson

mssql-python declares azure-identity>=1.12.0 as a hard runtime dependency on both PyPI and the microsoft conda channel, but only imports it lazily inside the Entra ID auth paths (auth.py, db_connection.py). SQL auth and Kerberos users never load it.

On PyPI this costs seven small pure-Python wheels. On conda it is far worse: the conda-forge azure-core and msal_extensions recipes declare runtime dependencies the wheels do not (flask, pygobject, libsecret), so azure-identity cascades into ~60 packages and ~350 MB of celery, boto3, cairo and X11 libraries. Installing mssql-python 1.16.0 into a minimal linux-64 env grows it from ~860 MB to ~1.2 GB.

The feedstock problem is not yours to fix, but the only robust fix on your side is to not require azure-identity unconditionally.

Request

Move azure-identity to an extra, matching the existing pyarrow extra:

  • PyPI: pip install mssql-python[azure]
  • conda: drop azure-identity from run: and document it as a user-installed add-on, or publish a mssql-python-azure metapackage

The lazy imports are already in place. The Entra code paths just need a clear ImportError pointing at the extra when it is missing.

Environment: linux-64, conda-forge + microsoft channels, mssql-python 1.16.0.

Activity

  1. github-actions commented on Oct 23, 2026

    @github-actions

    Hi oscarrobertson, thank you for opening this issue!

    Our team will review it shortly. We aim to triage all new issues within 24-48 hours and get back to you.

    If you have additional information to share, please feel free to update the issue.

    Thank you for your patience!

  2. oscarrobertson commented on Oct 23, 2026

    @oscarrobertson
    Author

    Related conda-forge feedstock issues

    The conda bloat comes from two feedstocks, both already reported:

    Even if both land, azure-identity is still a hard dependency most mssql-python users never exercise, so the extra is worth doing regardless.

  3. added
    enhancementNew feature or request
    area: connectivity-authConnection lifecycle, Entra/SP/NTLM auth, tokens, TLS, conn-string parsing, Fabric endpoints.
    dependenciesPull requests that update a dependency file
    on Oct 28, 2026
  4. jahnvi480 commented on Oct 28, 2026

    @jahnvi480
    Contributor

    oscarrobertson Thank you so much for raising this issue. Your ask is genuine and we will have a discussion internally and will try to find out solution for this,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area: connectivity-authConnection lifecycle, Entra/SP/NTLM auth, tokens, TLS, conn-string parsing, Fabric endpoints.dependenciesPull requests that update a dependency fileenhancementNew feature or requesttriage neededFor new issues, not triaged yet.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions