First off, thank you for considering contributing to Django SEO Optimizer! It's people like you that make Django SEO Optimizer such a great tool.
This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code.
Before creating bug reports, please check the issue list as you might find out that you don't need to create one. When you are creating a bug report, please include as many details as possible:
- Use a clear and descriptive title
- Describe the exact steps which reproduce the problem
- Provide specific examples to demonstrate the steps
- Describe the behavior you observed after following the steps
- Explain which behavior you expected to see instead and why
- Include details about your configuration and environment
Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, please include:
- Use a clear and descriptive title
- Provide a step-by-step description of the suggested enhancement
- Provide specific examples to demonstrate the steps
- Describe the current behavior and explain which behavior you expected to see instead
- Explain why this enhancement would be useful
- Fill in the required template
- Do not include issue numbers in the PR title
- Follow the Python style guide
- Include thoughtfully-worded, well-structured tests
- Document new code
- End all files with a newline
- Fork the repo and create your branch from
develop
- Install development dependencies:
pip install -e ".[dev]"
- Run tests to ensure everything is working:
pytest
- Make your changes and add tests
- Run the test suite again
- Push to your fork and submit a pull request
We use pytest for our test suite. To run tests:
# Run all tests
pytest
# Run specific test file
pytest tests/test_fields.py
# Run with coverage report
pytest --cov=seo_optimizer
- Write test docstrings
- Each test should have a single assertion
- Use descriptive test names
- Follow the Arrange-Act-Assert pattern
Example:
def test_metadata_field_validates_max_length():
"""Test that MetadataField correctly validates max_length."""
# Arrange
field = MetadataField(max_length=10)
# Act & Assert
with pytest.raises(ValidationError):
field.clean("This is too long")
We follow PEP 8 with some modifications:
- Line length limit is 100 characters
- Use double quotes for strings
- Use trailing commas in multi-line structures
- Sort imports using isort
Use black for code formatting:
black seo_optimizer
- Use Google-style docstrings
- Update the README.md if needed
- Add docstrings to all public methods
- Include code examples in docstrings
- Update type hints
Example:
def get_metadata(
self,
path: str,
language: Optional[str] = None
) -> Dict[str, Any]:
"""Get metadata for the given path and language.
Args:
path: The URL path to get metadata for
language: Optional language code (e.g., 'en', 'es')
Returns:
Dictionary containing metadata fields
Example:
>>> meta = MetadataManager().get_metadata('/products/')
>>> print(meta['title'])
'Our Products'
"""
- Use the present tense ("Add feature" not "Added feature")
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
- Limit the first line to 72 characters or less
- Reference issues and pull requests liberally after the first line
Example:
Add async support for metadata retrieval
- Implement AsyncMetadataManager
- Add async_get_metadata method
- Update documentation with async examples
Fixes #123
- Update version in
seo_optimizer/version.py
- Update CHANGELOG.md
- Create release notes
- Tag the release
- Push to PyPI
Feel free to contact the project maintainers if you have any questions or need help with the contribution process.
By contributing, you agree that your contributions will be licensed under the MIT License.