This repository offers a structured starting point for Python development, aimed to streamline & standardize Python projects at Payroc.
Expand the menu below for more details:
Click to expand
- Click "Use this template" on GitHub.com to create a Git repo using this template.
- Clone your new repo on your local machine
- And start developing your Python project!
For more details, see Github's instructions on how to create a repo from a template.
Once you've created your git repo using this template:
- Rename
src/my_project/to the name of your application. - Install
pre-commitby running the commandpre-commit install. - Update this
README.
See docs/python_style_guide.md for guidelines on writing clean and maintainable Python code.
To ensure code quality & maintainability, the Python standards checklist below should be used during code reviews and development, covering the themes of:
- Coding standards
- Configuration
- Error handling
- Testing
- Documentation
Expand the menu below for more details:
Click to expand
-
Coding Standards:
Verify adherence to Payroc's Python coding standards, in particualr:
- Ensure adherence to PEP 8 guidelines.
- Check for clear and meaningful variable/function names.
- Verify consistent code formatting.
-
Configuration:
- Ensure that the code is designed to be config-driven where appropriate.
- Verify that configurable parameters are clearly defined and documented.
- Check for separation of configuration from code logic.
-
Error Handling:
- Check for proper implementation of error handling mechanisms.
- Verify logging of errors for debugging and monitoring.
- Ensure user-facing error messages are informative and helpful.
-
Testing:
- Confirm the presence of unit tests for new/modified code.
- Review test coverage for critical functionality.
- Check for appropriate test assertions and coverage of edge cases.
-
Documentation:
- Validate the presence of README updates, if applicable.
- Ensure documentation of new dependencies or usage instructions.
- Look for inline comments explaining complex logic or design decisions.
Setting up a virtual environment is a recommended practice to isolate project dependencies and avoid conflicts with other projects.
For detailed instructions, see Setting Up a Virtual Environment.
| Question | Answer |
|---|---|
| What is the Python Project Structure? | See How I should structure my Python project | Confluence. |
| How do I setup a virtual environment? | See Setting Up a Virtual Environment. |
| Question | Answer |
|---|---|
What is pre-commit? |
See What is pre-commit? | Confluence. |
How do you install & use pre-commit? |
See How-to: Set up pre-commit? | Confluence. |