matplotlib / matplotlib/ipympl

message schema

Đang mở
#8 2 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
Jupyter Notebook
Star
1.7k
Fork
234
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

At the request of @rgbkrk

Messages sent from python to js

  • the data field in sent messages is either a string with format
    "data:image/png;base64,{0}" or a dictionary
  • if a string, the {0} entry is a base64 encoded string of the image data
    • maybe a full image or a diff.
    • image is png encoded
  • if a dictionary then it will follow the schema
  {'type': 'object',
   'properties': {
       'type': {'type': 'str'}
   }
  }

Depending on the value of 'type', the schema for the rest of the dict/object


{'cursor': {'properties': {'cursor': {'type': int}, 'type': {'type': str}},
  'type': 'object'},
 'draw': {'properties': {'type': {'type': str}}, 'type': 'object'},
 'figure_label': {'properties': {'label': {'type': str},
   'type': {'type': str}},
  'type': 'object'},
 'image_mode': {'properties': {'mode': {'type': str}, 'type': {'type': str}},
  'type': 'object'},
 'message': {'properties': {'message': {'type': str}, 'type': {'type': str}},
  'type': 'object'},
 'refresh': {'properties': {'type': {'type': str}}, 'type': 'object'},
 'resize': {'properties': {'size': {'type': list}, 'type': {'type': str}},
  'type': 'object'},
 'rubberband': {'properties': {'type': {'type': str},
   'x0': {'type': float},
   'x1': {'type': float},
   'y0': {'type': float},
   'y1': {'type': float}},
  'type': 'object'},
 'save': {'properties': {'type': {'type': str}}, 'type': 'object'}}

Messages received by python from js

All of the messages seem to have


  {('msg_id',
    'parent_header',
    'buffers',
    'header',
    'content',
    'msg_type',
    'metadata')}

everything but 'content' looks like it is comm-related overhead

In 'content' there is 'data' and 'comm_id' (which is clearly comm overhead)

Inside of 'data'

  {'type': 'object',
   'properties': {
       'data': {'type': 'object',
                'properties': {
                    'type': {'type': 'str'}
                }
               }
       'comm_id': {'type': 'str'}
   }
  }

Depending on the value of 'type' (the entry in the message) it will
conform to one of the following specs


  {'ack': {'properties': {'figure_id': {'type': str}, 'type': {'type': str}},
    'type': 'object'},
   'button_press': {'properties': {'button': {'type': int},
     'figure_id': {'type': str},
     'guiEvent': {'type': dict},
     'type': {'type': str},
     'x': {'type': float},
     'y': {'type': float}},
    'type': 'object'},
   'button_release': {'properties': {'button': {'type': int},
     'figure_id': {'type': str},
     'guiEvent': {'type': dict},
     'type': {'type': str},
     'x': {'type': float},
     'y': {'type': float}},
    'type': 'object'},
   'closing': {'properties': {'figure_id': {'type': str}, 'type': {'type': str}},
    'type': 'object'},
   'draw': {'properties': {'figure_id': {'type': str}, 'type': {'type': str}},
    'type': 'object'},
   'figure_enter': {'properties': {'button': {'type': int},
     'figure_id': {'type': str},
     'guiEvent': {'type': dict},
     'type': {'type': str},
     'x': {'type': float},
     'y': {'type': float}},
    'type': 'object'},
   'figure_leave': {'properties': {'button': {'type': int},
     'figure_id': {'type': str},
     'guiEvent': {'type': dict},
     'type': {'type': str},
     'x': {'type': float},
     'y': {'type': float}},
    'type': 'object'},
   'key_press': {'properties': {'figure_id': {'type': str},
     'guiEvent': {'type': dict},
     'key': {'type': str},
     'type': {'type': str}},
    'type': 'object'},
   'key_release': {'properties': {'figure_id': {'type': str},
     'guiEvent': {'type': dict},
     'key': {'type': str},
     'type': {'type': str}},
    'type': 'object'},
   'motion_notify': {'properties': {'button': {'type': int},
     'figure_id': {'type': str},
     'guiEvent': {'type': dict},
     'type': {'type': str},
     'x': {'type': float},
     'y': {'type': float}},
    'type': 'object'},
   'refresh': {'properties': {'figure_id': {'type': str}, 'type': {'type': str}},
    'type': 'object'},
   'scroll': {'properties': {'button': {'type': int},
     'figure_id': {'type': str},
     'guiEvent': {'type': dict},
     'step': {'type': int},
     'type': {'type': str},
     'x': {'type': float},
     'y': {'type': float}},
    'type': 'object'},
   'send_image_mode': {'properties': {'figure_id': {'type': str},
     'type': {'type': str}},
    'type': 'object'},
   'set_dpi_ratio': {'properties': {'dpi_ratio': {'type': float},
     'figure_id': {'type': str},
     'type': {'type': str}},
    'type': 'object'},
   'supports_binary': {'properties': {'figure_id': {'type': str},
     'type': {'type': str},
     'value': {'type': bool}},
    'type': 'object'},
   'toolbar_button': {'properties': {'figure_id': {'type': str},
     'name': {'type': str},
     'type': {'type': str}},
    'type': 'object'}}

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

Không có tệp, bài kiểm thử hoặc entry point nào được nêu. Hãy bắt đầu bằng cách xác định phần xử lý message từ Python sang JavaScript và từ JavaScript sang Python, sau đó so sánh các payload đã triển khai với các schema được liệt kê ở đây; công việc được xem là hoàn tất khi schema message được tài liệu hóa và phù hợp với protocol thực tế.

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

Đánh giá

Công nghệ
javascript, jupyter-notebook, python
Lĩnh vực
api, backend-api-design
Loại issue
Tài liệu
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/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.