matrix-org / matrix-org/matrix-python-sdk

Add canonicaljson to runtime dependencies

Offen
#324 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Python
Sterne
266
Forks
118
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne bei der Abhängigkeitsliste um Zeile 47 von setup.py und untersuche den Import in crypto/olm_device.py. Reproduziere die Erstellung von MatrixClient mit aktivierter Verschlüsselung und nicht vorhandenem canonicaljson und überprüfe anschließend, dass die Deklaration von canonicaljson als Laufzeitabhängigkeit dem dokumentierten Beispiel ermöglicht, einen Client ohne die irreführende Behandlung von ImportError zu erstellen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
build-system
Issue-Typ
Bug
Schwierigkeit
1/5
Geschätzter Aufwand
Unter einer Stunde
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
55/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.