Coding guidelines#
Glue is written entirely in Python, and we abide by the following guidelines:
We follow many of the same guidelines as the Astropy project, which you can find here.
Glue includes a pre-commit configuration which enforces (on pushing to a pull request) many code style rules, and in some cases can also automatically fix them. This is again largely following the Astropy usage, including the use of ruff check as a linter. See their documentation for details on how to use
pre-commit run
andpre-commit install
to have your code already checked and fixed on your local commits.We use absolute imports for most of the code in Glue, with the exception of tests, which are allowed to import the classes/functions they are testing using relative imports. This means that if we need to move files and their associated tests around, the tests will still work without having to change the imports.
All Qt-specific code should live in
qt/
sub-directories (see Qt-specific code for more details).Docstrings should be written using the numpydoc format, which is described in detail here.