Skip to content

Commit f2ec3a3

Browse files
committed
Refactor code structure for improved readability and maintainability
1 parent fcf5845 commit f2ec3a3

3 files changed

Lines changed: 1680 additions & 920 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ scripts/reindex_all_tiers.sh
8282

8383
.gemini/
8484
gha-creds-*.json
85+
.uv.runpod.toml
8586

8687
# Gemini Context Files
8788
PROJECT_CONTEXT.md

pyproject.toml

Lines changed: 62 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,18 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "everspring-mcp"
7-
version = "0.1.0"
7+
version = "0.1.1"
88
description = "MCP server providing LLMs with real-time Spring documentation"
99
readme = "README.md"
1010
license = "MIT"
11-
requires-python = ">=3.11"
12-
authors = [
13-
{ name = "Alper Karaca" }
14-
]
11+
requires-python = ">=3.12, <3.15"
12+
authors = [{ name = "Alper Karaca" }]
1513
keywords = ["mcp", "spring", "documentation", "rag", "llm"]
1614
classifiers = [
1715
"Development Status :: 3 - Alpha",
1816
"Intended Audience :: Developers",
1917
"License :: OSI Approved :: MIT License",
2018
"Programming Language :: Python :: 3",
21-
"Programming Language :: Python :: 3.11",
2219
"Programming Language :: Python :: 3.12",
2320
"Topic :: Software Development :: Documentation",
2421
]
@@ -38,31 +35,71 @@ dependencies = [
3835
"aiosqlite>=0.19.0",
3936
"rank-bm25>=0.2.2",
4037
"tenacity>=8.2.0",
41-
"torch>=2.4",
4238
"rich>=13.7.0",
4339
"fastapi>=0.135.3",
4440
"granian>=2.7.3",
41+
# torch is declared here in base dependencies (not in an optional extra) so
42+
# that sentence-transformers and torch share a single resolution slot.
43+
# Without this, uv resolves torch twice: once for the extra (AMD repo) and
44+
# once as a transitive dep of sentence-transformers (PyPI) — causing a
45+
# double download or a conflict.
46+
"torch>=2.4",
4547
]
4648

47-
4849
[project.optional-dependencies]
50+
flag-embedding = ["FlagEmbedding>=1.3.3"]
4951
dev = [
5052
"pytest>=7.4.0",
5153
"pytest-asyncio>=0.21.0",
5254
"pytest-cov>=4.1.0",
5355
"ruff>=0.1.0",
5456
"mypy>=1.5.0",
5557
"boto3-stubs[s3]>=1.28.0",
56-
"moto[s3]>=4.2.0",
58+
"moto[s3]>=5.1.22",
5759
]
5860

59-
[[tool.uv.index]]
60-
name = "pytorch-cpu"
61-
url = "https://download.pytorch.org/whl/cpu"
62-
explicit = true
61+
# ──────────────────────────────────────────────────────────────────────────────
62+
# Source overrides
63+
#
64+
# Default (home machine — Linux or Windows with AMD GPU):
65+
# torch is sourced from AMD's own repo (repo.radeon.com), NOT from
66+
# download.pytorch.org/whl/rocm7.2. The PyTorch.org ROCm index ships
67+
# torch==2.11.0 which depends on triton-rocm==3.6.0 — a package that does
68+
# not yet exist, making the entire resolution unsatisfiable.
69+
# AMD's repo ships torch==2.9.1+rocm7.2 with triton==3.5.1, which is stable
70+
# and fully tested by AMD.
71+
#
72+
# No `extra` filter is used here — only platform markers. This ensures that
73+
# ALL consumers of torch in the dependency graph (including transitive ones
74+
# like sentence-transformers) resolve to the same single wheel, preventing
75+
# the double-download problem.
76+
#
77+
# CUDA override (RunPod / NVIDIA machines):
78+
# Place the provided uv.toml in the project root on that machine.
79+
# uv.toml takes precedence over pyproject.toml for [tool.uv.*] settings,
80+
# so torch will be sourced from the cu128 index without modifying this file.
81+
# ──────────────────────────────────────────────────────────────────────────────
6382

6483
[tool.uv.sources]
65-
torch = { index = "pytorch-cpu" }
84+
torch = [
85+
# Linux — AMD's tested ROCm 7.2 wheel (torch 2.9.1)
86+
{ url = "https://repo.radeon.com/rocm/manylinux/rocm-rel-7.2/torch-2.9.1%2Brocm7.2.0.lw.git7e1940d4-cp312-cp312-linux_x86_64.whl", marker = "sys_platform == 'linux'" },
87+
]
88+
89+
[tool.uv]
90+
conflicts = [
91+
[
92+
{ extra = "rocm" },
93+
{ extra = "cu128" },
94+
]
95+
]
96+
override-dependencies = [
97+
# torch 2.9.1+rocm7.2 depends on triton==3.5.1+rocm7.2.0.gita272dfa8.
98+
# This version has a local identifier (+rocm...) so it does not exist on
99+
# PyPI. tool.uv.sources does not apply to transitive deps, so we force
100+
# the AMD wheel for ALL triton consumers in the entire dependency tree.
101+
"triton @ https://repo.radeon.com/rocm/manylinux/rocm-rel-7.2/triton-3.5.1%2Brocm7.2.0.gita272dfa8-cp312-cp312-linux_x86_64.whl ; sys_platform == 'linux' and platform_machine == 'x86_64'",
102+
]
66103

67104
[project.scripts]
68105
everspring-mcp = "everspring_mcp.mcp.server:run_server"
@@ -77,34 +114,29 @@ Issues = "https://github.com/alpeerkaraca/everspring-mcp/issues"
77114
packages = ["src/everspring_mcp"]
78115

79116
[tool.ruff]
80-
target-version = "py311"
117+
target-version = "py312"
81118
line-length = 88
82119

83120
[tool.ruff.lint]
84121
select = [
85-
"E", # pycodestyle errors
86-
"W", # pycodestyle warnings
87-
"F", # pyflakes
88-
"I", # isort
89-
"B", # flake8-bugbear
90-
"C4", # flake8-comprehensions
91-
"UP", # pyupgrade
122+
"E", # pycodestyle errors
123+
"W", # pycodestyle warnings
124+
"F", # pyflakes
125+
"I", # isort
126+
"B", # flake8-bugbear
127+
"C4", # flake8-comprehensions
128+
"UP", # pyupgrade
92129
]
93130
ignore = [
94-
"E501", # line too long (handled by formatter)
131+
"E501", # line too long (handled by formatter)
95132
]
96133

97134
[tool.mypy]
98-
python_version = "3.11"
135+
python_version = "3.12"
99136
strict = true
100137
plugins = ["pydantic.mypy"]
101138

102139
[tool.pytest.ini_options]
103140
asyncio_mode = "auto"
104141
testpaths = ["tests"]
105-
addopts = "-v --cov=src/everspring_mcp --cov-report=term-missing"
106-
107-
[dependency-groups]
108-
dev = [
109-
"moto>=5.1.22",
110-
]
142+
addopts = "-v --cov=src/everspring_mcp --cov-report=term-missing"

0 commit comments

Comments
 (0)