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

Add canonicaljson to runtime dependencies

Đang mở
#324 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Python
Star
266
Fork
118
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu từ danh sách dependency quanh dòng 47 của setup.py và kiểm tra import trong crypto/olm_device.py. Tái hiện việc tạo MatrixClient khi mã hóa được bật và canonicaljson không tồn tại, sau đó xác minh rằng việc khai báo canonicaljson là dependency thời gian chạy cho phép ví dụ được tài liệu hóa tạo client mà không cần cách xử lý ImportError gây hiểu lầm.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
build-system
Loại issue
Lỗi
Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
55/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.