Thank you for your interest in contributing to the Functions-SDK for Python! This document provides guidelines and instructions for contributing to this project.
- Getting Started
- Development Setup
- Development Workflow
- Code Quality
- Testing
- Documentation
- Submitting Changes
- Project Structure
- Python 3.10 or higher
- uv (recommended) or pip
- Git
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/functions-sdk-python.git cd functions-sdk-python - Add the upstream repository:
git remote add upstream https://github.com/cslab/functions-sdk-python.git
This project uses uv for dependency management:
# Install dependencies
uv sync
# Activate the virtual environment
source .venv/bin/activate # On Linux/macOS
# or
.venv\Scripts\activate # On WindowsAlternatively, you can use pip:
# Create a virtual environment
python -m venv .venv
source .venv/bin/activate # On Linux/macOS
# Install the package in editable mode with dev dependencies
pip install -e ".[dev,test]"We use pre-commit hooks to ensure code quality:
# Install pre-commit
pip install pre-commit
# Set up the git hooks
pre-commit installThe hooks will run automatically on every commit. You can also run them manually:
pre-commit run --all-filesCreate a feature branch for your changes:
git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fix- Make your changes in your feature branch
- Write or update tests as needed
- Update documentation if you're changing functionality
- Ensure all tests pass
- Commit your changes with clear, descriptive commit messages
Follow these guidelines for commit messages:
- Use the present tense ("Add feature" not "Added feature")
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
- Start with a type prefix:
feat:for new featuresfix:for bug fixesdocs:for documentation changestest:for test changeschore:for maintenance tasksrefactor:for code refactoring
Example:
feat: Add support for workflow task triggers
- Implement WorkflowTaskTriggerEvent class
- Add event handler documentation
- Include usage examples
This project uses several tools to maintain code quality:
We use Ruff for linting and formatting:
# Run linter
ruff check .
# Run linter with auto-fix
ruff check --fix .
# Run formatter
ruff format .We use MyPy for static type checking:
mypy csfunctionsWe use Bandit for security linting:
bandit -r csfunctionsAll these checks run automatically via pre-commit hooks.
- Line length: 120 characters
- Use type hints for all function parameters and return values
- Follow PEP 8 style guidelines
- Use descriptive variable and function names
- Add docstrings to public classes and functions
Run the test suite using pytest:
# Run all tests
pytest
# Run with coverage
pytest --cov=csfunctions
# Run specific test file
pytest tests/test_handler.py
# Run specific test
pytest tests/test_handler.py::test_specific_function- Write tests for all new features and bug fixes
- Place tests in the
tests/directory - Use descriptive test names that explain what is being tested
- Follow the existing test structure and patterns
- Aim for high test coverage
The project uses MkDocs with Material theme:
# Serve documentation locally
mkdocs serve
# Build documentation
mkdocs buildVisit http://127.0.0.1:8000 to view the documentation locally.
- Update relevant documentation in the
docs/directory when changing functionality - Include examples for new features
- Keep the API reference up to date
- Update the release notes for significant changes
If you modify request/response structures, regenerate the JSON schemas:
python -m csfunctions.tools.write_schemaUpdate the documentation tables:
python -m tools.mdtable- Ensure all tests pass:
pytest - Ensure code quality checks pass:
pre-commit run --all-files - Update documentation as needed
- Update or add tests for your changes
- Rebase your branch on the latest upstream main:
git fetch upstream git rebase upstream/main
-
Push your branch to your fork:
git push origin feature/your-feature-name
-
Create a pull request on GitHub with:
- A clear title describing the change
- A detailed description of what changed and why
- References to any related issues
- Screenshots or examples if applicable
-
Wait for review and address any feedback
- Keep pull requests focused on a single feature or fix
- Ensure CI checks pass
- Respond to review comments in a timely manner
- Be open to feedback and suggestions
- Update your PR based on feedback
functions-sdk-python/
├── csfunctions/ # Main package
│ ├── actions/ # Action implementations
│ ├── events/ # Event type definitions
│ ├── objects/ # Object models (Part, Document, etc.)
│ ├── service/ # Service implementations
│ └── tools/ # Development tools
├── tests/ # Test suite
├── docs/ # Documentation source
├── json_schemas/ # JSON schema definitions
├── tools/ # Development utilities
├── pyproject.toml # Project configuration
├── Makefile # Build commands
└── mkdocs.yml # Documentation configuration
If you have questions or run into problems:
- Check the documentation
- Open an issue on GitHub
- Review existing issues and pull requests
By contributing to this project, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing! 🎉