openedx / openedx/openedx-events
Should event metadata be in attribute docstrings?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13
- Forks
- 33
- Avg merge
- 14h 37m
- Merged PRs (30d)
- 4
Description
Currently, the data types for events are nicely integrated with VS Code and other tooling:
But this is not the case for events themselves. A lot of the key information is in comments like this:
Which does not appear in relevant places in VS Code:
However, if we were to update our approach to put this data into "attribute docstrings" (as defined in PEP 257), then this information would show up in VS Code (as well as other tools like mkdocstrings):
😎
The code I used for the above screenshot looks like this:
CONTENT_OBJECT_TAGS_CHANGED = OpenEdxPublicSignal(
event_type="org.openedx.content_authoring.content.object.tags.changed.v1",
data={
"content_object": ContentObjectData,
}
)
"""
Emitted when an object's tags are changed.
**Warning**: This is DEPRECATED; please use `CONTENT_OBJECT_ASSOCIATIONS_CHANGED` instead.
Details |:
-|-
event_type | `org.openedx.content_authoring.content.object.tags.changed.v1`
event_name | `CONTENT_OBJECT_TAGS_CHANGED`
event_data | `content_object`: `ContentObjectData`
"""
Such attribute docstrings are not normally accessible at runtime (same as with the current comment approach), but you can use the griffe module to access them.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with openedx_events/content_authoring/signals.py, especially the event definition around lines 251–261, and review how OpenEdxPublicSignal events currently document their metadata. Convert the relevant event metadata comments to PEP 257 attribute docstrings, then verify that the descriptions and metadata appear in VS Code and are accessible to mkdocstrings via griffe.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, vscode
- Domain
- documentation
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100