Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

message schema

未关闭
#8 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
文档
描述清晰度
需要澄清
活跃度
停滞
技术栈
javascript, jupyter-notebook, python

调研方向

未指定文件、测试或入口点。首先定位 Python-to-JavaScript 和 JavaScript-to-Python 的消息处理,然后将已实现的 payload 与此处列出的 schema 进行比较;当消息 schema 已记录并与实际协议保持一致时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

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'}}

主要语言
Jupyter Notebook
星标
1.7k
派生
234
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

matplotlib/ipympl 的其他 Issue

查看 matplotlib/ipympl 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。