Guidelines and Policy

Contributing

You can structure your changes into a series of commits in git. A series of well disposed changes is easy to review. Write a sufficient commit log message for each change. Do not fear writing down details about why the change is implemented as it is, if there are multiple alternatives. Also, if you forsee any future possibilites or problems, please describe them in the commit log.

You can find kupfer's git repository at github and fork it there, for easy publication of your changes.

If you suggest your changes for inclusion into Kupfer, make sure you have read the whole Guidelines and Policy chapter of this manual. And take care to structure your changes, do not fear asking for advice. Good Luck!

Icon Guidelines

Consider the following:

Important

Actions should have stylized, simple icons. Leaves and Sources should have detailed, specific icons.

Coding style

Kupfer python code is indented with four spaces. If you contribute to kupfer keep in mind that

Python's general style guideline is called PEP 8, and you should programmers should read it. The advice given there is very useful when coding for Kupfer.

Specific Points

Using rank_adjust

A declaration like this can modify the ranking of an object:

class MyAction (Action):
    rank_adjust = -5
    ...
  1. Often, this is useless. Don't use it, let Kupfer learn which actions are important.

  2. If the action is destructive, the adjust should be negative. Never positive. For example Move to Trash has a negative 10 rank_adjust.

  3. If the action is very general, and applies to almost everything but still should never be the default for anything, the adjust should be negative.

Using super(..)

You should use the Python 3 super() without arguments.

Old code was using the following style which worked best in older Python, but the style is obsolete:

Source.__init__(self, _("Recent items"))

Text and Encodings

Care must be taken with all input and output text and its encoding! Internally, kupfer must use str for all internal text. The module kupfer.kupferstring has functions for the most important text conversions.

A resource for unicode in Python:

Always find out what encoding you must expect for externally read text (from files or command output). If you must guess, use the locale encoding. Text received from GTK is always str, which means encoding is not a problem.

Note that the gettext function _() always returns a unicode string (str).