Software Development

Looking for resources to get started with software development? Check out the  Scientific Python Development Guide . The  Turing Way Guide for Reproducible Research  and  Turing Way Guide for Project Design  are also useful.

Template

If you're starting a new GitHub repository for a Python package, it helps to start from a template. We have one such template at  https://github.com/Quantum-Accelerators/template . Click "Use this template", replace all instances of "template" with your desired package name, and you should be good to go! Further details can be found in the  template repository's documentation  and corresponding video.

Unit Tests

When developing any new software package in the group or contributing to existing open-source software packages, it is absolutely essential to write and regularly use unit tests (i.e. tests that evaluate the behavior and output of your various functions and classes). Simply put, this is the only way to know if your code is working as intended and if changes break your code in unexpected ways. You do not need to write unit tests at the very start of a project, although it can be good practice. That said, you must write unit tests before the end of a project.
While it may seem annoying at first to develop unit tests, they will save you an immense amount of pain in the long-term. We use pytest for our unit tests. The Turing Way Guide for Reproducible Research has a  "Code Testing" section  that is very useful. In general, if you are developing code to be used by others, these tests should run automatically on GitHub via a continuous integration setup. There is also a  "Continuous Integration" section  in the Turing Way guide.

Formatting

See  ✴️Group Code Style Guide  for details on code formatting.