matplotlib / matplotlib/ipympl
message schema
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Jupyter Notebook
- Sterne
- 1.7k
- Forks
- 234
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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
``` js
{'type': 'object',
'properties': {
'type': {'type': 'str'}
}
}
```
Depending on the value of 'type', the schema for the rest of the dict/object
``` js
{'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
``` js
{('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'
``` js
{'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
``` js
{'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'}}
```
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Es werden keine Dateien, Tests oder Einstiegspunkte genannt. Beginne damit, die Nachrichtenverarbeitung von Python nach JavaScript und von JavaScript nach Python zu finden, und vergleiche dann die implementierten Payloads mit den hier aufgeführten Schemas; die Aufgabe ist abgeschlossen, wenn das Nachrichtenschema dokumentiert und auf das tatsächliche Protokoll abgestimmt ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, jupyter-notebook, python
- Bereich
- api, backend-api-design
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100