|
| 1 | +# Contributing to `execlave-sdk` |
| 2 | + |
| 3 | +Thanks for wanting to contribute! This project is the official Python SDK for the Execlave AI Governance Platform. |
| 4 | + |
| 5 | +## Ground rules |
| 6 | + |
| 7 | +1. **By contributing, you agree your work will be released under the MIT licence** (see `LICENSE`). |
| 8 | +2. **Be kind.** See [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md). |
| 9 | +3. **Security issues go to `security@execlave.com`**, never to a public issue. See [SECURITY.md](SECURITY.md). |
| 10 | + |
| 11 | +## Development setup |
| 12 | + |
| 13 | +```bash |
| 14 | +# Fork, then clone |
| 15 | +git clone https://github.com/<you>/execlave-python-sdk |
| 16 | +cd execlave-python-sdk |
| 17 | + |
| 18 | +# Editable install with dev + test extras |
| 19 | +python -m venv .venv |
| 20 | +source .venv/bin/activate # or .venv\Scripts\activate on Windows |
| 21 | +pip install -e ".[test]" |
| 22 | + |
| 23 | +# Run the full test suite |
| 24 | +pytest |
| 25 | + |
| 26 | +# Run a single file |
| 27 | +pytest tests/test_client.py -v |
| 28 | +``` |
| 29 | + |
| 30 | +Python 3.11+ is required. The project uses `flit` for packaging and `pytest` for testing. |
| 31 | + |
| 32 | +## Project layout |
| 33 | + |
| 34 | +``` |
| 35 | +execlave/ |
| 36 | +├── client.py # Main Execlave client + enforce_policy |
| 37 | +├── trace.py # Trace class (chainable API) |
| 38 | +├── instrumentation/ # Span + event helpers (shared across integrations) |
| 39 | +├── integrations/ |
| 40 | +│ ├── langchain.py # LangChain callback handler |
| 41 | +│ ├── openai_agents.py # OpenAI Agents SDK tracing processor |
| 42 | +│ └── crewai.py # CrewAI instrument_crew helper |
| 43 | +├── otel.py # OpenTelemetry bridge |
| 44 | +└── connectors.py # (Deprecated) run_langchain |
| 45 | +tests/ # pytest suite |
| 46 | +``` |
| 47 | + |
| 48 | +## Pull request checklist |
| 49 | + |
| 50 | +- [ ] Tests pass (`pytest`) |
| 51 | +- [ ] Type hints added on any new public function signatures |
| 52 | +- [ ] Docstrings added or updated |
| 53 | +- [ ] `CHANGELOG.md` updated under *Unreleased* if the change is user-visible |
| 54 | +- [ ] No unrelated reformatting (keep diffs small) |
| 55 | +- [ ] For new integrations: pin the target framework's version range in `pyproject.toml` optional-deps |
| 56 | + |
| 57 | +## Adding a new framework integration |
| 58 | + |
| 59 | +1. Add a new module under `execlave/integrations/`. |
| 60 | +2. Import the framework at runtime only (inside `__init__` or a helper). The top-level `execlave` import must never require the framework. |
| 61 | +3. Use `execlave.instrumentation` helpers (`record_llm_call`, `record_tool_call`, `record_agent_action`) rather than driving `Trace` directly. This keeps span semantics consistent. |
| 62 | +4. Call `Execlave.enforce_policy(...)` on every external action (tool call, outbound HTTP, database write). |
| 63 | +5. Add an optional-dependency group in `pyproject.toml` with a pinned range. |
| 64 | +6. Add unit tests that mock the framework — CI does not install the real framework. |
| 65 | +7. Add a docs page at `frontend/app/docs/integrations/<name>/page.tsx` in the monorepo PR. |
| 66 | + |
| 67 | +## Style |
| 68 | + |
| 69 | +- `black` formatting, `ruff` linting (configured in `pyproject.toml`). |
| 70 | +- Prefer composition over inheritance. |
| 71 | +- No `print()` in library code; use `logging`. |
| 72 | +- Never swallow exceptions without logging — fail-open is acceptable for telemetry paths only, and must be logged at `warning`. |
| 73 | + |
| 74 | +## Release process |
| 75 | + |
| 76 | +Releases are driven from the monorepo. Tag `sdk-python/vX.Y.Z` publishes to PyPI via the `sdk-publish.yml` workflow. Versioning follows SemVer. |
| 77 | + |
| 78 | +## Questions? |
| 79 | + |
| 80 | +Open a discussion at <https://github.com/execlave-ai/execlave-python-sdk/discussions> or email `support@execlave.com`. |
0 commit comments