Thank you for your interest in contributing to our package! This document outlines the tools and steps to follow to ensure a smooth and consistent workflow.
-
Fork and Clone: Fork the repository and clone it to your local machine.
git clone https://github.com/<your-username>/django-sage-otp.git cd django-sage-otp
-
Initialize Git Flow: Set up Git Flow to manage your branches efficiently.
git flow init
Follow the prompts to configure Git Flow. The default options usually suffice.
-
Create a Branch: Create a new branch for your feature or bugfix using Git Flow.
-
Creating a Feature Branch:
git flow feature start your-feature-name
This will create and check out a new branch from the
develop
branch. -
Creating a Bugfix Branch:
git flow bugfix start your-bugfix-name
This will create and check out a new branch specifically for the bugfix.
-
-
Install Dependencies: Use Poetry to install dependencies.
poetry install
-
Write Code and Tests: Make your changes and write tests for your new code.
-
Run Code Quality Checks: Ensure code quality with pre-commit, Ruff, and Pylint.
poetry run pre-commit run --all-files poetry run ruff check sage_otp/ --fix poetry run black sage_otp/ poetry run isort sage_otp/ poetry run pylint sage_otp/ poetry run bandit -r sage_otp/ -c pyproject.toml
-
Run Tests: Ensure all tests pass using Poetry.
poetry run pytest
-
Commit Changes: Use Commitizen to commit your changes.
cz commit
-
Push and Create a PR: Push your changes and create a pull request.
git push origin feature/your-feature-name
-
Bump Version: Use Commitizen to bump the version.
cz bump
-
Generate Changelog: Use Commitizen to generate the changelog.
cz changelog
-
Export Dependencies: Export dependencies for development and production.
poetry export -f requirements.txt --output requirements/requirements.txt --without-hashes poetry export -f requirements.txt --dev --output requirements/requirements-dev.txt --without-hashes
Commitizen follows the Conventional Commits specification. The commit message should be structured as follows:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Here are 10 examples of commit messages following the Commitizen Conventional Commits specification:
feat(core): initialize the core module
- Set up the core structure
- Added initial configurations and settings
- Created basic utility functions
build(release): build and tag version 1.0.0
- Built the project for production
- Created a new tag for version 1.0.0
- Updated changelog with release notes
feat(auth): add user authentication
- Implemented user login and registration
- Added JWT token generation and validation
- Created middleware for protected routes
fix(api): resolve issue with data fetching
- Fixed bug causing incorrect data responses
- Improved error handling in API calls
- Added tests for the fixed bug
docs(sphinx): update API documentation
- Updated the Sphinx documentation for API changes
- Added examples for new endpoints
- Fixed typos and formatting issues
build(deps): update project dependencies
- Updated all outdated npm packages
- Resolved compatibility issues with new package versions
- Ran tests to ensure no breaking changes
build(version): update version to 2.1.0 for build and publish
- Incremented version number to 2.1.0
- Updated package.json with the new version
- Prepared for publishing the new build
test(auth): add unit tests for authentication module
- Created tests for login functionality
- Added tests for registration validation
- Ensured 100% coverage for auth module
refactor(core): improve code structure and readability
- Refactored core module to enhance readability
- Extracted utility functions into separate files
- Updated documentation to reflect code changes
perf(parser): enhance parsing speed
- Optimized parsing algorithm for better performance
- Reduced the time complexity of the parsing function
- Added benchmarks to track performance improvements
These examples cover various types of commits such as feature additions, bug fixes, documentation updates, dependency updates, versioning, testing, refactoring, and performance improvements.