mirror of https://github.com/dapr/dapr-agents.git
* fix: speed up deps installed + handle errs in quickstarts better Signed-off-by: Samantha Coyle <sam@diagrid.io> * docs: update docs to use uv too Signed-off-by: Samantha Coyle <sam@diagrid.io> * docs: add mapping on cmds for myself Signed-off-by: Samantha Coyle <sam@diagrid.io> --------- Signed-off-by: Samantha Coyle <sam@diagrid.io> |
||
|---|---|---|
| .. | ||
| README.md | ||
README.md
Development Guide
Dependencies
This project uses modern Python packaging with pyproject.toml. Dependencies are managed as follows:
- Main dependencies are in
[project.dependencies] - Test dependencies are in
[project.optional-dependencies.test] - Development dependencies are in
[project.optional-dependencies.dev]
Working within a virtual environment
Create your python virtual environment:
python -m venv venv
source venv/bin/activate
Generating Requirements Files
If you need to generate requirements files (e.g., for deployment or specific environments):
Option 1 - Using pip-tools:
# Install dev tools
pip install -e ".[dev]"
# Generate requirements.txt
pip-compile pyproject.toml
# Generate dev-requirements.txt
pip-compile pyproject.toml # --extra dev
Option 2 - Using uv:
# Generate lock file with all dependencies
uv lock --all-extras
# Install everything from lock file
uv sync --all-extras
Installing Dependencies
Option 1 - Using pip:
# Install main package with test dependencies
pip install -e ".[test]"
# Install main package with development dependencies
pip install -e ".[dev]"
# Install main package with all optional dependencies
pip install -e ".[test,dev]"
Option 2 - Using uv:
# Install main package with test dependencies
uv sync --extra=test
# Install main package with development dependencies
uv sync --extra=dev
# Install main package with all optional dependencies
uv sync --all-extras
# Install in editable mode with all extras
uv sync --all-extras --editable
Command Mapping
| pip/pip-tools command | uv equivalent |
|---|---|
pip-compile pyproject.toml |
uv lock |
pip-compile --all-extras |
uv lock (automatic) |
pip install -r requirements.txt |
uv sync |
pip install -e . |
uv sync --editable |
pip install -e ".[dev]" |
uv sync --extra=dev |
pip install -e ".[test,dev]" |
uv sync --all-extras |
Testing
The project uses pytest for testing. To run tests:
# Run all tests
tox -e pytest
# Run specific test file
tox -e pytest tests/test_random_orchestrator.py
# Run tests with coverage
tox -e pytest --cov=dapr_agents
Code Quality
The project uses several tools to maintain code quality:
# Run linting
tox -e flake8
# Run code formatting
tox -e ruff
# Run type checking
tox -e type
Development Workflow
Option 1 - Using pip:
-
Install development dependencies:
pip install -e ".[dev]" # Alternatively, you can use uv with: # uv sync --extra=dev -
Run tests before making changes:
tox -e pytest -
Make your changes
-
Run code quality checks:
tox -e flake8 tox -e ruff tox -e type -
Run tests again:
tox -e pytest -
Submit your changes