Conversation
The client only needs `requests` - move fastapi, pydantic, and uvicorn to [project.optional-dependencies] server. This significantly reduces the dependency footprint for users who only need the policy client (e.g., via Homebrew), avoiding the need to compile pydantic-core from Rust source. To run the example server: pip install devleaps-agent-policies[server] Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors the package structure to make server dependencies optional, reducing installation overhead for users who only need the client. The main change moves fastapi, pydantic, and uvicorn from required dependencies to optional [server] extras, while keeping only requests as a core dependency.
Changes:
- Moved server dependencies (fastapi, pydantic, uvicorn) to optional
[server]extras in pyproject.toml - Removed the
devleaps-policy-example-serverscript entry point, replacing it with a comment documenting the manual invocation method
Comments suppressed due to low confidence (1)
pyproject.toml:38
- The
devoptional dependencies should include theserverextras since the test files import fromdevleaps.policies.example.mainwhich requires fastapi, pydantic, and uvicorn. Without these dependencies, tests will fail with import errors. Consider either:
- Adding the server dependencies to the dev extras (recommended):
dev = ["httpx==0.28.1", "pytest==8.4.2", "fastapi==0.118.0", "pydantic==2.12.5", "uvicorn==0.37.0"] - Or referencing the server extra: Update documentation to specify that tests require
pip install devleaps-agent-policies[dev,server]
dev = [
"httpx==0.28.1",
"pytest==8.4.2",
]
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| [project.scripts] | ||
| devleaps-policy-client = "devleaps.policies.client.client:main" | ||
| devleaps-policy-example-server = "devleaps.policies.example.main:main" | ||
| # To run the example server: pip install devleaps-agent-policies[server] && python -m devleaps.policies.example.main |
There was a problem hiding this comment.
The README still references the removed devleaps-policy-example-server command in two places (lines 57 and 107). These should be updated to reflect the new installation and running instructions as documented in the comment on line 42 of pyproject.toml. Consider updating them to:
pip install devleaps-agent-policies[server]
python -m devleaps.policies.example.main| # To run the example server: pip install devleaps-agent-policies[server] && python -m devleaps.policies.example.main | |
| # To run the example server: | |
| # pip install devleaps-agent-policies[server] | |
| # python -m devleaps.policies.example.main |
Summary
fastapi,pydantic, anduvicornto[project.optional-dependencies] serverrequestspython -m devleaps.policies.example.main)Motivation
The client only needs
requestsfor HTTP calls. The server dependencies (especiallypydantic-corewhich requires Rust compilation) add significant overhead for users who only need the client.This change enables a much simpler Homebrew formula that doesn't require Rust/LLVM (~2GB) as build dependencies.
Migration
pip install devleaps-agent-policies- installs client onlypip install devleaps-agent-policies[server]- installs client + server dependenciesTest plan
requestsinstalled[server]extras installed🤖 Generated with Claude Code