Skip to content

pyjwt 2.0.0 is not compatible with Python 3.5 #585

@xupefei

Description

@xupefei

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions