Skip to content
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

Key completion for dataset access #3973

Merged
merged 9 commits into from
Jul 4, 2024

Conversation

ElenaKhaustova
Copy link
Contributor

@ElenaKhaustova ElenaKhaustova commented Jun 28, 2024

Description

Solves #3914

Development notes

  • Implemented IPython and Jupyter key completions for accessing datasets in the catalog. The solution is based on defining _ipython_key_completions_() for _FrozenDatasets class.
Screenshot 2024-07-01 at 08 55 01
  • Original names (with non-word characters) are suggested as keys but those that are replaced with __ (as for properties) are accepted as well.
Screenshot 2024-07-01 at 08 53 32
  • Manually tested with transcoded datasets and configuration patterns.

Developer Certificate of Origin

We need all contributions to comply with the Developer Certificate of Origin (DCO). All commits must be signed off by including a Signed-off-by line in the commit message. See our wiki for guidance.

If your PR is blocked due to unsigned commits, then you must follow the instructions under "Rebase the branch" on the GitHub Checks page for your PR. This will retroactively add the sign-off to all unsigned commits and allow the DCO check to pass.

Checklist

  • Read the contributing guidelines
  • Signed off each commit with a Developer Certificate of Origin (DCO)
  • Opened this PR as a 'Draft Pull Request' if it is work-in-progress
  • Updated the documentation to reflect the code changes
  • Added a description of this change in the RELEASE.md file
  • Added tests to cover my changes
  • Checked if this change will affect Kedro-Viz, and if so, communicated that with the Viz team

@ElenaKhaustova ElenaKhaustova marked this pull request as ready for review July 1, 2024 08:50
@ElenaKhaustova ElenaKhaustova self-assigned this Jul 1, 2024
Copy link
Contributor

@noklam noklam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good, I have some questions:
image

  1. When I try to prompt the autocompletion, it seems to prompt me to use the single quote instead of the more common " in Python. Is this something we can control or it's how IPython completion works? If I type catalog.datasets["] and hit tab then it would finish the autocompletion without the finishing ", which means a few more keystrokes. This is not a deal breaker but just want to check if we can make this experience smoother.

@ElenaKhaustova
Copy link
Contributor Author

@datajoely, regarding your question about placing parameters at the bottom - sorting is applied internally in ipython completer.py after _ipython_key_completions_() is called, so I cannot force a custom order. Keys are always in lexicographic order.

@datajoely
Copy link
Contributor

datajoely commented Jul 2, 2024

Sounds good! @ElenaKhaustova , I petition that we drop the parameters god object in 1.0.0 - cc @astrojuanlu

@ElenaKhaustova
Copy link
Contributor Author

ElenaKhaustova commented Jul 2, 2024

Generally looks good, I have some questions: image

  1. When I try to prompt the autocompletion, it seems to prompt me to use the single quote instead of the more common " in Python. Is this something we can control or it's how IPython completion works? If I type catalog.datasets["] and hit tab then it would finish the autocompletion without the finishing ", which means a few more keystrokes. This is not a deal breaker but just want to check if we can make this experience smoother.

Yes, that's the way IPython completion works and there's no any API to customise it from the outside. I see some logic for matching the closing quote but it's not straightforward why it's not working. So there's not much that we can do but create an issue and ask.

@noklam
Copy link
Contributor

noklam commented Jul 2, 2024

Thanks for checking, I think this is good enough.

@astrojuanlu

This comment was marked as off-topic.

@merelcht

This comment was marked as off-topic.

@ElenaKhaustova

This comment was marked as off-topic.

@astrojuanlu
Copy link
Member

Left a comment at #3893 (comment) and marking the off-topic comments as such.

Copy link
Member

@astrojuanlu astrojuanlu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works like a charm! ✨

image

@ElenaKhaustova ElenaKhaustova merged commit bcca77e into main Jul 4, 2024
41 checks passed
@ElenaKhaustova ElenaKhaustova deleted the feature/3914-autocompletion-for-dataset-access branch July 4, 2024 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants