Skip to content

Add canonicaljson to runtime dependencies #324

@lndr

Description

@lndr

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):

  • OS: Debian 11
  • Version: Python 3.8.8, matrix-client 0.4.0

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions