After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 765593 - add guidelines for uniformity in the code base
add guidelines for uniformity in the code base
Status: RESOLVED OBSOLETE
Product: gnome-music
Classification: Applications
Component: user docs
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: Maintainers of Gnome user documentation
Maintainers of Gnome user documentation
Depends on:
Blocks:
 
 
Reported: 2016-04-26 10:38 UTC by Marinus Schraal
Modified: 2018-01-10 14:52 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Marinus Schraal 2016-04-26 10:38:42 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
Comment 1 Felipe Borges 2016-04-26 10:47:42 UTC
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.
Comment 2 Marinus Schraal 2016-05-22 21:55:03 UTC
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.
Comment 3 Marinus Schraal 2016-06-07 22:46:28 UTC
The branch has been pushed to master.

New/updated code should follow the style as proposed. Of course feedback is welcome.
Comment 4 Felipe Borges 2016-06-08 08:58:56 UTC
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
Comment 5 GNOME Infrastructure Team 2018-01-10 14:52:07 UTC
-- 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.