Skip to content

[Identity] Update dev dependencies for broker package#41554

Merged
pvaneck merged 1 commit intoAzure:mainfrom
pvaneck:identity-broker-cov
Jun 13, 2025
Merged

[Identity] Update dev dependencies for broker package#41554
pvaneck merged 1 commit intoAzure:mainfrom
pvaneck:identity-broker-cov

Conversation

@pvaneck
Copy link
Member

@pvaneck pvaneck commented Jun 12, 2025

In the azure-identity-broker project, pytest-cov doesn't seem to like the latest versions of cryptography yielding errors like:

.tox/whl/lib/python3.9/site-packages/azure/identity/_internal/aad_client.py:11: in <module>
    from .aad_client_base import AadClientBase
.tox/whl/lib/python3.9/site-packages/azure/identity/_internal/aad_client_base.py:20: in <module>
    from .aadclient_certificate import AadClientCertificate
.tox/whl/lib/python3.9/site-packages/azure/identity/_internal/aadclient_certificate.py:7: in <module>
    from cryptography import x509
.tox/whl/lib/python3.9/site-packages/cryptography/x509/__init__.py:7: in <module>
    from cryptography.x509 import certificate_transparency, verification
.tox/whl/lib/python3.9/site-packages/cryptography/x509/certificate_transparency.py:8: in <module>
    from cryptography.hazmat.bindings._rust import x509 as rust_x509
E   ImportError: PyO3 modules compiled for CPython 3.8 or older may only be initialized once per interpreter process

This has been causing our pipelines to fail for a while, Not sure why exactly, but let's just pin cryptography for Python 3.9.

@pvaneck pvaneck force-pushed the identity-broker-cov branch from ef5127c to 816ce23 Compare June 12, 2025 18:58
@pvaneck pvaneck changed the title [Identity] Disable coverage for broker package [Identity] Update dev dependencies for broker package Jun 12, 2025
`pytest-cov` and the latest versions of `cryptography` don't seem to
play nice on Python 3.9. Let's just pin cryptography for Python 3.9.

Signed-off-by: Paul Van Eck <paulvaneck@microsoft.com>
@pvaneck pvaneck force-pushed the identity-broker-cov branch from 816ce23 to ddae348 Compare June 12, 2025 22:42
@pvaneck pvaneck marked this pull request as ready for review June 12, 2025 23:29
Copilot AI review requested due to automatic review settings June 12, 2025 23:29
@pvaneck pvaneck requested review from a team and xiangyan99 as code owners June 12, 2025 23:29
Copy link
Contributor

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 pins the cryptography dependency to <45.0.0 for Python versions below 3.10 to work around pytest-cov import issues on Python 3.9.

  • Added version constraint for cryptography in dev requirements
Comments suppressed due to low confidence (1)

sdk/identity/azure-identity-broker/dev_requirements.txt:5

  • [nitpick] Consider adding a comment above this line explaining why cryptography is pinned to <45.0.0 for Python <3.10 (e.g., to avoid the PyO3 import error in pytest-cov on Python 3.9).
cryptography<45.0.0; python_version < "3.10"

@pvaneck pvaneck merged commit 6eaefc3 into Azure:main Jun 13, 2025
46 checks passed
@pvaneck pvaneck deleted the identity-broker-cov branch June 13, 2025 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

3 participants