Contributing

We welcome contributions to unifres! Whether you’re reporting bugs, suggesting features, improving documentation, or contributing code, your help is appreciated.

Ways to contribute

1. Report bugs

Found a bug? Please open an issue with:

  • Clear title describing the problem
  • Steps to reproduce the bug
  • Expected vs actual behavior
  • System information (R/Python version, OS)
  • Minimal reproducible example

2. Suggest enhancements

Have an idea for a new feature? Create an issue describing:

  • What problem it solves
  • How it would work
  • Example use cases
  • Whether you’d like to implement it

3. Improve documentation

Documentation improvements are always welcome:

  • Fix typos or clarify existing docs
  • Add examples to function documentation
  • Write tutorials or vignettes
  • Improve website content

4. Contribute code

Ready to contribute code? Great!

For R:

# Fork and clone the repository
# Make your changes in r/unifres/

# Run tests
devtools::test()

# Check package
devtools::check()

# Submit a pull request

For Python:

# Fork and clone the repository
# Make your changes in python/

# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest tests/ -v

# Submit a pull request

Development workflow

1. Fork and clone

# Fork the repository on GitHub
# Then clone your fork
git clone https://github.com/YOUR-USERNAME/unifres.git
cd unifres

2. Create a branch

git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fix

3. Make changes

  • Write clear, documented code
  • Add tests for new functionality
  • Follow existing code style
  • Update documentation as needed

4. Test your changes

R Package:

devtools::load_all()
devtools::test()
devtools::check()

Python Package:

pytest tests/ -v --cov=unifres

5. Commit and push

git add .
git commit -m "Add feature: description of your changes"
git push origin feature/your-feature-name

6. Submit pull request

  • Go to your fork on GitHub
  • Click “New Pull Request”
  • Fill out the PR template
  • Link any related issues

Coding standards

R code style

  • Follow the tidyverse style guide
  • Use <- for assignment
  • Maximum line length: 80 characters
  • Document with roxygen2
  • Include examples in documentation

Python code style

  • Follow PEP 8
  • Use type hints
  • Maximum line length: 88 characters
  • NumPy-style docstrings
  • Include docstring examples

Testing guidelines

Write good tests

  • Test all new functionality
  • Include edge cases
  • Test error conditions
  • Aim for >80% coverage
  • Use descriptive test names

R testing

test_that("fresiduals works with binomial GLM", {
  # Arrange
  fit <- glm(y ~ x, family = binomial)

  # Act
  fres <- fresiduals(fit)

  # Assert
  expect_s3_class(fres, "unifres")
  expect_equal(length(fres), length(y))
})

Python testing

def test_fresiduals_binomial():
    """Test fresiduals with binomial GLM"""
    # Arrange
    model = sm.GLM(y, X, family=sm.families.Binomial()).fit()

    # Act
    fres = fresiduals(model)

    # Assert
    assert len(fres) == len(y)
    assert all(hasattr(f, 'cdf') for f in fres)

Documentation standards

R documentation

Use roxygen2 with: - @param for parameters - @return for return values - @examples with working code - @export for public functions - @references for citations

Python documentation

Use NumPy-style docstrings with: - Parameters section - Returns section - Examples section - Notes section (if needed) - References section

Pull request checklist

Before submitting a PR, ensure:

Code review process

  1. Maintainers will review your PR
  2. They may request changes
  3. Make requested changes and push to your branch
  4. Once approved, maintainers will merge

Getting help

Need help contributing?

Recognition

All contributors will be recognized in: - GitHub contributors page - DESCRIPTION file (for significant contributions) - Release notes

Code of conduct

Be respectful and inclusive. We’re all here to improve unifres together.

License

By contributing, you agree that your contributions will be licensed under the same license as the project (GPL-3 or later).


Thank you for contributing to unifres! Your efforts help make statistical software better for everyone.