Coding style and quality¶
Basically, we want all python code to follow the PEP 8 standard. There are a few exceptions where we see things differently or just aren’t that strict. The
setup.cfgfile in the project’s source folder contains definitions that allow flake8 to check for violations automatically. See Code checks and unit tests for more information. Use four spaces for indentation.
We sort our imports by a certain schema, but you don’t have to do this by hand. Again,
setup.cfgcontains some definitions that allow the command
isort -rc <directory>to automatically sort the imports in your source files.
Please remember to always mark all strings ever displayed to any user for translation.
We expect all new code to come with proper tests. When writing new tests, please write them using pytest-style test functions and raw
assertstatements. Use fixtures to prevent repetitive code. Some old parts of pretix’ test suite are in the style of Python’s unit test module. If you extend those files, you might continue in this style, but please use
pyteststyle for any new test files.
Please keep the first line of your commit messages short. When referencing an issue, please phrase it like
Fix #123 -- Problems with order creationor
Refs #123 -- Fix this part of that bug.