GNOME Bugzilla – Bug 765593
add guidelines for uniformity in the code base
Last modified: 2018-01-10 14:52:07 UTC
Python is an easy to enter language, but having no guidelines has resulted in a rather messy codebase for gnome-music in my opinion. It would be nice to have music act both as an entry-level project and an example of clean Gtk/GNOME PyGI application development. I propose to adopt a few guidelines for how to contribute to gnome-music and step-by-step move it to a cleaner state. I suggest updating slowly as parts get rewritten naturally, not in one giant step. Updating probably per function as parts of a function get updated. Accepted guidelines should be eventually put in a document in the source tree. Suggested guidelines: * Adhere to PEP-8 ( https://www.python.org/dev/peps/pep-0008/ ) * function notation with underscores (new_function) * private variables and functions prefixed with _ * docstrings for functions * etc. * Following from PEP-8 is PEP-257 on Docstrings * Use PyGI shorthands for accessing GtkTreeModel/GtkTreeStore * store[iter][column] * see https://python-gtk-3-tutorial.readthedocs.org/en/latest/treeview.html for details * comment GtkTreeStore/GtkListStore with actual value number & description for clarity store = Gtk.ListStore( str, # 1 - Name int, # 2 - Number ) * All tracker interaction in Query.py * All Grilo interaction in Grilo.py * All functions need to have @log decorator
That's great. Lets use this bug to track the progress of each singular case of this refactoring process. I also want to decouple the "view" code from the "model" and "controller" parts. For that, it would great to use gtk composite templates (see https://bugzilla.gnome.org/show_bug.cgi?id=701843). Thanks for this initiative! Lets discuss it further.
I've added the wip/mschraal/stylecleanup branch, which includes a readme blurb and 2 converted classes. This bit is purely about style. It also needs the patch from bug #766580 to work at the moment.
The branch has been pushed to master. New/updated code should follow the style as proposed. Of course feedback is welcome.
Thanks for your work! We could also mention the code style and standard in the wiki page for new contributors: https://wiki.gnome.org/Apps/Music/Contribute
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnome-music/issues/62.