This guide covers development workflows, architecture decisions, and contribution guidelines for the Keycard Python SDK.
- Clone the repository:
git clone git@github.com:keycardai/python-sdk.git
cd python-sdk- Install the workspace:
uv syncThe project includes comprehensive documentation built with Mint. To view the docs locally:
# Using just (recommended)
just docs
# Or directly with npx
cd docs && npx --yes mint@latest devThis will start a local documentation server (typically at http://localhost:3000) with:
- API reference for all packages
- Usage examples
- Integration guides
- Architecture decisions
To regenerate the API reference documentation:
# Generate docs for all packages
just sdk-ref-all
# Or generate for specific packages
just sdk-ref-oauth
just sdk-ref-mcp
just sdk-ref-mcp-fastmcpThis project uses uv workspaces to manage multiple related packages. Each package lives in the packages/ directory and has its own pyproject.toml.
# Install all dependencies
uv sync
# Run tests
just test
# or: uv run pytest
# Lint and format code
just check # Check for issues
just fix # Fix auto-fixable issues
just fix-all # Fix all issues (including unsafe fixes)
# Type checking
just typecheck
# or: uv run mypy .
# Build packages
just build- Install all dependencies:
uv sync - Run commands in the workspace root:
uv run <command> - Run commands in a specific package:
uv run --package <package-name> <command> - Add dependencies to the workspace: Add to the root
pyproject.toml - Add dependencies to a specific package: Add to the package's
pyproject.toml
- Create a new directory in
packages/ - Initialize the package:
uv init packages/your-package-name - Update the package's
pyproject.tomlwith appropriate metadata - The package will automatically be included in the workspace
python-sdk/
├── pyproject.toml # Workspace root configuration
├── justfile # Task runner commands
├── README.md # User-facing documentation
├── DEVELOPER.md # This file - developer documentation
├── docs/ # Documentation
│ ├── docs.json # Mint documentation config
│ ├── examples/ # Usage examples
│ ├── sdk/ # Auto-generated API reference
│ └── standards/ # Development standards
├── packages/ # Individual packages
│ ├── oauth/ # OAuth 2.0 implementation
│ ├── mcp/ # Core MCP utilities
│ └── mcp-fastmcp/ # FastMCP integration
├── src/ # Workspace-level source
└── uv.lock # Shared lockfile
Using a uv workspace provides several advantages:
- Consistent Dependencies: All packages share the same lockfile, ensuring consistent versions
- Cross-package Development: Easy to develop and test packages that depend on each other
- Simplified CI/CD: Single lockfile and unified testing across all packages
- Shared Development Tools: Common linting, formatting, and testing configuration
Important architectural and design decisions are documented using Architecture Decision Records (ADRs). These help explain the reasoning behind key technical choices in the project.
- ADR-0001: Use uv Workspaces for Multi-Package Development
- ADR-0002: Modular Package Structure for Minimal Dependencies
- ADR-0003: Use Commitizen for Commit Validation and Changelog Management
- Fork the repository
- Create a feature branch
- Make your changes
- Run the development tools to ensure quality:
just test # Run tests just check # Lint code just typecheck # Type checking
We use Conventional Commits with specific scopes for our monorepo structure:
Format: <type>(<scope>): <description>
Required Scopes:
keycardai-oauth: Changes to the OAuth packagekeycardai-mcp: Changes to the core MCP packagekeycardai-mcp-fastmcp: Changes to the FastMCP integrationdeps: Dependency updatesdocs: Documentation updates
Common Types: feat, fix, docs, style, refactor, test, chore, ci
Examples:
feat(keycardai-oauth): add PKCE support for enhanced security
fix(keycardai-mcp-fastmcp): resolve connection timeout in auth middleware
docs(keycardai-oauth): update API documentation with new examples
chore(deps): update httpx to v0.25.0 for security patchImportant Notes:
- Squash commits before merging - only the final commit message appears in changelog
- Scoped commits automatically appear in generated changelogs
- Use
git commit --amendto fix commit messages if needed - Preview changelog generation with:
just changelog-preview