|
| 1 | +# Contributing to OpenAI Agents SDK |
| 2 | + |
| 3 | +Thank you for your interest in contributing to the OpenAI Agents SDK! This document provides guidelines and instructions to help you contribute effectively. |
| 4 | + |
| 5 | +## Table of Contents |
| 6 | + |
| 7 | +- [Code of Conduct](#code-of-conduct) |
| 8 | +- [Getting Started](#getting-started) |
| 9 | + - [Development Environment Setup](#development-environment-setup) |
| 10 | + - [Installing Dependencies](#installing-dependencies) |
| 11 | +- [How to Contribute](#how-to-contribute) |
| 12 | + - [Reporting Bugs](#reporting-bugs) |
| 13 | + - [Suggesting Enhancements](#suggesting-enhancements) |
| 14 | + - [Pull Requests](#pull-requests) |
| 15 | +- [Development Guidelines](#development-guidelines) |
| 16 | + - [Code Style](#code-style) |
| 17 | + - [Testing](#testing) |
| 18 | + - [Documentation](#documentation) |
| 19 | +- [Commit Guidelines](#commit-guidelines) |
| 20 | +- [Community](#community) |
| 21 | + |
| 22 | +## Code of Conduct |
| 23 | + |
| 24 | +We are committed to providing a friendly, safe, and welcoming environment for all contributors. Please read and adhere to our [Code of Conduct](CODE_OF_CONDUCT.md) in all your interactions with the project. |
| 25 | + |
| 26 | +## Getting Started |
| 27 | + |
| 28 | +### Development Environment Setup |
| 29 | + |
| 30 | +1. **Fork the repository** and clone your fork: |
| 31 | + |
| 32 | + ```bash |
| 33 | + git clone https://github.com/YOUR_USERNAME/openai-agents-python.git |
| 34 | + cd openai-agents-python |
| 35 | + ``` |
| 36 | + |
| 37 | +2. **Add the original repository as an upstream remote** to keep your fork in sync: |
| 38 | + |
| 39 | + ```bash |
| 40 | + git remote add upstream https://github.com/openai/openai-agents-python.git |
| 41 | + ``` |
| 42 | + |
| 43 | +### Installing Dependencies |
| 44 | + |
| 45 | +1. **Ensure you have [`uv`](https://docs.astral.sh/uv/) installed**: |
| 46 | + |
| 47 | + ```bash |
| 48 | + uv --version |
| 49 | + ``` |
| 50 | + |
| 51 | +2. **Install development dependencies**: |
| 52 | + |
| 53 | + ```bash |
| 54 | + make sync |
| 55 | + ``` |
| 56 | + |
| 57 | +## How to Contribute |
| 58 | + |
| 59 | +### Reporting Bugs |
| 60 | + |
| 61 | +Before submitting a bug report: |
| 62 | + |
| 63 | +1. Check the [issue tracker](https://github.com/openai/openai-agents-python/issues) to avoid duplicates |
| 64 | +2. Update to the latest version to see if the issue persists |
| 65 | + |
| 66 | +When submitting a bug report, please include: |
| 67 | + |
| 68 | +- A clear, descriptive title |
| 69 | +- Steps to reproduce the issue |
| 70 | +- Expected behavior and actual behavior |
| 71 | +- Environment details (OS, Python version, library versions) |
| 72 | +- Any relevant error messages or logs |
| 73 | + |
| 74 | +### Suggesting Enhancements |
| 75 | + |
| 76 | +Enhancement suggestions are always welcome! Please provide: |
| 77 | + |
| 78 | +- A clear description of the enhancement |
| 79 | +- The motivation behind it |
| 80 | +- Possible implementation approaches if you have any in mind |
| 81 | +- Any relevant examples or use cases |
| 82 | + |
| 83 | +### Pull Requests |
| 84 | + |
| 85 | +To submit a pull request: |
| 86 | + |
| 87 | +1. **Create a new branch** from the main branch: |
| 88 | + |
| 89 | + ```bash |
| 90 | + git checkout main |
| 91 | + git pull upstream main |
| 92 | + git checkout -b feature/your-feature-name |
| 93 | + ``` |
| 94 | + |
| 95 | +2. **Make your changes** and commit them following the [commit guidelines](#commit-guidelines) |
| 96 | + |
| 97 | +3. **Push your branch** to your fork: |
| 98 | + |
| 99 | + ```bash |
| 100 | + git push origin feature/your-feature-name |
| 101 | + ``` |
| 102 | + |
| 103 | +4. **Submit a pull request** to the main branch of the original repository |
| 104 | + |
| 105 | +5. **Update your pull request** based on review feedback |
| 106 | + |
| 107 | +## Development Guidelines |
| 108 | + |
| 109 | +### Code Style |
| 110 | + |
| 111 | +We follow the Python community's style conventions: |
| 112 | + |
| 113 | +- Use [Ruff](https://github.com/astral-sh/ruff) for linting |
| 114 | +- Follow [PEP 8](https://peps.python.org/pep-0008/) style guidelines |
| 115 | +- Use [MyPy](https://mypy.readthedocs.io/en/stable/) for type checking |
| 116 | + |
| 117 | +To check your code: |
| 118 | + |
| 119 | +```bash |
| 120 | +make lint # Run linter |
| 121 | +make mypy # Run type checker |
| 122 | +``` |
| 123 | + |
| 124 | +### Testing |
| 125 | + |
| 126 | +All new features and bug fixes should include tests. We use Python's standard `unittest` framework. |
| 127 | + |
| 128 | +To run tests: |
| 129 | + |
| 130 | +```bash |
| 131 | +make tests |
| 132 | +``` |
| 133 | + |
| 134 | +Please ensure all tests pass before submitting a pull request. |
| 135 | + |
| 136 | +### Documentation |
| 137 | + |
| 138 | +Good documentation is essential for our project: |
| 139 | + |
| 140 | +- Update relevant documentation for any changes you make |
| 141 | +- Use clear docstrings for all functions, classes, and methods |
| 142 | +- Follow [Google style docstrings](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings) |
| 143 | +- Add examples for new features when appropriate |
| 144 | + |
| 145 | +## Commit Guidelines |
| 146 | + |
| 147 | +We follow conventional commits to make the review process easier and maintain a clear history: |
| 148 | + |
| 149 | +- Use a concise summary in the present tense |
| 150 | +- Reference issues and pull requests when relevant |
| 151 | +- Structure your commits logically (one feature/fix per commit) |
| 152 | + |
| 153 | +Examples: |
| 154 | + |
| 155 | +- `feat: add support for custom tool validation` |
| 156 | +- `fix: resolve handoff loop issue` |
| 157 | +- `docs: update tracing documentation` |
| 158 | +- `test: add tests for guardrails functionality` |
| 159 | + |
| 160 | +## Community |
| 161 | + |
| 162 | +- **Issue Tracker**: [GitHub Issues](https://github.com/openai/openai-agents-python/issues) for bugs and feature requests |
| 163 | +- **Documentation**: Refer to our [documentation](https://openai.github.io/openai-agents-python/) for detailed guides |
| 164 | + |
| 165 | +--- |
| 166 | + |
| 167 | +Thank you for contributing to the OpenAI Agents SDK! Your time and expertise help make this project better for everyone. |
0 commit comments