Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Refactor: Remove rsa and make cryptography a core dependency#1771

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
sai-sunder-s wants to merge5 commits intomain
base:main
Choose a base branch
Loading
fromremove-rsa-dependency

Conversation

sai-sunder-s
Copy link
Contributor

This commit removes thersa library as a dependency and makes thecryptography library a required, core dependency.

Previously,cryptography was an optional dependency, and the library would fall back to a pure Python RSA implementation using thersa library ifcryptography was not installed.

Changes made:

  • Modifiedsetup.py to removersa from dependencies and addcryptography with version constraints.
  • Updatedgoogle/auth/crypt/rsa.py to directly use thecryptography-based RSA implementation (_cryptography_rsa.py) and remove the fallback mechanism.
  • Removed the pure Python RSA implementation file (google/auth/crypt/_python_rsa.py).
  • Removed the corresponding tests for the pure Python RSA implementation (tests/crypt/test__python_rsa.py).

Core unit tests pass after these changes.

This commit removes the `rsa` library as a dependency and makes the `cryptography` library a required, core dependency.Previously, `cryptography` was an optional dependency, and the library would fall back to a pure Python RSA implementation using the `rsa` library if `cryptography` was not installed.Changes made:- Modified `setup.py` to remove `rsa` from dependencies and add `cryptography` with version constraints.- Updated `google/auth/crypt/rsa.py` to directly use the `cryptography`-based RSA implementation (`_cryptography_rsa.py`) and remove the fallback mechanism.- Removed the pure Python RSA implementation file (`google/auth/crypt/_python_rsa.py`).- Removed the corresponding tests for the pure Python RSA implementation (`tests/crypt/test__python_rsa.py`).Core unit tests pass after these changes.
@sai-sunder-ssai-sunder-s added the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelMay 23, 2025
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelMay 23, 2025
@sai-sunder-ssai-sunder-s added the owlbot:runAdd this label to trigger the Owlbot post processor. labelMay 28, 2025
@gcf-owl-botgcf-owl-botbot removed the owlbot:runAdd this label to trigger the Owlbot post processor. labelMay 28, 2025
Copy link
Contributor

@partheaparthea left a comment

Choose a reason for hiding this comment

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

LGTM. We should mark this asfix instead ofrefactor so that the change to setup.py is visible in release notes.

fix: add dependency on cryptographyfix: drop dependency on rsa


def autodoc_skip_member_handler(app, what, name, obj, skip, options):
"""
Skips members from internal modules (like _cryptography_rsa or base)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please could you file a bug for issue that requires this docs workaround, even if it will be closed with the changes in this PR. Add a link to the issue in this comment.

if public_obj is obj:
return True # Skip this internal one
except ImportError:
pass # Should not happen if the library is installed
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is not expected to happen, can we just let the error bubble up?

pass # Should not happen if the library is installed

# Handle Signer and Verifier from base
elif name in ("Signer", "Verifier") and hasattr(obj, "__module__"):
Copy link
Contributor

Choose a reason for hiding this comment

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

This code under this block is similar to the above if statement. Is it possible to refactor it?

Comment on lines 25 to 26
# rsa==4.5 is the last version to support 2.7
# https://github.com/sybrenstuvel/python-rsa/issues/152#issuecomment-643470233
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# rsa==4.5 is the last version to support 2.7
# https://github.com/sybrenstuvel/python-rsa/issues/152#issuecomment-643470233

Copy link
Contributor

@partheaparthea left a comment

Choose a reason for hiding this comment

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

Also remove rsa here:

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

@partheapartheaparthea left review comments

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@sai-sunder-s@parthea@yoshi-kokoro

[8]ページ先頭

©2009-2025 Movatter.jp