Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing dependency cryptography from version 3.1.0 on #1077

Closed
dev022022 opened this issue Feb 22, 2022 · 3 comments
Closed

Missing dependency cryptography from version 3.1.0 on #1077

dev022022 opened this issue Feb 22, 2022 · 3 comments

Comments

@dev022022
Copy link
Contributor

Hi!

First of all thanks for maintaining this great library!

During migrating from version 3.0.0 to 3.1.0 some days ago I stumbled over an issue with the dependencies. This seems to be caused by the change of the JWT library from jwcrypto to PyJWT.
The difference is that jwcrypto had an explicit dependency to cryptography (see) whereas PyJWT only has an dependency using an extra (see)

This leads for me to the following error after changing to the new github3 version:

2047 | File "/tmp/venv/lib/python3.9/site-packages/github3/github.py", line 1427, in login_as_app 2048 | token = apps.create_token(private_key_pem, app_id, expire_in) 2049 | File "/tmp/venv/lib/python3.9/site-packages/github3/apps.py", line 175, in create_token 2050 | token = jwt.encode( 2051 | File "/tmp/venv/lib/python3.9/site-packages/jwt/api_jwt.py", line 63, in encode 2052 | return api_jws.encode(json_payload, key, algorithm, headers, json_encoder) 2053 | File "/tmp/venv/lib/python3.9/site-packages/jwt/api_jws.py", line 118, in encode 2054 | raise NotImplementedError( 2055 | NotImplementedError: Algorithm 'RS256' could not be found. Do you have cryptography installed?

A possible solution could be to add the extra flag to the dependencies of this project to avoid having the projects using this library being forced to explicitly add cryptography as dependency. This would also be fine from my point of view in respect of the fact that this dependency is not optional for github3.
This would mean changing this part (see):
PyJWT[crypto]>=2.3.0

What do you think?

@sigmavirus24
Copy link
Owner

That makes sense to me. Would you like to send a PR to fix it? I should be able to release it some time today

dev022022 added a commit to dev022022/github3.py that referenced this issue Feb 22, 2022
Add an extra flag for the PyJWT dependency so that the python cryptographic package is an explicit dependency which will be installed automatically together with github3.py. The problem is described in sigmavirus24#1077
@dev022022
Copy link
Contributor Author

Thanks for the feedback. I opened a PR: #1078

@sigmavirus24
Copy link
Owner

Fixed and released! Thanks @dev022022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants