Contributing to SpectroChemPy

General Principles

Any kind of contribution is welcome! While we encourage following these guidelines, don’t let them prevent you from contributing. This guide covers both basic contributions like issue reporting and advanced topics like code development.

For information about reporting issues, please see the issues page.

Getting Started with Development

Version Control Setup

  1. Create a GitHub account if you haven’t already

  2. Install Git:

    • macOS: Via XCode or git-scm.com or Homebrew using brew install git

    • Windows: From git-scm.com

    • Linux: use your distribution package manager, for example sudo apt-get install git

Optional: Install a GUI client like SourceTree or GitHub Desktop

Setting Up Your Development Environment

  1. Fork the repository on GitHub

  2. Clone your fork:

    git clone https://github.com/your-user-name/spectrochempy.git
    cd spectrochempy
    git remote add upstream https://github.com/spectrochempy/spectrochempy.git
    
  3. Create a Python virtual environment:

    python3 -m venv .venv
    source .venv/bin/activate
    
  4. Install SpectroChemPy in development mode:

    python -m pip install --upgrade pip
    python -m pip install -e ".[dev]"  # Installs development and test dependencies
    # or
    python -m pip install -e ".[dev, docs]"  # Installs development, test and documentation dependencies
    

Making Changes

  1. Create a feature branch:

    git switch -c my-new-feature
    
  2. Make your changes and commit them:

    git add modified-files
    git commit -m "ENH: Your descriptive commit message"
    

    Commit and pull request title prefix conventions: * ENH: Enhancement * FIX: Bug fix * DOC: Documentation * TEST: Testing * CI: CI/CD and workflow changes * DEV: Developer tooling * PERF: Performance * MAINT: Maintenance * REL: Release-related work

  3. Push to GitHub:

    git push origin my-new-feature
    
  4. Create a Pull Request on GitHub

Maintaining Your PR

To update your PR with upstream changes:

git switch my-new-feature
git fetch upstream
git merge upstream/master
git push origin my-new-feature

Before asking for review, use the pull request template as the source of truth for required items. In practice, make sure your branch is focused and that the checks matching your change have been run locally when practical:

  • targeted tests around the changed code

  • an entry in docs/sources/whatsnew/changelog.rst when the change affects users, developers, tests, CI, packaging, or documentation

  • any new dependencies, public API entries, contributor metadata, or reference docs requested by the pull request template

  • pre-commit run --all-files for formatting and generated docs files before the final commit when practical

Tips for Success

  • Reference related issues

  • Keep changes focused and PRs small

  • Ensure tests pass

  • Update your PR regularly

  • Follow the code style guidelines

Maintainer and Release Notes

Some project-maintenance procedures are documented separately in the maintainers/ directory. These notes cover operational topics such as release publishing, PyPI/TestPyPI behavior, conda builds, Zenodo issues, and emergency recovery procedures.

See the maintainers/ directory for details.