Skip to content

Latest commit

 

History

History
127 lines (93 loc) · 4.48 KB

File metadata and controls

127 lines (93 loc) · 4.48 KB

Contributing to genetic-algorithm

Thanks for your interest in contributing! This project is a small, dependency-free genetic-algorithm engine with pluggable fitness criteria. Contributions of all kinds are welcome: bug reports, documentation, new selection/crossover/mutation operators, example fitness plugins, and code.

By participating, you agree to abide by our Code of Conduct.

Ways to contribute

Pull Request Process

For External Contributors

  1. Fork the repository to your GitHub account.
  2. Create a branch from main with a descriptive name:
    git checkout -b feature/add-tournament-selection
  3. Make your changes following the Code Style guidelines.
  4. Add tests for any new functionality.
  5. Update documentation if your changes affect the public API.
  6. Commit with clear messages following Conventional Commits:
    feat: add tournament selection
    fix: handle empty mating pool without crashing
    docs: clarify the fitness plugin contract
    
  7. Push your branch and open a Pull Request against main.
  8. Sign the CLA when prompted by the CLA Assistant bot.
  9. Wait for review — a maintainer will review your PR within 2 weeks (SLA).

For Internal Contributors (Santander)

  1. Create a branch from main (no fork needed if you are a member of the org).
  2. Follow steps 3-7 above.
  3. Request review from the maintainer team in CODEOWNERS.

PR Requirements

All pull requests must pass the following automated checks before merge:

  • CI lint and tests (ci) — Linting, formatting, unit tests
  • Security scan (codeql, dep-scan) — SAST and dependency audit
  • License check (license-check) — SPDX headers + no-runtime-deps guard
  • Pattern check (pattern-check) — No internal URLs, IPs, or corporate email addresses
  • CLA signed (for external contributors)

Additionally:

  • At least 1 maintainer approval is required.
  • All review conversations must be resolved.
  • The branch must be up to date with main.

Code Style

Python

  • Follow PEP 8.
  • Use Black for formatting (line length: 100).
  • Use Ruff for linting.
  • Use mypy for type checking.
  • All public functions and classes must have docstrings.
  • Keep the engine dependency-free — the genetic_algorithm package must rely only on the Python standard library.

File Headers

Every source file must include the copyright header:

# Copyright (c) 2026 Santander Group
# SPDX-License-Identifier: Apache-2.0

Commit Messages

Follow Conventional Commits:

Prefix Use
feat: New feature
fix: Bug fix
docs: Documentation only
test: Adding or updating tests
refactor: Code refactoring (no feature/fix)
ci: CI/CD changes
chore: Maintenance tasks

Testing

  • Write tests for all new functionality.
  • Use pytest as the test framework.
  • Place tests in the tests/ directory, mirroring the source structure.
  • Run the full test suite before submitting a PR:
    pytest
  • Minimum code coverage target: 99%.

Contributor License Agreement (CLA)

By submitting a pull request, you agree to the terms of our Contributor License Agreement. The CLA Assistant bot will automatically check your PR and ask you to sign the CLA if you have not already done so.

The CLA ensures that contributions can be distributed under the project's Apache 2.0 license.

Release Process

This project follows Semantic Versioning (SemVer):

  • MAJOR — Incompatible API changes
  • MINOR — New features (backward-compatible)
  • PATCH — Bug fixes (backward-compatible)

Releases are managed by maintainers. If you believe a release is warranted, open an issue to discuss.


Thank you for contributing to genetic-algorithm!