This document provides guidelines for developing and contributing to the ragas project.
-
Fork the Repository Fork the ragas repository on GitHub.
-
Clone your Fork
git clone https://github.com/YOUR_USERNAME/ragas.git cd ragas
-
Set up a Virtual Environment
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install Dependencies
pip install -U setuptools # Required on newer Python versions (e.g., 3.11) pip install -e ".[dev]"
-
Create a New Branch
git checkout -b feature/your-feature-name
-
Make Changes and Commit
git add . git commit -m "Your descriptive commit message"
-
Push Changes to Your Fork
git push origin feature/your-feature-name
-
Create a Pull Request Go to the original ragas repository and create a new pull request from your feature branch.
- Follow PEP 8 guidelines for Python code.
- Use type hints where possible.
- Write docstrings for all functions, classes, and modules.
- Ensure all tests pass before submitting a pull request.
You can run the following command to check for code style issues:
make run-ci
Adding a V=1
option makes the output more verbose, showing normally hidden commands, like so:
make run-ci V=1
To run the test suite:
make test
- Update documentation for any new features or changes to existing functionality.
- Use Google style for docstrings.
- Ensure your code adheres to the project's coding standards.
- Include tests for new functionality.
- Update documentation as necessary.
- Provide a clear description of the changes in your pull request.
Thank you for contributing to ragas!
To view the debug logs for any module, you can set the following.
import logging
# Configure logging for the ragas._analytics module
analytics_logger = logging.getLogger('ragas._analytics')
analytics_logger.setLevel(logging.DEBUG)
# Create a console handler and set its level
console_handler = logging.StreamHandler()
console_handler.setLevel(logging.DEBUG)
# Create a formatter and add it to the handler
formatter = logging.Formatter('%(name)s - %(levelname)s - %(message)s')
console_handler.setFormatter(formatter)
# Add the handler to the logger
analytics_logger.addHandler(console_handler)