Skip to content

DAP Python Guidelines

Overview

This document outlines the guidelines for writing Python code in DAP. It is intended to be a living document, and will be updated as we learn and grow as a team. We welcome any feedback or suggestions for improvement, and encourage you to contribute to this document.

Table of Contents

High level aims

We’re developing these guidelines to help the team as a whole increase productivity, reduce errors, and deliver high-quality, reliable code. We think having guidelines are important for the following reasons:

  • Consistency: Guidelines ensure consistent coding practices across the team. Consistent code is easier to read, understand, and review.
  • Readability: Python emphasises readability, and guidelines help enforce this principle. Consistent indentation, naming conventions, and code organisation make it easier to navigate a codebase.
  • Maintainability: By adhering to standards, team members can understand and modify existing code more efficiently. This becomes particularly important when projects grow in size and complexity, as proper code structure and organisation enable easier debugging.
  • Scalability: Guidelines help ensure that Python code is scalable. They encourage the use of modular and reusable code, promoting code components that can be easily extended or modified without affecting the entire codebase.
  • Collaboration: By following common coding practices, team members can seamlessly integrate their work, understand each other's contributions, and reduce conflicts arising from differing coding styles.
  • Code Quality and Standards: Following guidelines enhances the overall quality of the code, leading to fewer bugs, better performance, and improved reliability.
  • Onboarding: Having clear and well-documented Python guidelines enables new members to quickly understand the coding standards and practices followed by the team. It reduces the learning curve, allows them to contribute effectively, and fosters a smoother integration into the team.
  • Convention: Taking away the weight of figuring out how best to write code from individuals reduces overheads and enables quicker project delivery.

We’ll also share some of our favourite tools to help make writing nice python code easier, but these are by no means mandatory, and we wholly recommend finding your own way to make your developer experience as productive as possible! NNote: nobody writes consistently perfect python code, but we hope by understanding and attempting to follow these guidelines in your work, you will produce code that works, is readable by others, and generally makes you a better programmer.