Thank you for considering contributing to Readable Science Markup! This document provides guidelines for contributing to the project.
RSM is a community-owned project. We expect all contributors to:
- Be respectful and constructive in discussions
- Focus on what's best for the community
- Welcome newcomers and help them get started
- Python 3.10+
- uv package manager
justcommand runner- (Optional)
tree-sitterCLI for grammar development
-
Fork and clone the repository
git clone --recurse-submodules https://github.com/YOUR_USERNAME/rsm.git cd rsmImportant: Use
--recurse-submodulesto include thetree-sitter-rsmgrammar submodule. -
Install dependencies
just install
This installs:
rsm-langin editable modetree-sitter-rsmfrom PyPI (pre-built wheel)- All development and documentation dependencies
-
Install pre-commit hooks (optional but recommended)
uv run pre-commit install
The hooks will check YAML/TOML files and fix whitespace issues before commits.
-
Create a feature branch
git checkout -b feature/your-feature-name
-
Make your changes
- Follow existing code patterns
- Keep changes focused and minimal
- Avoid over-engineering
-
Run tests and linting
just check # Runs linting, tests, and type checking
- Linter: ruff (configured for Python 3.10+)
- Type Checker: mypy with strict settings
- Format: Run
just lintto format code - Comments: Only add comments that explain why, not what
- Simplicity: Prefer simple solutions over abstractions
All changes should include test coverage:
- Unit tests: Test individual functions and components
- Slow tests: Large-scale tests marked with
@pytest.mark.slow - Doctests: Examples in docstrings and documentation
# Run fast tests only (recommended during development)
just test
# Run all tests including slow ones
just test-all
# Run only slow tests
just test-slow
# Run doctests in source and docs
just test-docs
# Run type checking
just typecheckRSM includes a standalone JavaScript bundle (rsm/static/rsm-standalone.js) that must be regenerated when any JS files in rsm/static/ are modified.
When to rebuild:
- After editing any
.jsfile inrsm/static/
How to rebuild:
just rebuild-js-bundleThis bundles onload.js and dependencies into a single IIFE that exposes RSM.onload() and RSM.onrender().
Most contributors don't need this. Only modify the grammar if you're changing RSM language syntax.
If you need to modify tree-sitter-rsm/grammar.js:
-
Switch to local grammar development
just install-local
-
Modify grammar Edit
tree-sitter-rsm/grammar.js -
Rebuild grammar
just grammar
This regenerates the parser, rebuilds the C extension, and reinstalls the package.
- User-facing docs: Edit RST files in
docs/source/directory - Build docs: Run
just docsto build HTML documentation - Serve docs with live reload: Run
just docs-serve(opens on port 7001) - Code docs: Add docstrings with examples for public APIs
- README: Keep README focused on installation and quick start
-
Ensure all checks pass
just check # Linting + tests + type checking -
Commit your changes
git add . git commit -m "Brief description of changes"
Pre-commit hooks will run automatically if installed.
-
Push to your fork
git push origin feature/your-feature-name
-
Open a Pull Request
- Use a clear, descriptive title
- Describe what changed and why
- Reference any related issues
- Ensure CI passes
- Keep PRs focused: One feature or bug fix per PR
- Write clear commit messages: Describe what and why
- Respond to feedback: Address review comments promptly
- Be patient: Maintainers review PRs as time allows
rsm/
├── rsm/ # Main package
│ ├── cli.py # Command-line interface
│ ├── parser.py # Tree-sitter integration
│ ├── builder.py # HTML/CSS/JS generation
│ └── static/ # JavaScript and CSS assets
│
docs/
├── source/ # Sphinx documentation source (RST)
└── build/ # Generated documentation (HTML)
tests/ # Comprehensive test suite
tree-sitter-rsm/ # Grammar submodule (tree-sitter)
just # List all available commands
just install # Install development dependencies
just install-local # Install with local grammar (for grammar dev)
just test # Run fast tests
just test-all # Run all tests (including slow)
just lint # Format and check code
just typecheck # Run mypy type checking
just check # Run lint + tests + typecheck
just docs # Build documentation
just docs-serve # Serve docs with live reload
just grammar # Rebuild tree-sitter grammar (advanced)
just rebuild-js-bundle # Rebuild standalone JS bundle- Issues: Check existing issues or open a new one
- Questions: Use GitHub Discussions
- Bugs: Include steps to reproduce and expected behavior
All contributors will be recognized in release notes and project documentation.
By contributing to RSM, you agree that your contributions will be licensed under the MIT License.