Version control
We use PyCharms builtin functionality to push the code to the remote. This allows to enable automatic scan, linting, reformatting and rearrangement of the code. More on the setup is available here
General recommendations
- Push all the changes daily, even if the current version isn't working. This is good for several reasons, including data loss prevention & better error detection
- Keep commits small: each commit should address one issue or feature
- Avoid mega commits that address several unrelated issues
- Write short but meaningful commit messages
- If the commit is linked to specific Jira/Gitlab issue, mention it in the commit message:
- "PUR-XYV #Commit message" for Jira issue
PUR-XYV - "#N commit message" for Gitlab issues
N
- "PUR-XYV #Commit message" for Jira issue
Opening a merge request
On all our projects, main is a protected branch for development. To address an issue:
- Open a new branch from
main. Either pull the latest changes manually or open a branch from the GitLab UI itself to avoid merge conflicts. Use the Jira issue name as a branch name. This way it will be easier to manage commit history in the future.- If there are tests, run them all and make sure everything works correctly. If not, report the failed tests to team lead so they can address the issue
- If you are addressing a bug, make sure to include its example/expected results to test data so the future changes won't break your fixes
- Make changes on the new branch
- Create a Merge Request to merge your branch into
main. The MR should include a short snipped of breaking changes, new features and improvements
Before opening an MR
- Make sure all the tests are running properly
- Clean out unused code ― variables, functions, methods or classes
- Make sure there are no redundant print statements you were using for debugging
- Clean out the commented code fragments if any
- If you've created a new module/subpackage, make sure to include them in the docs and navigation. Similarly, delete removed module/package info from docs
- If it's an API, make sure that all the Swagger examples are running correctly