DSPy is an actively growing project and community! We welcome your contributions and involvement. Below are instructions for how to contribute to DSPy.
The fastest way to contribute is to find open issues that need an assignee. We maintain two lists of GitHub tags for contributors:
- good first issue: a list of small, well-defined issues for newcomers to the project.
- help wanted: a list of issues that welcome community contributions. These issues have a wide range of complexity.
We also welcome new ideas! If you would like to propose a new feature, please open a feature request to discuss. If you already have a design in mind, please include a notebook/code example to demonstrate your idea. Keep in mind that designing a new feature or use case may take longer than contributing to an open issue.
Follow these steps to submit your code contribution.
Before making any changes, we recommend opening an issue (if one doesn't already exist) and discussing your proposed changes. This way, we can give you feedback and validate the proposed changes.
If your code change involves fixing a bug, please include a code snippet or notebook to show how to reproduce the broken behavior.
For minor changes (simple bug fixes or documentation fixes), feel free to open a PR without discussion.
To make code changes, fork the repository and set up your local development environment following the instructions in the "Environment Setup" section below.
Once your changes are ready, open a pull request from your branch in your fork to the main branch in the DSPy repo.
Once your PR is up and passes all CI tests, we will assign reviewers to review the code. There may be several rounds of comments and code changes before the pull request gets approved by the reviewer.
Once the pull request is approved, a team member will take care of merging.
Python 3.9 or later is required.
Setting up your DSPy development environment requires you to fork the DSPy repository and clone it locally. If you are not familiar with the GitHub fork process, please refer to Fork a repository. After creating the fork, clone it to your local development device:
git clone {url-to-your-fork}
cd dspy
Next, we must set up a Python environment with the correct dependencies. There are two recommended ways to set up the dev environment.
uv is a rust-based Python package and project manager that provides a fast way to set up the development environment. First, install uv by following the installation guide.
After uv is installed, in your working directory (dspy/
), run:
uv sync --extra dev
Then you are all set!
To verify that your environment is set up successfully, run some unit tests:
uv run pytest tests/predict
Note: You need to use the uv run
prefix for every Python command, as uv creates a Python virtual
environment and uv run
points the command to that environment. For example, to execute a Python script you will need
uv run python script.py
.
You can also set up the virtual environment via conda + pip, which takes a few extra steps but offers more flexibility. Before starting, make sure you have conda installed. If not, please follow the instructions here.
To set up the environment, run:
conda create -n dspy-dev python=3.11
conda activate dspy-dev
pip install -e ".[dev]"
Then verify the installation by running some unit tests:
pytest tests/predict