Skip to content

Python Autocompletion Enhancement for Pippy Activity#106

Open
AdityaShome wants to merge 1 commit intosugarlabs:masterfrom
AdityaShome:fix584
Open

Python Autocompletion Enhancement for Pippy Activity#106
AdityaShome wants to merge 1 commit intosugarlabs:masterfrom
AdityaShome:fix584

Conversation

@AdityaShome
Copy link
Copy Markdown

Description

This PR improves the Python autocompletion feature in the Pippy activity to enhance the coding experience for learners. The implementation builds upon the existing Jedi-based autocompletion system while adding new functionality and usability improvements.

Changes

  • Improved the _trigger_completion method to provide more accurate completion suggestions
  • Added support for displaying function/method docstrings in the completion popup
  • Implemented visual indicators for different types of completions (functions, variables, classes)
  • Enhanced keyboard navigation in the completion window
  • Optimized performance for larger files by implementing smarter context analysis
  • Added intelligent filtering to reduce irrelevant suggestions
  • Implemented smart indentation based on context
  • Added proper handling for multiple cursor positions

Screenshots

Screenshot from 2025-04-17 08-46-14

Testing

The enhanced autocompletion has been tested across various Python code examples included in the activity, with particular attention to:

  • Basic variable and function suggestions
  • Module imports and attribute access
  • Function parameter hints
  • Performance with larger code files

Related Issues

Closes #105

Kindly provide suggestion for the implementation.

@chimosky
Copy link
Copy Markdown
Member

I don't think we need this feature in Pippy because as a beginner, they're supposed to learn by typing things out themselves and make mistakes and that's okay.

@quozl thoughts?

@AdityaShome
Copy link
Copy Markdown
Author

AdityaShome commented Apr 17, 2025

To preserve the self-learning spirit of Pippy, the autocomplete suggestions are only available for a limited number of times per session(max 3), or for a short initial learning phase. After that, learners are encouraged to type the code themselves. This maybe re-enabled later if user is stuck and runs out of options or needs help recalling new modules/functions.It helps children to try out and experiment all types of modules/functions/instances which are new, that they may not find by themselves. Should I implement a counter to track number of suggestions used and retries in compiler?

@chimosky
Copy link
Copy Markdown
Member

Being available for a limited number of times doesn't actually make much sense to me, autocomplete is more a feature of code editors and Pippy isn't just a code editor, it serves some function of code editors but it wasn't created to be a code editor.

@quozl
Copy link
Copy Markdown
Contributor

quozl commented Apr 17, 2025

Thanks.

I don't think it is age appropriate. Autocomplete complicates the expectation of interaction; as adults or young adults here, we know that software can intervene between keystrokes and we accept the benefit of distraction and guidance.

When I've taught elementary age children coding in Arduino IDE C++, and secondary age children coding in Python, most of my time was spent on teaching them to accurately read what is in a text buffer or on a printed page. The elementary age children were able to learn C++ syntax, but only after substantial teaching and practice in reading punctuation; they hadn't been (and at that stage should not have been) taught period, comma, semicolon, and several other critical characters. They didn't know about on-screen text buffers and what can be in them.

Autocomplete usually functions outside punctuation, for identifiers, and so would act to hide or distract from the punctuation issue.

Children who have understood punctuation and coding enough won't be using Pippy, they'll use the Jupyter activity, online coding environments, or install VSCode. Sugar never had an IPython activity, yet it would have been a logical step.

So my vote on this feature, as it is currently expressed, is no thanks. Keep trying.

@AdityaShome please review the Pippy documentation https://help.sugarlabs.org/en/pippy.html and imagine you are a teacher preparing for a lesson with your children. How could the documentation or Pippy be improved?

p.s. the GSoC idea Pippy Debugger is interesting, but it does appear to be "we want to engage an LLM for debugging, what Sugar activity do we have that involves debugging," so it will be very interesting to see if the idea gets off the ground.

@AdityaShome
Copy link
Copy Markdown
Author

Being available for a limited number of times doesn't actually make much sense to me, autocomplete is more a feature of code editors and Pippy isn't just a code editor, it serves some function of code editors but it wasn't created to be a code editor.

I totally agree with it , the idea was mainly on showing children more and new modules/functions to try out, building more curiosity. If it would not be required and not fitting with Pippy's goals, I am happy to shift focus to solve other issues.

@AdityaShome
Copy link
Copy Markdown
Author

AdityaShome commented Apr 17, 2025

Thanks.

I don't think it is age appropriate. Autocomplete complicates the expectation of interaction; as adults or young adults here, we know that software can intervene between keystrokes and we accept the benefit of distraction and guidance.

When I've taught elementary age children coding in Arduino IDE C++, and secondary age children coding in Python, most of my time was spent on teaching them to accurately read what is in a text buffer or on a printed page. The elementary age children were able to learn C++ syntax, but only after substantial teaching and practice in reading punctuation; they hadn't been (and at that stage should not have been) taught period, comma, semicolon, and several other critical characters. They didn't know about on-screen text buffers and what can be in them.

Autocomplete usually functions outside punctuation, for identifiers, and so would act to hide or distract from the punctuation issue.

Children who have understood punctuation and coding enough won't be using Pippy, they'll use the Jupyter activity, online coding environments, or install VSCode. Sugar never had an IPython activity, yet it would have been a logical step.

So my vote on this feature, as it is currently expressed, is no thanks. Keep trying.

@AdityaShome please review the Pippy documentation https://help.sugarlabs.org/en/pippy.html and imagine you are a teacher preparing for a lesson with your children. How could the documentation or Pippy be improved?

p.s. the GSoC idea Pippy Debugger is interesting, but it does appear to be "we want to engage an LLM for debugging, what Sugar activity do we have that involves debugging," so it will be very interesting to see if the idea gets off the ground.

Thank you for the detailed feedback — I really appreciate the insights provided. I completely understand the importance of children learning to read punctuation and understanding the fundamentals before introducing assistive tools like autocomplete.

My intention was never to skip over those essential learning steps, but to help spark curiosity by exposing learners to new modules and functions they might not find on their own and hiding the common obvious ones(can be implemented). If it's not needed or doesn't align with Pippy's goals, I'm more than happy to refocus and work on other issues.

I'll take your suggestion and review the Pippy documentation with the mindset of a teacher preparing a lesson. I’d love to contribute toward improving the learning experience and documentation in a way that aligns with Pippy’s philosophy.

Also, thanks for the note on the debugger idea, I have submitted a GSoC proposal about it's integration, and a prototype in #104, kindly review if possible.
— I’ll definitely reflect on how to better root it in Pippy’s purpose and make it more than just adding an LLM to an activity.

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.

Python Autocompletion Enhancement

3 participants