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

pyjwt 2.0.0 is not compatible with Python 3.5 #585

Closed
xupefei opened this issue Dec 23, 2020 · 6 comments · Fixed by #592
Closed

pyjwt 2.0.0 is not compatible with Python 3.5 #585

xupefei opened this issue Dec 23, 2020 · 6 comments · Fixed by #592

Comments

@xupefei
Copy link
Contributor

xupefei commented Dec 23, 2020

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: PyGithub/PyGithub#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.

@jpadilla
Copy link
Owner

Let's surface this in the changelog #532

@asottile
Copy link

@xupefei python_requires is set properly in the metadata -- this likely means you're using a too-old version of pip and/or using easy_install to install the library:

python_requires = >=3.6

@xupefei
Copy link
Contributor Author

xupefei commented Dec 26, 2020

@asottile I believe so. I'm using python3-pip from Ubuntu 16.04 (version 8.1.1), and unfortunately unable to upgrade :(

@asottile
Copy link

asottile commented 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

@auvipy
Copy link
Collaborator

auvipy commented Dec 28, 2020

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

@clokep
Copy link

clokep commented Dec 29, 2020

It would be nice to specify in setup.py that Python > 3.6 is required (via the python_requires option). This will help people to not install an incompatible version.

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