Thank you for your interest in contributing to SETLr! We welcome contributions from the community.
- Code of Conduct
- Getting Started
- Development Setup
- Code Standards
- Testing Guidelines
- Commit Message Conventions
- Pull Request Process
- Pre-commit Hooks
This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to mccusj@cs.rpi.edu.
- Fork the repository on GitHub
- Clone your fork locally
- Create a new branch for your feature or bug fix
- Make your changes
- Test your changes
- Submit a pull request
SETLr includes scripts to help you set up your development environment quickly.
- Python 3.8 or higher
- Git
The bootstrap script will create a virtual environment and install all dependencies:
# Clone the repository
git clone https://github.com/YOUR_USERNAME/setlr.git
cd setlr
# Run the bootstrap script
./script/bootstrap
# Activate the virtual environment
source venv/bin/activateThe bootstrap script will:
- Create a Python virtual environment in
venv/ - Install setlr in editable mode
- Install all development dependencies (nose2, coverage, flake8, pylint, vulture)
- Install build tools (build, wheel, twine)
Use the provided scripts for common development tasks:
# Run linting checks and tests (full build)
./script/build
# Run tests only
nose2 --verbose
# Run tests with coverage
nose2 --with-coverage --coverage-report html
# Run linting
flake8 setlr/ tests/SETLr follows Python best practices and PEP 8 style guidelines (with some project-specific exceptions defined in setup.cfg).
- PEP 8: Follow PEP 8 style guidelines for Python code
- Docstrings: Use PEP 257 docstring conventions
- All public modules, functions, classes, and methods should have docstrings
- Use triple quotes (
""") for docstrings - Start with a one-line summary, followed by a blank line if more detail is needed
- Type Hints: Use type hints for function parameters and return values where appropriate
- Import Order: Organize imports in the following order:
- Standard library imports
- Related third-party imports
- Local application/library specific imports
- Line Length: Keep lines under 120 characters when practical (some flexibility given)
- Variables and Functions:
lowercase_with_underscores - Classes:
CapitalizedWords(PascalCase) - Constants:
UPPERCASE_WITH_UNDERSCORES - Private: Prefix with single underscore
_private_function
from typing import Dict, Optional
import pandas as pd
from rdflib import Graph
def process_data(input_file: str, options: Optional[Dict] = None) -> Graph:
"""
Process tabular data and generate an RDF graph.
Args:
input_file: Path to the input data file
options: Optional configuration dictionary
Returns:
An RDFlib Graph containing the processed data
Raises:
ValueError: If input_file does not exist
"""
if options is None:
options = {}
# Implementation here
passSETLr uses nose2 as the test runner. All new features and bug fixes should include tests.
- Place tests in the
tests/directory - Test files should be named
test_*.py - Test functions should be named
test_* - Use descriptive test names that explain what is being tested
- Include both positive and negative test cases
- Mock external dependencies when appropriate
# Run all tests
nose2 --verbose
# Run specific test file
nose2 tests.test_module
# Run specific test
nose2 tests.test_module.TestClass.test_method
# Run with coverage
nose2 --with-coverage --coverage setlr/- Aim for high test coverage of new code
- The project uses
coverageto track test coverage - Run
nose2 --with-coverageto generate coverage reports
Write clear and descriptive commit messages:
Short summary (50 chars or less)
More detailed explanation if necessary. Wrap at 72 characters.
Explain the problem that this commit is solving. Focus on why you
are making this change rather than how.
- Bullet points are okay
- Use present tense ("Add feature" not "Added feature")
- Reference issues and pull requests
Fixes #123
Good commit messages:
Add support for streaming JSON parsingFix memory leak in XML processingUpdate documentation for JSLDT templatesRefactor SPARQL query builder for clarity
-
Create a Branch: Create a feature branch from
develop(ormainif no develop branch exists)git checkout -b feature/my-new-feature
-
Make Your Changes: Implement your feature or bug fix
-
Test Your Changes: Ensure all tests pass
./script/build
-
Update Documentation: Update relevant documentation in the
docs/directory -
Update CHANGELOG: Add an entry to the
[Unreleased]section ofCHANGELOG.md -
Commit Your Changes: Use clear commit messages
-
Push to Your Fork:
git push origin feature/my-new-feature
-
Open a Pull Request: Open a PR against the main repository
- Use the PR template
- Provide a clear description of the changes
- Link to any related issues
- Ensure CI checks pass
-
Code Review: Address any feedback from maintainers
-
Merge: Once approved, a maintainer will merge your PR
Before submitting your pull request, ensure:
- Code follows the project's style guidelines
- All tests pass (
./script/build) - New tests are added for new features
- Documentation is updated
- CHANGELOG.md is updated
- Commit messages are clear and descriptive
- No unnecessary files are included (check
.gitignore)
SETLr uses pre-commit hooks to automatically check code quality before commits.
# Install pre-commit (if not already installed)
pip install pre-commit
# Install the git hooks
pre-commit installOnce installed, pre-commit will run automatically on git commit. You can also run it manually:
# Run on all files
pre-commit run --all-files
# Run on staged files only
pre-commit runThe pre-commit hooks will:
- Remove trailing whitespace
- Fix end of file
- Check YAML syntax
- Check for large files
- Check for merge conflicts
- Format code with Black
- Lint code with Flake8
- Sort imports with isort
If you have questions about contributing, please:
- Check the documentation
- Open a discussion
- Contact the maintainer at mccusj@cs.rpi.edu
Thank you for contributing to SETLr!