File size: 5,389 Bytes
069f0a0
5d12635
069f0a0
5d12635
069f0a0
fd1472e
0cdf561
069f0a0
 
 
4e2ccbf
 
d7e5abb
 
0cdf561
 
069f0a0
1efef06
4e2ccbf
 
cd7c282
069f0a0
e760d70
a5ad664
 
069f0a0
4e2ccbf
 
 
1efef06
316dc7d
20f762e
e0c585c
 
 
 
 
 
efd0997
 
069f0a0
 
 
 
 
 
 
 
 
 
 
2bd9462
069f0a0
 
 
 
 
ef2b4e3
 
 
 
069f0a0
1922dbd
02a3c53
1922dbd
0cdf561
 
3aa91e9
 
 
 
 
069f0a0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15459e9
3aa91e9
 
 
15459e9
ecbc47b
 
069f0a0
 
 
 
 
 
 
 
 
 
 
 
15459e9
0a480cb
9d21bf8
 
0a480cb
069f0a0
 
 
 
 
 
 
 
 
 
 
 
 
 
0257d2f
069f0a0
ff16d8e
 
 
 
 
 
 
 
 
 
 
 
069f0a0
 
 
 
 
 
 
 
 
 
 
1922dbd
 
474538c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
[project]
name = "deepboner"
version = "0.1.0"
description = "AI-Native Sexual Health Research Agent"
readme = "README.md"
license = "Apache-2.0"
requires-python = ">=3.11,<4.0"
dependencies = [
    # Core
    "pydantic>=2.7",
    "pydantic-settings>=2.2", # For BaseSettings (config)
    "pydantic-ai>=0.0.16", # Agent framework
    # AI Providers
    "openai>=1.0.0",
        "chromadb>=0.4.22",
        "sentence-transformers>=2.2.2",
    # HTTP & Parsing
    "httpx>=0.27", # Async HTTP client (PubMed)
    "beautifulsoup4>=4.12", # HTML parsing
    "xmltodict>=0.13", # PubMed XML -> dict
    "huggingface-hub>=0.24.0", # Hugging Face Inference API - 0.24.0 required for stable chat_completion with tools
    # UI
    "gradio[mcp]>=6.0.0", # Chat interface with MCP server support (6.0 required for css in launch())
    # Security: Pin mcp to fix GHSA-9h52-p55h-vw2f
    "mcp>=1.23.0",
    # Utils
    "python-dotenv>=1.0", # .env loading
    "tenacity>=8.2", # Retry logic
    "structlog>=24.1", # Structured logging
    "requests>=2.32.5", # ClinicalTrials.gov (httpx blocked by WAF)
    "limits>=3.0", # Rate limiting
    "duckduckgo-search>=5.0", # Web search
    # LangGraph deps - upper bounds prevent breaking changes from major versions
    "langgraph>=0.2.50,<1.0",
    "langchain>=0.3.9,<1.0",
    "langchain-core>=0.3.21,<1.0",
    "langchain-huggingface>=0.1.2,<1.0",
    "langgraph-checkpoint-sqlite>=3.0.0,<4.0",  # 3.0.0 required for GHSA-wwqv-p2pp-99h5 fix
    # Security: Pin urllib3 to fix GHSA-gm62-xv2j-4w53 and GHSA-2xpw-w6gg-jr37
    "urllib3>=2.6.0",
]

[project.optional-dependencies]
dev = [
    # Testing
    "pytest>=8.0",
    "pytest-asyncio>=0.23",
    "pytest-sugar>=1.0",
    "pytest-cov>=5.0",
    "pytest-mock>=3.12",
    "respx>=0.21",                   # Mock httpx requests
    "typer>=0.9.0",                  # Gradio CLI dependency for smoke tests

    # Quality
    "ruff>=0.4.0",
    "mypy>=1.10",
    "pre-commit>=3.7",

    # Security
    "bandit>=1.7.0",
    "pip-audit>=2.7.0",
]
magentic = [
    "agent-framework-core==1.0.0b251204",  # Microsoft Agent Framework (PyPI)
]
rag = [
    # LlamaIndex RAG support (chromadb already in core deps)
    "llama-index>=0.11.0",
    "llama-index-llms-openai",
    "llama-index-embeddings-openai",
    "llama-index-vector-stores-chroma",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src"]

# ============== RUFF CONFIG ==============
[tool.ruff]
line-length = 100
target-version = "py311"
src = ["src", "tests"]

[tool.ruff.lint]
select = [
    "E",    # pycodestyle errors
    "F",    # pyflakes
    "B",    # flake8-bugbear
    "I",    # isort
    "N",    # pep8-naming
    "UP",   # pyupgrade
    "PL",   # pylint
    "RUF",  # ruff-specific
]
ignore = [
    "PLR0913",  # Too many arguments (agents need many params)
    "PLR0912",  # Too many branches (complex orchestrator logic)
    "PLR0911",  # Too many return statements (complex agent logic)
    "PLR2004",  # Magic values (statistical constants like p-values)
    "PLW0603",  # Global statement (singleton pattern for Modal)
    "PLC0415",  # Lazy imports for optional dependencies
    "E402",     # Module level import not at top (needed for pytest.importorskip)
    "RUF100",   # Unused noqa (version differences between local/CI)
]

[tool.ruff.lint.isort]
known-first-party = ["src"]

# ============== MYPY CONFIG ==============
[tool.mypy]
python_version = "3.11"
strict = true
ignore_missing_imports = true
disallow_untyped_defs = true
warn_return_any = true
warn_unused_ignores = false
exclude = [
    "^reference_repos/",
    "^examples/",
]

# ============== PYTEST CONFIG ==============
[tool.pytest.ini_options]
testpaths = ["tests"]
asyncio_mode = "auto"
addopts = [
    "-v",
    "--tb=short",
    "--strict-markers",
]
markers = [
    "unit: Unit tests (mocked)",
    "integration: Integration tests (real APIs)",
    "slow: Slow tests",
    "e2e: End-to-End tests (full pipeline)",
]
# Filter warnings from unittest.mock introspecting Pydantic models.
# This is a known upstream issue: https://github.com/pydantic/pydantic/issues/9927
# When autospec=True, mock.py accesses deprecated Pydantic attributes during introspection.
# We filter these specifically because it's NOT our code triggering deprecations.
filterwarnings = [
    # Pydantic 2.0 deprecations triggered by mock introspection
    "ignore:The `__fields__` attribute is deprecated:pydantic.warnings.PydanticDeprecatedSince20",
    "ignore:The `__fields_set__` attribute is deprecated:pydantic.warnings.PydanticDeprecatedSince20",
    # Pydantic 2.11 deprecations triggered by mock introspection
    "ignore:Accessing the 'model_computed_fields' attribute on the instance is deprecated:pydantic.warnings.PydanticDeprecatedSince211",
    "ignore:Accessing the 'model_fields' attribute on the instance is deprecated:pydantic.warnings.PydanticDeprecatedSince211",
]

# ============== COVERAGE CONFIG ==============
[tool.coverage.run]
source = ["src"]
omit = ["*/__init__.py"]

[tool.coverage.report]
exclude_lines = [
    "pragma: no cover",
    "if TYPE_CHECKING:",
    "raise NotImplementedError",
]

# Note: agent-framework-core is optional for magentic mode (multi-agent orchestration)
# Version pinned to 1.0.0b* to avoid breaking changes. CI skips tests via pytest.importorskip