Skip to content

Commit cee485f

Browse files
sicoyleyaron2
andauthored
test: init test setup and some tests + dev docs and proper setup with pyproject.toml (#137)
* test: add init tests and setup for tests Signed-off-by: Samantha Coyle <[email protected]> * style: clean up unused / autogen files now Signed-off-by: Samantha Coyle <[email protected]> * style: ignore req files that we can now autogen Signed-off-by: Samantha Coyle <[email protected]> * style: make linter happy Signed-off-by: Samantha Coyle <[email protected]> * fix(build): pin deps Signed-off-by: Samantha Coyle <[email protected]> * style: update doc ordering Signed-off-by: Samantha Coyle <[email protected]> * fix(build): update imports Signed-off-by: Samantha Coyle <[email protected]> --------- Signed-off-by: Samantha Coyle <[email protected]> Co-authored-by: Yaron Schneider <[email protected]>
1 parent 9c8126b commit cee485f

File tree

15 files changed

+397
-80
lines changed

15 files changed

+397
-80
lines changed

.github/workflows/build.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,7 @@ jobs:
6262
pip install setuptools wheel tox
6363
- name: Check Typing
6464
run: |
65-
tox -e type
65+
tox -e type
66+
- name: Run Tests
67+
run: |
68+
tox -e pytest

.github/workflows/docs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ on:
55
- main
66
paths:
77
- docs/**
8+
- '!docs/development/**'
89
pull_request:
910
branches:
1011
- main
1112
paths:
1213
- docs/**
14+
- '!docs/development/**'
1315
workflow_dispatch:
1416
permissions:
1517
contents: write
@@ -29,6 +31,7 @@ jobs:
2931
docs:
3032
- 'docs/**'
3133
- 'mkdocs.yml'
34+
- '!docs/development/**'
3235
base_sha: 'main'
3336

3437
documentation_validation:

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ test
66

77
# Byte-compiled / optimized / DLL files
88
__pycache__/
9+
**/__pycache__/
910
*.py[cod]
1011
*$py.class
1112

@@ -168,4 +169,8 @@ cython_debug/
168169

169170
.ruff_cache/
170171

171-
quickstarts/05-multi-agent-workflow-dapr-workflows/services/**/*_state.json
172+
quickstarts/05-multi-agent-workflow-dapr-workflows/services/**/*_state.json
173+
174+
# Requirements files since we use pyproject.toml instead
175+
requirements.txt
176+
dev-requirements.txt

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ As a part of **CNCF**, Dapr Agents is vendor-neutral, eliminating concerns about
6666

6767
## Roadmap
6868

69-
Here are some of the major features we're working on for the current quarter:
69+
Here are some of the major features we're working on:
7070

7171
### Q2 2025
7272
- **MCP Support** - Integration with Anthropic's MCP platform ([#50](https://github.com/dapr/dapr-agents/issues/50) ✅ )
@@ -83,7 +83,6 @@ Here are some of the major features we're working on for the current quarter:
8383

8484
For more details about these features and other planned work, please check out our [GitHub issues](https://github.com/dapr/dapr-agents/issues).
8585

86-
8786
### Language Support
8887

8988
| Language | Current Status | Development Status | Stable Status |
@@ -92,6 +91,17 @@ For more details about these features and other planned work, please check out o
9291
| .NET | Planning | Q3 2025 | Q4 2025 |
9392
| Other Languages | Coming Soon | TBD | TBD |
9493

94+
## Documentation
95+
96+
- [Development Guide](docs/development/README.md) - For developers and contributors
97+
98+
## Community
99+
100+
### Contributing to Dapr Agents
101+
102+
Please refer to our [Dapr Community Code of Conduct](https://github.com/dapr/community/blob/master/CODE-OF-CONDUCT.md)
103+
104+
For development setup and guidelines, see our [Development Guide](docs/development/README.md).
95105

96106
## Getting Started
97107

@@ -100,8 +110,6 @@ Prerequisites:
100110
- [Dapr CLI](https://docs.dapr.io/getting-started/install-dapr-cli/)
101111
- [Python 3.10](https://www.python.org/downloads/release/python-3100/)
102112

103-
104-
105113
### Install Dapr Agents
106114

107115
```bash
@@ -121,7 +129,3 @@ Dapr Agents is an open-source project under the CNCF umbrella, and we welcome co
121129
- Documentation: [https://dapr.github.io/dapr-agents/](https://dapr.github.io/dapr-agents/)
122130
- Community Discord: [Join the discussion](https://bit.ly/dapr-discord).
123131
- Contribute: Open an issue or submit a PR to help improve Dapr Agents!
124-
125-
## Code of Conduct
126-
127-
Please refer to our [Dapr Community Code of Conduct](https://github.com/dapr/community/blob/master/CODE-OF-CONDUCT.md)

dapr_agents/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from dapr_agents.agent import (
22
Agent,
3-
AgentActor,
43
ReActAgent,
54
ToolCallAgent,
65
OpenAPIReActAgent,

dapr_agents/agent/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
from .base import AgentBase
22
from .utils.factory import Agent
3-
from .actor import AgentActor
43
from .patterns import ReActAgent, ToolCallAgent, OpenAPIReActAgent

dev-requirements.txt

Lines changed: 0 additions & 21 deletions
This file was deleted.

docs/development/README.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Development Guide
2+
3+
## Dependencies
4+
5+
This project uses modern Python packaging with `pyproject.toml`. Dependencies are managed as follows:
6+
7+
- Main dependencies are in `[project.dependencies]`
8+
- Test dependencies are in `[project.optional-dependencies.test]`
9+
- Development dependencies are in `[project.optional-dependencies.dev]`
10+
11+
### Generating Requirements Files
12+
13+
If you need to generate requirements files (e.g., for deployment or specific environments):
14+
15+
```bash
16+
# Generate requirements.txt
17+
pip-compile pyproject.toml
18+
19+
# Generate dev-requirements.txt
20+
pip-compile pyproject.toml --extra dev
21+
```
22+
23+
### Installing Dependencies
24+
25+
```bash
26+
# Install main package with test dependencies
27+
pip install -e ".[test]"
28+
29+
# Install main package with development dependencies
30+
pip install -e ".[dev]"
31+
32+
# Install main package with all optional dependencies
33+
pip install -e ".[test,dev]"
34+
```
35+
36+
## Testing
37+
38+
The project uses pytest for testing. To run tests:
39+
40+
```bash
41+
# Run all tests
42+
tox -e pytest
43+
44+
# Run specific test file
45+
tox -e pytest tests/test_random_orchestrator.py
46+
47+
# Run tests with coverage
48+
tox -e pytest --cov=dapr_agents
49+
```
50+
51+
## Code Quality
52+
53+
The project uses several tools to maintain code quality:
54+
55+
```bash
56+
# Run linting
57+
tox -e flake8
58+
59+
# Run code formatting
60+
tox -e ruff
61+
62+
# Run type checking
63+
tox -e type
64+
```
65+
66+
## Development Workflow
67+
68+
1. Install development dependencies:
69+
```bash
70+
pip install -e ".[dev]"
71+
```
72+
73+
2. Run tests before making changes:
74+
```bash
75+
tox -e pytest
76+
```
77+
78+
3. Make your changes
79+
80+
4. Run code quality checks:
81+
```bash
82+
tox -e flake8
83+
tox -e ruff
84+
tox -e type
85+
```
86+
87+
5. Run tests again:
88+
```bash
89+
tox -e pytest
90+
```
91+
92+
6. Submit your changes

mypy.ini

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,7 @@ ignore_errors = False
5959
ignore_errors = True
6060

6161
[mypy-dapr_agents.workflow.*]
62-
ignore_errors = True
62+
ignore_errors = True
63+
64+
[mypy-dapr_agents.pubsub.*]
65+
ignore_errors = True

pyproject.toml

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=61.0.0", "setuptools_scm"]
2+
requires = ["setuptools>=61.0", "setuptools_scm"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
@@ -13,6 +13,23 @@ license = {file = "LICENSE"}
1313
authors = [
1414
{name = "Dapr Authors", email = "[email protected]"}
1515
]
16+
dependencies = [
17+
"dapr>=1.15.0",
18+
"pydantic>=2.11.3,<3.0.0",
19+
"jinja2>=3.1.0",
20+
"pyyaml>=6.0",
21+
"requests>=2.31.0",
22+
"openapi-pydantic>=0.3.0",
23+
"rich==13.9.4",
24+
"openai==1.75.0",
25+
"azure-identity==1.21.0",
26+
"huggingface_hub==0.30.2",
27+
"colorama>=0.4.6",
28+
"regex>=2023.0.0",
29+
"fastapi>=0.110.0",
30+
"uvicorn>=0.27.0",
31+
"aiohttp>=3.9.0",
32+
]
1633
classifiers = [
1734
"Development Status :: 2 - Pre-Alpha",
1835
"Intended Audience :: Developers",
@@ -25,28 +42,23 @@ classifiers = [
2542
"Programming Language :: Python :: 3.13",
2643
]
2744

28-
dependencies = [
29-
"durabletask-dapr >= 0.2.0a7",
30-
"pydantic == 2.11.3",
31-
"openai == 1.75.0",
32-
"openapi-pydantic == 0.5.1",
33-
"openapi-schema-pydantic==1.2.4",
34-
"regex >= 2023.12.25",
35-
"Jinja2 >= 3.1.6",
36-
"azure-identity == 1.21.0",
37-
"dapr >= 1.15.0",
38-
"dapr-ext-fastapi == 1.15.0",
39-
"dapr-ext-workflow == 1.15.0",
40-
"colorama == 0.4.6",
41-
"cloudevents == 1.11.0",
42-
"pyyaml == 6.0.2",
43-
"rich == 13.9.4",
44-
"huggingface_hub == 0.30.2",
45-
"numpy == 2.2.2",
46-
"mcp == 1.7.1",
47-
"opentelemetry-distro == 0.53b1",
48-
"opentelemetry-exporter-otlp == 1.32.1",
49-
"opentelemetry-instrumentation-requests == 0.53b1",
45+
[project.optional-dependencies]
46+
test = [
47+
"pytest>=7.0.0",
48+
"pytest-asyncio>=0.23.0",
49+
"pytest-cov>=4.1.0",
50+
"pytest-mock>=3.12.0",
51+
"httpx>=0.27.0", # For testing FastAPI endpoints
52+
]
53+
dev = [
54+
"mypy==1.15.0",
55+
"mcp==1.7.1",
56+
"opentelemetry-distro==0.53b1",
57+
"opentelemetry-exporter-otlp==1.32.1",
58+
"opentelemetry-instrumentation-requests==0.53b1",
59+
"dapr-ext-fastapi==1.15.0",
60+
"dapr-ext-workflow==1.15.0",
61+
"cloudevents==1.11.0",
5062
]
5163

5264
[project.urls]
@@ -59,4 +71,9 @@ exclude = ["tests"]
5971

6072
[tool.setuptools_scm]
6173
version_scheme = "guess-next-dev"
62-
local_scheme = "no-local-version"
74+
local_scheme = "node-and-date"
75+
76+
[tool.pytest.ini_options]
77+
testpaths = ["tests"]
78+
python_files = ["test_*.py"]
79+
asyncio_mode = "auto"

0 commit comments

Comments
 (0)