question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pyjwt 2.0.0 is not compatible with Python 3.5

See original GitHub issue

Summary

pyjwt 2.0.0 is using a syntax only valid in Python 3.6 onwards that breaks Python 3.5 support.

Possible resolutions would be indicating version 2.0.0 available for Python 3.6 onwards in https://github.com/jpadilla/pyjwt/blob/master/CHANGELOG.md.

Ref: https://github.com/PyGithub/PyGithub/issues/1796

Expected Result

No error.

Actual Result

  ...
  File "/ephemeral/jenkins/shared_job_workspace/cb93627ca717/pipeline/xxx/xxx/.venv/lib/python3.5/site-packages/github/__init__.py", line 58, in <module>
    from github.MainClass import Github, GithubIntegration
  File "/ephemeral/jenkins/shared_job_workspace/cb93627ca717/pipeline/xxx/xxx/.venv/lib/python3.5/site-packages/github/MainClass.py", line 57, in <module>
    import jwt
  File "/ephemeral/jenkins/shared_job_workspace/cb93627ca717/pipeline/xxx/xxx/.venv/lib/python3.5/site-packages/jwt/__init__.py", line 1, in <module>
    from .api_jws import (
  File "/ephemeral/jenkins/shared_job_workspace/cb93627ca717/pipeline/xxx/xxx/.venv/lib/python3.5/site-packages/jwt/api_jws.py", line 134
    **kwargs,
            ^
SyntaxError: invalid syntax

Reproduction Steps

Run the following code in Python 3.5 will fail:

def decode(
    self,
    jwt: str,
    key: str,
    algorithms,
    options,
    **kwargs,
) -> str:
	pass
  File "<stdin>", line 7
    **kwargs,
            ^
SyntaxError: invalid syntax
>>> ) -> str:
  File "<stdin>", line 1
    ) -> str:
    ^
SyntaxError: invalid syntax

In comparison, the following code will run in Python 3.5:

def decode(
    self,
    jwt: str,
    key: str,
    algorithms,
    options,
    **kwargs
) -> str:
	pass

System Information

$ python -m jwt.help
{
  "cryptography": {
    "version": ""
  },
  "implementation": {
    "name": "CPython",
    "version": "3.5.10"
  },
  "platform": {
    "release": "5.4.0-1030-aws",
    "system": "Linux"
  },
  "pyjwt": {
    "version": "2.0.0"
  }
}

This command is only available on PyJWT v1.6.3 and greater. Otherwise, please provide some basic information about your system.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
auvipycommented, Dec 28, 2020

python 3.5 is EOL already so not supportd in v2.0 😃

1reaction
asottilecommented, Dec 26, 2020

yeah you need at least pip 9.x – I’d suggest using a virtuaenv either way and not the system pip/python

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changelog — PyJWT 2.0.1 documentation
Version 1.7.1 is the last one supporting Python 3.0-3.5. ... Improve typings¶. We no longer need to use mypy Python 2 compatibility mode...
Read more >
PyJWT - PyPI
JSON Web Token implementation in Python.
Read more >
No matching distribution found for PyJWT<3.0.0,>=2.0.1
So the problem was that when I executed pip --version, it showed python 2.7 version which is deprecated in PyJWT. I solved it...
Read more >
pyjwt Changelog - pyup.io
Skip keys with incompatible alg when loading JWKSet by DaGuich in `762 ... Use timezone package as Python 3.5+ is required. ... 2.0.0....
Read more >
Developers - pyjwt 2.0.0 is not compatible with Python 3.5 -
pyjwt 2.0.0 is not compatible with Python 3.5. ... pyjwt 2.0.0 is using a syntax only valid in Python 3.6 onwards that breaks...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found