Contributing Guide¶
We welcome contributions to the azure-functions-openapi project.
Getting Started¶
- Fork the repository on GitHub.
- Clone your fork locally:
git clone https://github.com/<your-username>/azure-functions-openapi-python.git
cd azure-functions-openapi-python
- Set up the development environment:
This creates a Hatch-managed virtual environment and installs pre-commit hooks.
Branch Strategy¶
This project uses GitHub Flow. Branch from main and merge back to main.
Recommended branch prefixes:
| Prefix | Purpose |
|---|---|
feat/ |
New features |
fix/ |
Bug fixes |
docs/ |
Documentation-only changes |
chore/ |
Tooling and maintenance |
ci/ |
Workflow updates |
refactor/ |
Code restructuring without behavior change |
Example:
Development Workflow¶
- Create a feature branch from
main. - Implement changes in
src/azure_functions_openapi/and add corresponding tests intests/. - Run the local quality gate:
This runs linting (Ruff), type checking (mypy), and the full test suite.
- Commit changes using Conventional Commits format:
- Push and open a Pull Request to
main.
Commit Message Format¶
Titles for issues, pull requests, and commits follow the Title Convention in CONTRIBUTING.md, the single source of truth for the format and the allowed types.
Pull Request Guidelines¶
Before submitting¶
- Run
make check-alland verify it passes. - Ensure new code has test coverage. The suite is gated at 95% (
fail_under = 95inpyproject.toml). - Update documentation if the change affects public API or behavior.
- Keep the PR focused on a single concern.
PR description¶
Describe what changed and why. Reference related issues with Fixes #N or Closes #N.
Review process¶
- Branch protection does not require a review approval; the required CI checks are the merge gate. Maintainers still review anything beyond a trivial change.
- CI must pass on all Python versions (3.11 -- 3.14).
- Merge with "Squash and merge" to keep the commit history clean.
Code Style¶
Formatting¶
- Ruff does everything: formatting, linting, and import sorting. There is no Black in this project.
ruff formatandruff checkboth run as pre-commit hooks.
Type annotations¶
- All public functions must have complete type annotations.
- Use Python 3.11+ syntax.
mypystrict mode is enforced in CI.
Naming conventions¶
| Element | Convention | Example |
|---|---|---|
| Functions | snake_case |
generate_openapi_spec |
| Classes | PascalCase |
BaseModel |
| Constants | UPPER_SNAKE_CASE |
OPENAPI_VERSION_3_0 |
| Private | _leading_underscore |
_validate_route |
Quality Gates¶
Makefile targets¶
| Target | Description |
|---|---|
make format |
Format code with ruff format |
make format-check |
Check formatting without writing |
make style |
ruff check + ruff format --check |
make lint |
Run Ruff + mypy |
make typecheck |
Run mypy type checking |
make security |
Run Bandit security scan |
make test |
Run pytest |
make cov |
Run tests with coverage (gated at 95%) |
make lint-workflows |
Lint release workflows, action pins, Hatch matrix |
make check |
Run lint + typecheck |
make check-all |
Run lint-workflows + check + test + security (full gate) |
make docs |
Build the MkDocs site |
See Development Guide for the complete list.
Pre-commit hooks¶
| Tool | Purpose |
|---|---|
| Ruff | Formatter, linter, and import sorter |
| mypy | Static type checker |
| Bandit | Security scanner (src/ only) |
Pinned versions live in .pre-commit-config.yaml (hook rev) and
pyproject.toml (the dev dependency pins), so they are not duplicated here.
Run all hooks manually:
Example Coverage Policy¶
Examples in examples/ are part of the supported API experience. They must remain
functional and have smoke test coverage.
- Keep one representative example for the minimal OpenAPI workflow (
webhook_receiver). - Keep one complex example for multi-endpoint behavior (
report_jobs). - Keep one integration example (
notification_request). - Add or update smoke tests whenever an example changes.
Reporting Issues¶
Open an issue on GitHub with:
- A clear description of the problem or feature request.
- Steps to reproduce (for bugs).
- Expected vs. actual behavior.
- Python version, azure-functions version, and OS.
Code of Conduct¶
Be respectful and inclusive. See the Code of Conduct for details.