Skip to content

Contributing to CRML

Thank you for your interest in contributing to CRML! We welcome contributions from everyone.


๐Ÿ› ๏ธ Development Setup

Prerequisites

  • Python 3.9+
  • git
  • pip

1. Fork and Clone

Fork the repository on GitHub, then clone your fork:

git clone https://github.com/YOUR_USERNAME/crml.git
cd crml

2. Create a Virtual Environment

python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

3. Install Dependencies

Install the packages in editable mode with dev dependencies:

pip install -e ./crml_lang -e ./crml_engine

๐Ÿงช Running Tests

We use pytest for testing. Ensure you have activated your virtual environment.

Run All Tests

pytest

Run Specific Tests

pytest tests/test_controls.py

Check Coverage

pytest --cov=crml_lang --cov=crml_engine

๐Ÿ’ป Code Style

We follow PEP 8 guidelines. Please ensure your code is formatted correctly.

  • Indent: 4 spaces
  • Line Length: 88 characters (Black default)
  • Docstrings: Google style docstrings

Running Linters

# Install linting tools if not already present
pip install black flake8 isort

# Format code
black .
isort .

# Check for issues
flake8 .

๐Ÿ“ Pull Request Process

  1. Create a Branch:

    git checkout -b feature/my-new-feature
    

  2. Make Changes:

  3. Write clear, concise code.
  4. Add docstrings to new functions/classes.
  5. Update README.md or documentation if needed.

  6. Add Tests:

  7. If adding a feature, add a test case in tests/.
  8. Ensure all tests pass with pytest.

  9. Commit:

  10. Use clear commit messages (Conventional Commits preferred).
  11. Example: feat: add attack chain validation

  12. Push and PR:

    git push origin feature/my-new-feature
    

  13. Go to GitHub and open a Pull Request against main.
  14. Describe your changes and link any related issues.

๐Ÿ“„ Documentation

  • Wiki: If you are adding a major feature, please consider updating the Wiki.
  • Specification: Changes to the language itself require updating wiki/Reference/CRML-1.1.md.

๐Ÿ› Reporting Issues

If you find a bug or have a feature request, please open an issue on GitHub: https://github.com/Faux16/crml/issues

Please include: - CRML version - Python version - Operating system - Steps to reproduce - Example YAML model (if applicable)


โš–๏ธ License

By contributing, you agree that your contributions will be licensed under the MIT License.