These guidelines are designed to ensure consistency, quality, and ease of collaboration within the DS4CG-iNaturalist team. Adhering to these standards helps maintain a clean and efficient codebase, making it easier for team members to review, understand, and contribute to the project.
- Reviewers Requirement
- Each piece of code must be reviewed and approved by at least two members of the DS4CG-iNaturalist team. This ensures that multiple perspectives are considered, increasing code quality and reducing the likelihood of errors.
- Pull Request (PR) Guidelines
- Size: Keep pull requests and changes as small as possible. Smaller PRs are easier to review and test, making the review process more efficient.
- Descriptions: Every pull request must include a clear and detailed description with the following elements.
- Features: A bullet list of features or changes contributed in the PR.
- Goal: A brief explanation of the objective or problem the PR aims to address.
- Link to Issues or Work Item: A reference to the relevant task or work item, providing context for the changes and helping track progress.
- Update the ChangeLog
- ChangeLog File: should happen on every PR!
- Follow the Keep a Changelog format.
- Version Number (if updated).
- Comment Sections: features, fixes, changes that went into the code. If the code version is not updated, add features/bugs in the “Unreleased” comment section.
- ChangeLog File: should happen on every PR!
The DS4CG-iNaturalist project utilizes an automated pipeline to build docker images and deploy them to our DockerHub in an effort to maintain versions of our code. The deployment process involves building and pushing Docker images. These images are triggered by tagging a new code version. The process automatically builds the frontend and backend components, creating separate Docker images for each.
Preparing a release involves making sure all features for the release are in the main branch, updating the version numbers in all code and documentation, then creating a release on GitHub and corresponding tag. The general steps are:
-
Ensure all features and bug fixes to be included in the release are merged into the main branch.
-
Decide on the new version number following the Semantic Versioning guidelines. For example,
vX.Y.Z
. -
Create a Release Branch:
- Create a release branch named
release-vX.Y.Z
frommain
.
- Create a release branch named
-
Tag the Release:
- Update all version numbers and documentation in the code on the release branch:
- Ensure all documentation is up-to-date, including the changelog and README if necessary and commit updates to the branch.
- Update the
image
tags with the proper version number (vX.X.X) in the docker-compose.yml file. - Update Changelog:
- Follow the Keep a Changelog format.
- Add a new version header with the release date.
- Push the release branch to the remote repository.
-
Use the Github managing release instructions to make a formal release on Github:
- On GitHub.com, navigate to the main page of the repository.
- To the right of the list of files, click Releases.
- At the top of the page, click Draft a new release.
- To choose a tag for the release, select the Choose a tag dropdown menu.
- Type a version number for your release, then click Create new tag.
- Select the Target dropdown menu, then click the branch that contains the project you want to release.
- In the "Release title" field, type a title for your release.
- In the "Describe this release" field, type a description for your release. - good idea to use in release description updates added to CHANGELOG file for this release.
- If you're ready to publicize your release, click Publish release.
-
Merge Back: Merge the release branch back into
main
.
Semantic Versioning, often abbreviated as SemVer, is a versioning system used for software development. It provides a standardized way to manage and communicate changes in software releases, helping developers, users, and automated systems understand the nature of changes and their potential impact.
Semantic Versioning uses a three-part version number format: vMAJOR.MINOR.PATCH, where:
- MAJOR: Increases when there are incompatible API changes.
- MINOR: Increases when functionality is added in a backward-compatible manner.
- PATCH: Increases when backward-compatible bug fixes are made.
- Use clear and descriptive commit messages.
- Start with a verb in the present tense (e.g., "Add", "Fix", "Update").
- Start with a capital letter and end with a period.
- Example:
Add user authentication feature
.
- Docstrings:
- Use docstrings for all functions. For simple functions, a one-liner is fine. For more complex functions, include multi-line documentation that explains the function, provides information about arguments, and details the output.
- Include module docstrings with a short description of the module and its functions.
- Formatting:
- Use a formatter to ensure code consistency. We have included
ruff
for linting and formatting in the developer dependencies inrequirements-dev.txt
.
- Use a formatter to ensure code consistency. We have included