-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Annotate the version of an item #1041
Comments
Without |
To me, we need to introduce IDs for items. They could be a simple string interpolation |
Yes, then project.put("my_key", 3)
# Annotates the latest version by default
project.set_note("my_key", "this is 3 because 3 is good")
# Annotates version 10
project.set_note("my_key-10", "this is 3 because 3 is good") |
@augustebaum , we shouldn't add the version in the key, prefer a dedicated parameter. In your example, imagine you have two items in your project with keys I would prefer something like:
Edit: We can maybe add a new parameter to the |
agree with Thomas's solution, I like it, it seems fluid. I also like to be able to put a note at first and also afterwards. |
This is for several reasons: - it is not as explicit as several simple `put` calls: the mechanic is ambiguous with regards to atomicity (if a key-value pair is invalid, does it make the whole operation fail?) - the mechanic makes it complicated to add options to `put`, e.g. the `note` option proposed in #1041 or the `display_as` option proposed in #1045 (comment).
This is for several reasons: - it is not as explicit as several simple `put` calls: the mechanic is ambiguous with regards to atomicity (if a key-value pair is invalid, does it make the whole operation fail?) - the mechanic makes it complicated to add options to `put`, e.g. the `note` option proposed in #1041 or the `display_as` option proposed in #1045 (comment).
This is for several reasons: - it is not as explicit as several simple `put` calls: the mechanic is ambiguous with regards to atomicity (if a key-value pair is invalid, does it make the whole operation fail?) - the mechanic makes it complicated to add options to `put`, e.g. the `note` option proposed in #1041 or the `display_as` option proposed in #1045 (comment).
This is for several reasons: - it is not as explicit as several simple `put` calls: the mechanic is ambiguous with regards to atomicity (if a key-value pair is invalid, does it make the whole operation fail?) - the mechanic makes it complicated to add options to `put`, e.g. the `note` option proposed in #1041 or the `display_as` option proposed in #1045 (comment).
New methods have been added to `Project`: ```python # The default is to act on the latest version project.set_note(key, message, version=-1) project.get_note(key, message, version=-1) project.delete_note(key, message, version=-1) ``` To this end, - `Item` now has an additional attribute, `note`, which is a `str | None` - `ItemRepository` has similar methods The note related methods fail with a KeyError when the key-version combination does not exist, but: - `get_note` returns `None` if the note is `None` (no error) - `delete_note` never errors if the key-version combination exists (even if the note is already `None`, it will be set to `None` again) `set_note` fails with a TypeError if `key` or `message` is not a string. Addresses part of #1041
The UI has been defined :)! |
Part of #1041 - [x] upgrade dependencies (eslint 9 \o/) - [x] new icons - [x] minimal skinnable rich text editor - [x] expose python's `set_note` as a JSON API - [x] plug the API in the frontend ## UI preview https://github.com/user-attachments/assets/33cdf005-9ddd-42db-8059-c84c6a4a2433 ## implementation choices Finding a good and not too opinionated rich text editor is no easy job. After struggling with a few libs I decided that rolling a minimal editor may do the job (at least for now). The RichTextEditor component (probably badly named) tries to: - help user with basic markdown syntax - keep interactions button outside of it for best skinnability In a future work we may move to something more powerful.
With #1082 merged I believe a first iteration of this issue is done! Please review and close if you agree @MarieS-WiMLDS @sylvaincom |
Many thanks team! All good on my side, I'm letting @MarieS-WiMLDS give her approval as well |
Hello! Starting to play with the notes, I have a couple of questions. I can't wait to show it to people who asked for it :)! Q1
Why is the second option not ok? Also, why does it render this error, I don't understand why it tells me I give 4 arguments while I read only 3? Finally, the documentation of Q2It was a bit difficult to me to understand how to save the note. I clicked on the screen outside of the note, but it didn't close the editing window. I'm not sure it should, be willing to hear your opinion about it. Q3When I write a simple note, like "blblbl", when I fetch it using:
Capture.video.du.17-01-2025.09.38.57.webmQ4more a remark; it looks like we haven't been clear in the specs, sometimes we talk about a message, sometimes a note. everything is not consistant. --> let's harmonize everything on "note". |
Great feedback @MarieS-WiMLDS Re Q1: The second option is not ok because when you start adding a lot of arguments to a function, passing arguments by keyword is less ambiguous (otherwise the user might be confused as to which argument is the value and which is the note). Re Q2: This was discussed with @rouk1 and I agree with you -- I thought it was something we could deal with later. Currently your options are all keyboard-based ( Re Q3: I can see in the video that you pressed Re Q4: You're right, I am only noticing it now. See #1143 |
Re Q2: as in a markdown cell in Jupyter notebook, you do |
I agree that the question could be asked. Behind the scene your note is saved at each keystroke, hence no need to focus out or to click save (à la notion). I suppose this is fine. I'll open a PR to handle "click outside" and trimming. |
re Q1: ok, I understand why it's not a good idea! However I still don't understand the error: it tells me I gave 4 arguments, while I only gave 3. Is there something we can do about it? Also, the documentation of |
That's because it also counts
@thomass-dev #1052 should update the |
thanks for the answers, and for the "click outside" addition. Our last element to tackle before closing this issue is the saving of the note. As @auguste-probabl said, |
Done in #1167 |
Is your feature request related to a problem? Please describe.
As a data scientist, I want to annotate the specific version of an item because it helps me keep track of what is happening.
As a data scientist, I want to update or delete the note I have previously created.
As a data scientist, the notes I create from the Python API must be visible in the UI.
Describe the solution you'd like
Python API
The value of the
note
kwarg is some Markdown text.Add an note:
More programmatic CRUD:
UI
Let the user interact with an item version:
Describe alternatives you've considered, if relevant
No response
Additional context
Related to #889
note
argument #1101The text was updated successfully, but these errors were encountered: