Galaxy Software Development Best Practices


Getting Started
Galaxy API
Source Code
Architecture
Best Practices
Lists software development best practices for the Galaxy Project. These are works in progress and practices vary in how broadly they have been applied.

Metastandards

  1. If you want to add something here propose it first on the galaxy-dev mailing list.
  2. These are best practices. They are not rigid. There are no enforcers.

General

  1. Ensure all user-enterable strings are unicode capable

Python Standards

  1. Galaxy follows PEP-8, with particular emphasis on the parts about knowing when to be inconsistent, and readability being the ultimate goal.
  2. 4 spaces per indent
  3. Use spaces, not tabs for indenting.
  4. Comments and documentation comments should follow the 79 character rule
  5. One divergence from PEP-8 is line length. Logical (non-comment) lines should be formatted for readability, recognizing the existence of wide screens and scrollbars (sometimes a 200 character line is more readable, though rarely).
  6. Other divergences from PEP-8 are listed in the setup.cfg file
  7. Python docstrings need to be reStructured Text (RST) and Sphinx markup compatible. See Docs for more.
  8. Avoid from module import *. It can cause name collisions that are tedious to track down.

JavaScript Standards

  1. Follow JSHint whenever possible, deviating for readability.
  2. Use semicolons to terminate statements.
  3. Put delimiters that open blocks on the current line; put delimiters that close blocks on their own line. E.g.

       if (condition) {
         do_action();
       }
    
  4. camelCasePlease and capitalize ClassNames

  5. variables with jQuery objects should start with '$'
  6. JSDoc-style commenting http://en.wikipedia.org/wiki/JSDoc

Backbone

  1. Decouple models from views, and use events to communicate state changes from model to view(s); this is advantageous because multiple views can use the same object and models can be used without views.

Email Threads

Tool Development Best Practices

Please see a separate page on what are the best practices when it comes to the development of Galaxy tools.