Contributing
Contributing to rtrapy
Thank you for your interest in contributing to rtrapy! We welcome contributions in the form of bug fixes, feature enhancements, and documentation improvements.
Follow the guidelines below to set up your development environment and submit your changes.
Local Development Setup
To begin working on the codebase, follow these steps to set up a local development environment:
-
Fork and Clone: Fork the repository on GitHub and clone it to your local machine:
git clone https://github.com/UditAkhourii/rtrapy.git cd rtrapy -
Create a Virtual Environment: It is recommended to use a virtual environment to manage dependencies:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate -
Install in Editable Mode: Install the package and its dependencies (
requests) in editable mode so that changes to the code are reflected immediately:pip install -e .
Development Guidelines
When contributing code, please keep the following principles in mind:
- Public Interface: The primary entry point for users is the
RTRAConnectorclass. Ensure that any changes to its public methods (search,combine_search_results, andgenerate_detailed_response) maintain backward compatibility or are clearly documented. - API Configuration: The connector relies on Google Custom Search and Hugging Face. For testing purposes, do not hardcode personal API keys into the codebase. Use environment variables or pass them as arguments during instantiation.
- Code Style: Follow PEP 8 standards for Python code. Ensure your code is readable and includes docstrings for new methods.
Testing Your Changes
Before submitting a Pull Request, verify your changes by running a manual test script. Create a test_run.py (not to be committed) to ensure the connector still functions as expected:
from rtrapy.rtra_connector import RTRAConnector
# Initialize with your dev credentials
connector = RTRAConnector(api_key="YOUR_GOOGLE_API_KEY", engine_id="YOUR_ENGINE_ID")
# Test a search and generation
response = connector.generate_detailed_response("How does RAG work?")
print(response)
Pull Request Process
- Branching: Create a new branch for your feature or fix:
git checkout -b feature/your-feature-name - Commit: Write clear, concise commit messages.
- Push: Push your branch to your forked repository:
git push origin feature/your-feature-name - Open a PR: Open a Pull Request on the main
rtrapyrepository. Provide a detailed description of the changes and any issue numbers being addressed.
Reporting Issues
If you find a bug or have a feature request, please open an issue on the GitHub repository. Provide as much context as possible, including your Python version and steps to reproduce the behavior.