Skip to content

Latest commit

 

History

History
200 lines (142 loc) · 4.26 KB

CONTRIBUTING.md

File metadata and controls

200 lines (142 loc) · 4.26 KB

Contributing to Tender Reformatter

Thank you for your interest in contributing! This document provides guidelines and instructions for contributing.

🚀 Getting Started

Development Setup

  1. Fork and clone the repository

    git clone https://github.com/yourusername/tender-reformatter.git
    cd tender-reformatter
  2. Install dependencies

    poetry install
    poetry install --extras local  # For local LLM support
  3. Install pre-commit hooks

    pre-commit install
  4. Run tests to verify setup

    pytest tests/ -v

📝 Development Workflow

1. Create a Feature Branch

git checkout -b feature/your-feature-name

2. Make Your Changes

  • Write clear, documented code
  • Add type hints for all functions
  • Update tests for any new functionality
  • Update documentation as needed

3. Run Quality Checks

# Format code
black src/ tests/
isort src/ tests/

# Lint
ruff check src/ tests/

# Type check
mypy src/

# Run tests
pytest tests/ -v --cov=tender_reformatter

4. Commit Your Changes

git add .
git commit -m "feat: add new feature"

We follow Conventional Commits:

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation changes
  • test: Test additions/changes
  • refactor: Code refactoring
  • perf: Performance improvements

5. Push and Create Pull Request

git push origin feature/your-feature-name

Then open a Pull Request on GitHub.

🧪 Testing Guidelines

Writing Tests

  • Place unit tests in tests/unit/
  • Place integration tests in tests/integration/
  • Use descriptive test names: test_<what>_<condition>_<expected>
  • Aim for >90% code coverage

Example Test

def test_detector_handles_empty_line():
    """Test that empty lines are correctly classified."""
    detector = RegexDetector()
    result = detector.detect("\n\n")
    assert result.tokens[0].type == StructureType.EMPTY_LINE

📚 Documentation Guidelines

  • Update README.md for user-facing changes
  • Add docstrings for all public functions/classes
  • Use Google-style docstrings
  • Include type hints

Example Docstring

def detect(self, text: str) -> DetectionResult:
    """
    Detect document structure in the given text.
    
    Args:
        text: Raw text to analyze
        
    Returns:
        DetectionResult containing classified tokens
        
    Raises:
        ValueError: If text is empty or invalid
        
    Example:
        >>> detector = RegexDetector()
        >>> result = detector.detect("# Title")
        >>> print(result.tokens[0].type)
        StructureType.HEADING_1
    """

🎯 Areas for Contribution

High Priority

  • Additional patterns: Improve regex detection for edge cases
  • Test coverage: Add more unit and integration tests
  • Documentation: Add examples, tutorials, notebooks

Medium Priority

  • Performance: Optimize detection algorithms
  • Features: Support for other document types
  • Integrations: Connect with popular RAG frameworks

Research Contributions

  • Datasets: Curate and annotate French tender documents
  • Benchmarks: Comparative studies with other approaches
  • Models: Fine-tuned models for document structure

🐛 Bug Reports

When reporting bugs, please include:

  1. Description: Clear description of the bug
  2. Reproduction: Minimal code to reproduce
  3. Expected behavior: What should happen
  4. Actual behavior: What actually happens
  5. Environment: Python version, OS, package versions

💡 Feature Requests

For feature requests, please:

  1. Check if it's already requested in Issues
  2. Describe the use case
  3. Explain why it's important
  4. Provide examples if possible

📜 Code Style

We use:

  • Black for code formatting (line length: 100)
  • isort for import sorting
  • Ruff for linting
  • mypy for type checking (strict mode)

All checks must pass before merging.

🏆 Recognition

Contributors will be:

  • Listed in CONTRIBUTORS.md
  • Mentioned in release notes
  • Credited in academic citations

❓ Questions?

Feel free to:

  • Open a Discussion on GitHub
  • Ask in Pull Request comments
  • Email the maintainers

Thank you for contributing! 🎉