I created SuperHELP to make it easier for people to write good Python code. You can find the project at https://pypi.org/project/superhelp/
To summarise the rationale for SuperHELP I have thought of a few taglines:
SuperHELP – Python help that really helps!
SuperHELP – Help for Humans!
SuperHELP – Make Python Pythonic!
Some context might help explain:
Python has secured its position in the top tier of programming languages and more people than ever are learning to write Python. But, let’s be honest, a lot of Python code being written is not what it could be. Even an elegant language like Python can be written badly or in a way that is hard to read or maintain.
To make it easier for people to write good Python we are already well-served by IDEs from IDLE upwards. People have easy access to style linters and IDEs clearly signal syntax errors and basic mistakes like unused variables. But wouldn’t it be great if people could check their code to see if there are better, more Pythonic ways of doing things? Or to learn more about basic language features and Python data structures than the standard help can offer?
That’s where SuperHELP can play a role.
So what exactly is SuperHELP? Basically it is an advice engine. SuperHELP reads a snippet of Python and provides advice, warnings, and basic information based on what it finds. For example, it might notice a function docstring is missing and show a template for adding one. Or identify the use of a named tuple and explain how to add docstrings to individual fields or the named tuple as a whole.
The intention is to make sure that everyone, from beginners upwards, learns something useful. Even an advanced Python programmer might not appreciate the benefits of using functools.wraps when creating their own decorator. Or an experienced Java programmer might not realise that Python properties are a much better option than getters and setters.
So how can people use SuperHELP? For most people, the easiest way will be to open a binder web notebook and enter their code there.
Of course, because SuperHELP is a pip package https://pypi.org/project/superhelp/ it can be installed alongside Python on a machine and used directly from the terminal e.g.
shelp --code "people = ['Tomas', 'Sal']" --output html --detail-level Main
If the output chosen is html (the default) output looks like:
And if –output cli (command line interface i.e. terminal or console) is selected, output looks like:
In all likelihood, there will be other ways of making SuperHELP advice more readily available – probably through integration with other platforms and processes.
SuperHELP needs your help:
- If you have any ideas, or the ability to help in some way, please contact me at email@example.com.
- Spread the word about SuperHELP through your social networks.