-
Notifications
You must be signed in to change notification settings - Fork 0
Add CONTRIBUTING.md with comprehensive contribution guidelines #658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rororowyourboat
wants to merge
4
commits into
main
Choose a base branch
from
feature/contributing-guide
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,295 @@ | ||
| # Contributing to MSML | ||
|
|
||
| Thank you for your interest in contributing to the Mathematical Specification Mapping Library (MSML). This guide will help you get started. | ||
|
|
||
| ## Table of Contents | ||
|
|
||
| - [Code of Conduct](#code-of-conduct) | ||
| - [Getting Started](#getting-started) | ||
| - [Development Workflow](#development-workflow) | ||
| - [Project Structure](#project-structure) | ||
| - [Coding Guidelines](#coding-guidelines) | ||
| - [Testing](#testing) | ||
| - [Documentation](#documentation) | ||
| - [Submitting Changes](#submitting-changes) | ||
|
|
||
| ## Code of Conduct | ||
|
|
||
| We are committed to providing a welcoming and inclusive environment. Please be respectful and considerate in your interactions with other contributors. | ||
|
|
||
| ## Getting Started | ||
|
|
||
| ### Environment Setup | ||
|
|
||
| 1. **Fork and clone the repository:** | ||
| ```bash | ||
| git clone https://github.com/YOUR_USERNAME/MSML.git | ||
| cd MSML | ||
| ``` | ||
|
|
||
| 2. **Install uv** (if not already installed): | ||
| ```bash | ||
| # On macOS and Linux | ||
| curl -LsSf https://astral.sh/uv/install.sh | sh | ||
|
|
||
| # On Windows | ||
| powershell -c "irm https://astral.sh/uv/install.ps1 | iex" | ||
| ``` | ||
|
|
||
| 3. **Set up the development environment:** | ||
| ```bash | ||
| uv sync | ||
| ``` | ||
|
|
||
| This creates a virtual environment in `.venv/` and installs all dependencies. | ||
|
|
||
| 4. **Activate the virtual environment:** | ||
| ```bash | ||
| # On macOS/Linux | ||
| source .venv/bin/activate | ||
|
|
||
| # On Windows | ||
| .venv\Scripts\activate | ||
| ``` | ||
|
|
||
| For more detailed setup instructions, see [SETUP.md](SETUP.md). | ||
|
|
||
| ## Development Workflow | ||
|
|
||
| ### Creating a Branch | ||
|
|
||
| Create a new branch for your work: | ||
|
|
||
| ```bash | ||
| git checkout -b feature/your-feature-name | ||
| # or | ||
| git checkout -b fix/your-bug-fix | ||
| ``` | ||
|
|
||
| Branch naming conventions: | ||
| - `feature/` - New features or enhancements | ||
| - `fix/` - Bug fixes | ||
| - `docs/` - Documentation changes | ||
| - `refactor/` - Code refactoring | ||
| - `test/` - Test additions or modifications | ||
|
|
||
| ### Making Changes | ||
|
|
||
| 1. Make your changes in the codebase | ||
| 2. Test your changes locally (see [Testing](#testing)) | ||
| 3. Ensure code follows our style guidelines (see [Coding Guidelines](#coding-guidelines)) | ||
| 4. Commit your changes with clear, descriptive messages | ||
|
|
||
| ### Commit Messages | ||
|
|
||
| Write clear and descriptive commit messages: | ||
|
|
||
| ``` | ||
| Add feature to export specifications to JSON | ||
|
|
||
| - Implement JSONExporter class | ||
| - Add validation for export format | ||
| - Include tests for edge cases | ||
| ``` | ||
|
|
||
| Format: | ||
| - First line: Brief summary (50 chars or less) | ||
| - Blank line | ||
| - Detailed description with bullet points if needed | ||
|
|
||
| ## Project Structure | ||
|
|
||
| ``` | ||
| MSML/ | ||
| ├── src/ | ||
| │ └── math_spec_mapping/ | ||
| │ ├── Classes/ # Core classes (Block, Space, State, etc.) | ||
| │ ├── Load/ # Loading and parsing specifications | ||
| │ ├── Reports/ # Report generation | ||
| │ └── Convenience/ # Helper utilities | ||
| ├── examples/ # Example specifications and notebooks | ||
| ├── docs/ # Documentation (Jekyll site) | ||
| ├── tests/ # Test suite (if present) | ||
rororowyourboat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ├── pyproject.toml # Project metadata and dependencies | ||
| ├── uv.lock # Locked dependencies | ||
rororowyourboat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| └── README.md # Project overview | ||
| ``` | ||
|
|
||
| ### Key Components | ||
|
|
||
| - **Classes**: Core abstractions (Block, Space, State, Mechanism, Policy, etc.) | ||
| - **Load**: Parsers and validators for JSON specifications | ||
| - **Reports**: Generators for Markdown, HTML, and Obsidian outputs | ||
| - **Convenience**: Helper functions for common workflows | ||
|
|
||
| ## Coding Guidelines | ||
|
|
||
| ### Python Style | ||
|
|
||
| - Follow [PEP 8](https://peps.python.org/pep-0008/) style guide | ||
| - Use meaningful variable and function names | ||
| - Keep functions focused and single-purpose | ||
| - Add docstrings to classes and public methods | ||
| - Use type hints where appropriate | ||
|
|
||
| ### Code Quality | ||
|
|
||
| - **Keep it simple**: Prefer clarity over cleverness | ||
| - **DRY principle**: Don't repeat yourself | ||
| - **Avoid breaking changes**: Maintain backward compatibility when possible | ||
| - **Document assumptions**: Add comments for non-obvious logic | ||
|
|
||
| ### Example Code Style | ||
|
|
||
| ```python | ||
| from typing import Dict, Optional | ||
|
|
||
| class MyClass: | ||
| """Brief description of the class. | ||
|
|
||
| Longer description if needed, explaining the purpose | ||
| and usage of the class. | ||
| """ | ||
|
|
||
| def my_method(self, param: str, optional_param: Optional[int] = None) -> Dict[str, Any]: | ||
| """Brief description of what the method does. | ||
|
|
||
| Args: | ||
| param: Description of param | ||
| optional_param: Description of optional_param | ||
|
|
||
| Returns: | ||
| Description of return value | ||
| """ | ||
| # Implementation | ||
| pass | ||
| ``` | ||
|
|
||
| ## Testing | ||
|
|
||
| ### Running Tests | ||
|
|
||
| If tests are present in the repository: | ||
|
|
||
| ```bash | ||
| # Run all tests | ||
| uv run pytest | ||
|
|
||
| # Run specific test file | ||
| uv run pytest tests/test_specific.py | ||
|
|
||
| # Run with coverage | ||
| uv run pytest --cov=math_spec_mapping | ||
| ``` | ||
|
|
||
| ### Writing Tests | ||
|
|
||
| When adding new features: | ||
|
|
||
| 1. Add unit tests for new functions/classes | ||
| 2. Test edge cases and error conditions | ||
| 3. Ensure tests are deterministic and isolated | ||
| 4. Use descriptive test names | ||
|
|
||
| Example: | ||
| ```python | ||
| def test_block_creation_with_valid_inputs(): | ||
| """Test that Block is created correctly with valid inputs.""" | ||
| # Arrange | ||
| block_data = {...} | ||
|
|
||
| # Act | ||
| block = Block(block_data) | ||
|
|
||
| # Assert | ||
| assert block.name == expected_name | ||
| ``` | ||
|
|
||
| ## Documentation | ||
|
|
||
| ### Code Documentation | ||
|
|
||
| - Add docstrings to all public classes and methods | ||
| - Update docstrings when modifying existing code | ||
| - Use clear, concise language | ||
| - Include examples for complex functionality | ||
|
|
||
| ### Project Documentation | ||
|
|
||
| When making significant changes: | ||
|
|
||
| 1. Update relevant sections in `README.md` | ||
| 2. Add or update documentation in `docs/` | ||
| 3. Update examples if API changes affect them | ||
| 4. Consider adding a guide or tutorial for new features | ||
|
|
||
| ## Submitting Changes | ||
|
|
||
| ### Before Submitting | ||
|
|
||
| 1. **Test your changes**: Ensure all tests pass | ||
| 2. **Check code style**: Follow the coding guidelines | ||
| 3. **Update documentation**: Add/update relevant docs | ||
| 4. **Review your changes**: Self-review the diff | ||
|
|
||
| ```bash | ||
| # Review your changes | ||
| git diff | ||
|
|
||
| # Check what files will be committed | ||
| git status | ||
| ``` | ||
|
|
||
| ### Creating a Pull Request | ||
|
|
||
| 1. **Push your branch:** | ||
| ```bash | ||
| git push origin feature/your-feature-name | ||
| ``` | ||
|
|
||
| 2. **Open a Pull Request** on GitHub with: | ||
| - Clear title describing the change | ||
| - Description explaining what and why | ||
| - Reference to related issues (e.g., "Closes #123") | ||
| - Any special testing instructions | ||
|
|
||
| ### Pull Request Template | ||
|
|
||
| ```markdown | ||
| ## Summary | ||
| Brief description of the changes | ||
|
|
||
| ## Changes | ||
| - Change 1 | ||
| - Change 2 | ||
|
|
||
| ## Related Issues | ||
| Closes #123 | ||
|
|
||
| ## Testing | ||
| How were these changes tested? | ||
|
|
||
| ## Screenshots (if applicable) | ||
| Add screenshots for UI changes | ||
| ``` | ||
|
|
||
| ### Review Process | ||
|
|
||
| - Maintainers will review your PR | ||
| - Address feedback and push updates to your branch | ||
| - Once approved, maintainers will merge your PR | ||
|
|
||
| ### After Merging | ||
|
|
||
| 1. Delete your feature branch (if desired) | ||
| 2. Pull the latest main branch | ||
| ```bash | ||
| git checkout main | ||
| git pull origin main | ||
| ``` | ||
|
|
||
| ## Questions or Need Help? | ||
|
|
||
| - Open an issue for questions or discussions | ||
| - Check existing issues and documentation first | ||
| - Be specific about your environment and the problem | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.