Contributing to Kallithea¶
Kallithea is developed and maintained by its users. Please join us and scratch your own itch.
The main repository is hosted on Our Own Kallithea (aka OOK) at https://kallithea-scm.org/repos/kallithea/, our self-hosted instance of Kallithea.
For now, we use Bitbucket for pull requests and issue tracking. The issue tracker is for tracking bugs, not for support, discussion, or ideas – please use the mailing list or IRC to reach the community.
We use Weblate to translate the user interface messages into languages other than English. Join our project on Hosted Weblate to help us. To register, you can use your Bitbucket or GitHub account. See Translations for more details.
To get started with development:
hg clone https://kallithea-scm.org/repos/kallithea cd kallithea virtualenv ../kallithea-venv source ../kallithea-venv/bin/activate pip install --upgrade pip setuptools pip install -e . paster make-config Kallithea my.ini paster setup-db my.ini --user=user --firstname.lastname@example.org --password=password --repos=/tmp paster serve my.ini --reload & firefox http://127.0.0.1:5000/
After finishing your changes make sure all tests pass cleanly. You can run
the testsuite running
nosetests from the project root, or if you use tox
tox for Python 2.6–2.7 with multiple database test.
When running tests, Kallithea uses kallithea/tests/test.ini and populates the SQLite database specified there.
It is possible to avoid recreating the full test database on each invocation of the tests, thus eliminating the initial delay. To achieve this, run the tests as:
paster serve kallithea/tests/test.ini --pid-file=test.pid --daemon KALLITHEA_WHOOSH_TEST_DISABLE=1 KALLITHEA_NO_TMP_PATH=1 nosetests kill -9 $(cat test.pid)
You can run individual tests by specifying their path as argument to nosetests. nosetests also has many more options, see nosetests -h. Some useful options are:
-x, --stop Stop running tests after the first error or failure -s, --nocapture Don't capture stdout (any stdout output will be printed immediately) [NOSE_NOCAPTURE] --failed Run the tests that failed in the last test run.
Kallithea is GPLv3 and we assume all contributions are made by the committer/contributor and under GPLv3 unless explicitly stated. We do care a lot about preservation of copyright and license information for existing code that is brought into the project.
We don’t have a formal coding/formatting standard. We are currently using a mix of Mercurial’s (https://www.mercurial-scm.org/wiki/CodingStyle), pep8, and consistency with existing code. Run whitespacecleanup.sh to avoid stupid whitespace noise in your patches.
We support both Python 2.6.x and 2.7.x and nothing else. For now we don’t care about Python 3 compatibility.
We try to support the most common modern web browsers. IE9 is still supported to the extent it is feasible, IE8 is not.
We primarily support Linux and OS X on the server side but Windows should also work.
HTML templates should use 2 spaces for indentation ... but be pragmatic. We
should use templates cleverly and avoid duplication. We should use reasonable
semantic markup with element classes and IDs that can be used for styling and testing.
We should only use inline styles in places where it really is semantic (such as
; between/after statements. Indentation 4 spaces. Inline
multiline functions should be indented two levels – one for the
() and one for
Variables holding jQuery objects should be named with a leading
Commit messages should have a leading short line summarizing the changes. For
bug fixes, put
(Issue #123) at the end of this line.
Use American English grammar and spelling overall. Use English title case for page titles, button labels, headers, and ‘labels’ for fields in forms.
Contributions will be accepted in most formats – such as pull requests on bitbucket, something hosted on your own Kallithea instance, or patches sent by email to the kallithea-general mailing list.
Make sure to test your changes both manually and with the automatic tests before posting.
We care about quality and review and keeping a clean repository history. We might give feedback that requests polishing contributions until they are “perfect”. We might also rebase and collapse and make minor adjustments to your changes when we apply them.
We try to make sure we have consensus on the direction the project is taking. Everything non-sensitive should be discussed in public – preferably on the mailing list. We aim at having all non-trivial changes reviewed by at least one other core developer before pushing. Obvious non-controversial changes will be handled more casually.
For now we just have one official branch (“default”) and will keep it so stable that it can be (and is) used in production. Experimental changes should live elsewhere (for example in a pull request) until they are ready.
Translations are available on Hosted Weblate at the following URL:
Registered users may contribute to the existing languages, or request a new language translations.
Translating using Weblate¶
Weblate offers a simple and easy to use interface featuring glossary, machine translation, suggestions based on similar translations in other projects, automatic checks etc. Weblate imports the source code tree directly from the version control system, and commits edits back from time to time.
When registering at Weblate, make sure you name and email address you prefer to be used when your changes are committed. We can and probably will amend changesets coming from Weblate, but having things right from the beginning makes things easier.
Weblate performs sanity checks all the time and tries to prevent you from ignoring them. Most common mistakes are inconsistent punctuation, whitespaces, missing or extra format parameters, untranslated strings copied into the translation. Please perform necessary corrections when they’re needed, or override the false positives.
Merging translations from Weblate¶
Weblate rebases its changes every time it pulls from our repository. Pulls are triggered by a web hook from Our Own Kallithea every time it receives new commits. Usually merging the new translations is a straightforward process consisting of a pull from Weblate-hosted repository which is available under Data Exports tab in Weblate interface.
Weblate tries to minimise the number of commits, but that’s not always work, especially when two translators work with different languages at more or less the same time. It makes sense sometimes to re-order or fold commits by the same author when they touch just the same language translation. That, however, may confuse Weblate sometimes, in which case it should be manually convinced it has to discard the commits it created by using its administrative interface.
Manual creation of a new language translation¶
In the prepared development environment, run the following to ensure all translation strings are extracted and up-to-date:
python2 setup.py extract_messages
Create new language by executing following command:
python2 setup.py init_catalog -l <new_language_code>
This creates a new translation under directory kallithea/i18n/<new_language_code> based on the translation template file, kallithea/i18n/kallithea.pot.
Edit the new PO file located in LC_MESSAGES directory with poedit or your favorite PO files editor. After you finished with the translations, check the translation file for errors by executing:
msgfmt -f -c kallithea/i18n/<new_language_code>/LC_MESSAGES/<updated_file.po>
Finally, compile the translations:
python2 setup.py compile_catalog -l <new_language_code>
Extract the latest versions of strings for translation by running:
python2 setup.py extract_messages
Update the PO file by doing:
python2 setup.py update_catalog -l <new_language_code>
Edit the new updated translation file. Repeat all steps after init_catalog step from new translation instructions
Edit kallithea/tests/test.ini file and set lang attribute to:
Run Kallithea tests by executing:
We do not have a road map but are waiting for your contributions. Refer to the wiki for some ideas of places we might want to go – contributions in these areas are very welcome.