Contributing to the Clearstone SDK¶
We're thrilled you're interested in contributing to the Clearstone SDK! Your contributions help us build a more robust and reliable toolkit for the entire AI agent ecosystem. This document provides guidelines to ensure a smooth and effective contribution process.
How Can I Contribute?¶
There are many ways to contribute, and all are valuable. Here are a few ideas:
- 🐛 Reporting Bugs: If you find a bug, please open an issue and provide as much detail as possible, including steps to reproduce it.
- ✨ Suggesting Enhancements: Have an idea for a new feature, a pre-built policy, or an improvement to an existing one? We'd love to hear it. Open an issue with the "enhancement" label.
- 📝 Improving Documentation: If you find parts of the documentation that are unclear, confusing, or incomplete, a pull request with improvements is highly appreciated.
- 💻 Contributing Code: If you're ready to write some code, you can pick up an existing issue or propose a new feature of your own.
Development Setup¶
To get started with the codebase, you'll need to set up a local development environment.
Prerequisites¶
- Git
- Python 3.10+
- A fork of the repository.
Step-by-Step Guide¶
-
Fork & Clone the Repository
First, fork the repository to your own GitHub account. Then, clone your fork locally:
-
Create a Virtual Environment
It is highly recommended to work inside a Python virtual environment to isolate project dependencies.
-
Install Dependencies
Install the package in "editable" mode along with all development dependencies (like
pytest,black, andruff). This allows you to edit the code and have the changes immediately reflected. -
Run the Test Suite
Before making any changes, ensure that the existing test suite passes. This is a crucial first step.
Pull Request Process¶
We follow a standard, automated pull request workflow.
-
Create a Feature Branch
Create a new branch from
mainfor your changes. Please use a descriptive name. -
Make Your Changes
Write your code! Follow the existing code style and structure. Remember to add docstrings and type hints.
-
Add or Update Tests
Any new feature or bug fix must be accompanied by tests. * Bug fixes should include a test that fails without the fix and passes with it. * New features must have corresponding unit or integration tests.
-
Format and Lint Your Code (CRITICAL STEP)
Before committing, you must run our automated formatting and linting tools. Our CI pipeline will fail your pull request if this step is skipped.
-
Ensure All Local Checks Pass
Run the full test suite one last time to ensure you haven't introduced any regressions.
-
Submit the Pull Request
Push your branch to your fork and open a pull request against the
mainbranch of the original repository. * Our GitHub Actions CI will automatically run all tests and style checks. All checks must pass before the PR can be merged. * Use a clear and descriptive title (e.g., "feat: Add PolicyMetrics collector for observability"). * Provide a detailed description of the changes. * If your PR addresses an existing issue, link it usingFixes #123.
Coding Style Guide¶
- Our code style is enforced automatically by Black (for formatting) and Ruff (for linting).
- Please run
black .andruff check . --fixbefore committing your changes. - Docstrings should follow the Google Python Style Guide.
Code of Conduct¶
This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to the project maintainers.
License Agreement¶
By contributing to the Clearstone SDK, you agree that your contributions will be licensed under its MIT License.