Thank you for your interest in contributing to udspy!
- Clone the repository:
git clone https://github.com/silvestrid/udspy.git
cd udspy- Install dependencies:
# Using uv (recommended)
uv sync
uv pip install -e .
# Or using pip
pip install -e ".[dev]"- Install pre-commit hooks (optional but recommended):
pre-commit install# Run all tests
just test
# Run with coverage
uv run pytest --cov=src tests/
# Run specific test file
uv run pytest tests/test_history.py -v# Format code
just fmt
# Run linter
just lint
# Type check
just typecheck
# Run all checks
just check# Build and serve docs locally
just docs-serve
# Or directly with mkdocs
mkdocs serveThen visit http://127.0.0.1:8000
- Create a branch:
git checkout -b feature/your-feature-name - Make your changes: Write code, tests, and documentation
- Run checks: Ensure all tests pass and code is formatted
- Commit: Use conventional commits (see below)
- Push:
git push origin feature/your-feature-name - Open PR: Describe your changes and link related issues
We use Conventional Commits for commit messages:
feat:- New featuresfix:- Bug fixesdocs:- Documentation changesrefactor:- Code refactoringtest:- Test additions or changeschore:- Build process or auxiliary tool changes
Examples:
feat: add History class for conversation management
fix: handle None values in default_model property
docs: add examples for optional tool execution
refactor: split large astream method into smaller functions
Releases are created through a branch-based workflow with automated GitHub Actions. Here's the complete process:
Use the bump-release just command to automate the version bump and branch creation:
just bump-release 0.2.0This command will:
- Run all pre-release checks (lint, tests, docs, build)
- Create a new branch
release/v0.2.0 - Update version in
pyproject.toml - Update lockfile (
uv.lock) - Commit the changes
- Push the release branch to GitHub
The command will output next steps when complete.
After the release branch is pushed:
- Go to GitHub and create a PR from
release/v0.2.0tomain - Add title: "chore: release v0.2.0"
- Add description summarizing the changes in this release
- Request review if needed
Once the PR is approved and CI passes:
- Merge the PR to
main - The version bump is now in the main branch
After the PR is merged, create and push the release tag:
just create-release-tag 0.2.0This command will:
- Check out the
mainbranch - Pull the latest changes
- Verify the version is in
pyproject.toml - Create annotated tag
v0.2.0 - Push the tag to GitHub
Once the tag is pushed, GitHub Actions will automatically:
- Run all tests
- Build the package
- Publish to PyPI (requires PyPI trusted publishing setup)
- Generate changelog from commits
- Create GitHub release with changelog
- Comment on related issues
- Check PyPI for the new version
- Check GitHub Releases for the release notes
- Verify documentation is updated at the docs site
# Full release workflow
just bump-release 0.2.0 # Create release branch and PR
# ... merge PR on GitHub ...
just create-release-tag 0.2.0 # Create and push tag after merge
# Pre-release checks only (optional)
just release-check # Run all CI checks locallyFor automated PyPI publishing to work, you need to set up Trusted Publishing:
- Go to PyPI Trusted Publishing
- Add a new publisher:
- Owner:
silvestrid - Repository:
udspy - Workflow:
release.yml - Environment: leave blank
- Owner:
This allows GitHub Actions to publish directly without API tokens.
Documentation is automatically published to GitHub Pages on every push to main:
- Go to repository Settings > Pages
- Set Source to "Deploy from a branch"
- Select branch:
gh-pages - Click Save
The docs will be available at: https://silvestrid.github.io/udspy/
- Follow PEP 8 guidelines
- Use type hints for all function signatures
- Keep functions short and focused (5-20 lines when possible)
- Write docstrings for all public APIs (Google style)
- Add tests for all new features and bug fixes
- Write tests for all new features
- Maintain or improve code coverage (target: >85%)
- Use descriptive test names:
test_<what>_<condition>_<expected> - Mock external API calls (OpenAI)
- Test both sync and async code paths
Feel free to open an issue for:
- Questions about contributing
- Feature requests
- Bug reports
- Documentation improvements
Thank you for contributing! 🎉