Skip to content

Latest commit

 

History

History
136 lines (98 loc) · 2.87 KB

CONTRIBUTING.md

File metadata and controls

136 lines (98 loc) · 2.87 KB

Contributing to CortexAI

Thank you for your interest in contributing to CortexAI! This document provides guidelines and information for contributors.

Code of Conduct

Please read our Code of Conduct before contributing.

How to Contribute

Reporting Bugs

  1. Check if the bug has already been reported in GitHub Issues.
  2. If not, create a new issue with:
    • A clear, descriptive title
    • Steps to reproduce the issue
    • Expected behavior vs actual behavior
    • Your environment (OS, Rust version, Python version)

Suggesting Enhancements

  1. Check existing issues and discussions.
  2. Create a new issue with the enhancement label.
  3. Describe the feature, its use case, and potential implementation.

Pull Requests

  1. Fork the repository.
  2. Create a feature branch from main:
    git checkout -b feature/your-feature-name
  3. Make your changes.
  4. Add or update tests as needed.
  5. Ensure all tests pass:
    cargo test
  6. Submit a pull request with:
    • A clear description of changes
    • Reference to related issues
    • Any breaking changes noted

Development Setup

Prerequisites

  • Rust 1.75+
  • Python 3.10+
  • maturin (for building Python bindings)

Building

# Build the core library
cd core
cargo build

# Run tests
cargo test

# Build Python bindings
cd ../bindings/python
pip install maturin
maturin develop

Code Style

Rust

  • Follow standard Rust conventions.
  • Use cargo fmt and cargo clippy.
  • Document public APIs with /// comments.
  • Include unit tests for new functionality.

Python

  • Follow PEP 8.
  • Use type hints.
  • Document with docstrings.

Adding New Equations

To add a new equation module:

  1. Create a new file in core/src/ (e.g., new_equation.rs).
  2. Implement the EquationModule trait:
    pub struct NewEquation {
        params: NewEquationParams,
    }
    
    impl EquationModule for NewEquation {
        fn step(&mut self, input: &State, params: &Params, dt: f64) -> State {
            // Implementation
        }
    
        fn explain(&self) -> Contribution {
            // Return contribution metadata
        }
    
        fn name(&self) -> &str {
            "new_equation"
        }
    
        fn variable_names(&self) -> Vec<String> {
            vec!["var1".to_string(), "var2".to_string()]
        }
    }
  3. Add unit tests.
  4. Register in lib.rs.
  5. Update documentation.

Benchmarks

Run benchmarks with:

cargo bench

New benchmarks should be added to the benches/ directory.

Documentation

  • Update README.md for user-facing changes.
  • Update inline documentation for API changes.
  • For mathematical details, reference original papers.

Questions?

Open a Discussion for questions.

Thank you for contributing to CortexAI!