matrix-org / matrix-python-sdk

Matrix Client-Server SDK for Python 2 and 3
Apache License 2.0
255 stars 119 forks source link

Add canonicaljson to runtime dependencies #324

Open lndr opened 2 years ago

lndr commented 2 years ago

Describe the bug The module crypto/olm_device.py imports the canonicaljson packages which is not listed in the projects runtime dependencies. When creating a MatrixClient object with encryption=True but missing installation of canonicaljson the resulting ImportError is caught. The further handling of this Error makes it look like python-olm package is not installed.

To Reproduce Steps to reproduce the behavior, with python-olm installed but missing canonicaljson:

  1. Create a MatrixClient object with encryption enabled: from matrix_client.client import MatrixClient client = MatrixClient("http://localhost:8008", encryption=True)

Expected behavior These two lines should result in the creation of a MatrixClient object.

Desktop (please complete the following information):

Additional context This can be fixed by adding 'canonicaljson' to the list started in line 47 in setup.py. Even if the additional packages is only used when encryption is enabled, installing it always seems to be the preferable option, especially because the import error is masked. I'd be willing to create a PR to fix this.