-
Notifications
You must be signed in to change notification settings - Fork 17
Development
This project follows the Google Style Guide for Python with few exceptions. Other things of note:
- We use the flake8 linter. On VSCode, this can be selected/installed by opening the command palate and choosing:
Python: Select Linter>flake8. - We set a maximum line length of 100. The
tox.inifile in this packages repository specifies this, overwritingflake8's default line length (79). - In VSCode, you can install autoDocstring and select
GoogleinDocstring Formatto automatically fill in docstrings formatted according to the Google Style Guide.
Import statements are automatically sorted using isort. If you are using VSCode, isort is included under the python extension. Simply open the command palette and select: Python Refactor: Sort Imports.
Besides the usual best practices for git commit messages, feel free to add an emjoi to the beginning of the commit message according to these guidelines.
We use pytest as our unit testing framework and tox to manage testing and for checking our package against best practices. Additionally, we use TravisCI for continuous integration and Codacy for automated code reviews.
To run a complete check on the package (which includes unit tests, and checking the package structure and manifest file), simply call tox from the root of the package directory
$ git clone https://github.com/berc-uoft/Transformer-GCN-QA.git
$ cd Transformer-GCN-QA
$ tox
Unit tests are organized under src/tests. We use the unit test framework pytest. Each file under src/tests should begin with test_*.py and unit tests should be organized as methods with names def test_* under a class. This allows all tests to be automatically discovered by pytest. You can read more about the pytest framework here.
In src/tests/conftest.py, you should place any pytest fixtures that are used in the unit tests. These fixtures will be available to the classes and methods under src/tests/test_*.py. You can read more about pytest fixtures here.