Contributing

Thank you for considering contributing to django-allauth! This document outlines the process for contributing to the project and sets up your development environment.

Code of Conduct

In the interest of fostering an open and welcoming community, we as contributors and maintainers pledge to make participation in our project a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

Getting Started

Setting Up Your Development Environment

There are two primary ways to set up your development environment:

Running Tests

django-allauth uses a comprehensive test suite. You can run tests in several ways:

Using pytest directly

# Run all tests for the default setup
pytest allauth/

# Run tests with a specific Django settings module
pytest --ds=tests.projects.regular.settings tests/

# Run a specific test file
pytest tests/apps/account/test_login.py

Note, if you are using MacOS, using pip and get this error when run tests:

import xmlsec
ImportError: dlopen( ...  symbol not found in flat namespace '_xmlSecOpenSSLTransformHmacRipemd160GetKlass')

You can try:

pip uninstall xmlsec lxml
pip install --no-binary :all: xmlsec
# Ref: https://github.com/xmlsec/python-xmlsec/issues/320

Run Code Quality Checks

# Run all linting checks
nox -t lint

# Run specific check
nox --session black
nox --session isort
nox --session flake8
nox --session bandit
nox --session djlint

Building Documentation

Documentation is built using Sphinx:

# Build the documentation
nox --session docs

The built documentation will be available in the docs/_build/html directory.

Development Workflow

  1. Create a new branch for your feature or bugfix

    git checkout -b feature/your-feature-name
    
  2. Make your changes and add tests

    All new features should include proper tests.

  3. Run tests locally to ensure everything passes

    nox -x --session "test-3.11"
    
  4. Run code quality checks

    nox -t lint
    
  5. Commit your changes with meaningful commit messages

  6. Submit a pull request to the main repository

Pull Request Guidelines

  • Update documentation for significant changes

  • Add tests for new functionality

  • Ensure all tests pass

  • Follow the project’s code style

  • Keep pull requests focused on a single topic

  • Write clear, descriptive commit messages

Additional Resources

Thank you for your contributions!