Skip to content

Commit 621ca78

Browse files
committed
merge in http pool changes; add escaping for rich markup in import error messages
1 parent 2d15e92 commit 621ca78

File tree

21 files changed

+46
-101
lines changed

21 files changed

+46
-101
lines changed

.github/workflows/copilot-setup-steps.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ jobs:
3636
CODEQL_EXTRACTOR_PYTHON_RAM: 2048
3737
CODEQL_EVALUATOR_RAM: 2048
3838
runs-on: ubuntu-latest
39-
# Alternative: Use ubuntu-latest-4-cores (16GB RAM) if OOM issues persist
40-
# Requires GitHub Team/Enterprise plan
41-
# runs-on: ubuntu-latest-4-cores
4239
# Add an overall job timeout so we don't let runaway installs exhaust the runner indefinitely
4340
timeout-minutes: 50
4441
# Set the permissions to the lowest permissions possible needed for your steps.
@@ -72,7 +69,5 @@ jobs:
7269
MISE_YES: 1
7370
MISE_EXPERIMENTAL: 1
7471
MISE_PATH: ${{ steps.setup-mise.outputs.MISE_PATH }}
75-
NEWPATH: ${{ steps.setup-mise.outputs.NEWPATH }}
7672
run: |
77-
export PATH="$NEWPATH"
7873
mise --version || { echo "Mise not in path"; "$MISE_PATH" --version; }

docs-site/src/content/docs/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import { Card, CardGrid } from '@astrojs/starlight/components';
4040

4141
```bash
4242
# Install CodeWeaver
43-
uv pip install codeweaver
43+
uv pip install code-weaver
4444

4545
# Start the daemon
4646
cw start --project /path/to/your/codebase

mise-tasks/validate-lazy-imports.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@
7575
"codeweaver.mcp.middleware.McpMiddleware",
7676
"codeweaver.providers.agent.AgentProfile",
7777
"codeweaver.providers.agent.AgentProfileSpec",
78+
"providers.reranking.providers.sentence_transformers",
79+
"providers.embedding.providers.sentence_transformers",
7880
"codeweaver.providers.reranking.KnownRerankModelName",
7981
"codeweaver.providers.reranking.capabilities.dependency_map",
8082
"codeweaver.providers.reranking.capabilities.load_default_capabilities",
@@ -85,7 +87,15 @@
8587
"codeweaver.providers.embedding.capabilities.load_sparse_capabilities",
8688
)
8789

88-
PROBLEM_CHILDREN = ("codeweaver.providers.embedding.providers.bedrock", "BedrockEmbeddingProvider")
90+
PROBLEM_CHILDREN = (
91+
"codeweaver.providers.embedding.providers.bedrock",
92+
"BedrockEmbeddingProvider",
93+
"codeweaver.providers.embedding.providers.sentence_transformers",
94+
"SentenceTransformersEmbeddingProvider",
95+
"SentenceTransformersSparseProvider",
96+
"codeweaver.providers.reranking.providers.sentence_transformers",
97+
"SentenceTransformersRerankingProvider",
98+
)
8999

90100
"""Tuple of modules and types with known problematic lazy imports to skip during validation."""
91101

resolve-rebase-conflicts.sh

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

specs/004-we-re-preparing/quickstart.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ gh run list --workflow=publish.yml --limit=1
199199
python -m venv /tmp/test-pypi
200200
source /tmp/test-pypi/bin/activate
201201

202-
pip install codeweaver==0.1.0
202+
pip install code-weaver==0.1.0
203203

204204
python -c "import codeweaver; print(codeweaver.__version__)"
205205

@@ -214,7 +214,7 @@ rm -rf /tmp/test-pypi
214214
**Success Criteria**:
215215
- ✅ GitHub Actions workflow succeeds
216216
- ✅ Package published to PyPI
217-
- ✅ Package installable via `pip install codeweaver`
217+
- ✅ Package installable via `pip install code-weaver`
218218
- ✅ Smoke tests pass
219219
- ✅ Version matches tag (e.g., `0.1.0`)
220220

src/codeweaver/common/http_pool.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@
3434
import asyncio
3535
import logging
3636
import threading
37+
3738
from dataclasses import dataclass, field
38-
from typing import Any, ClassVar
39+
from typing import Any, ClassVar, Self
3940

4041
import httpx
4142

@@ -112,9 +113,7 @@ class HttpClientPool:
112113

113114
@classmethod
114115
def get_instance(
115-
cls,
116-
limits: PoolLimits | None = None,
117-
timeouts: PoolTimeouts | None = None,
116+
cls, limits: PoolLimits | None = None, timeouts: PoolTimeouts | None = None
118117
) -> HttpClientPool:
119118
"""Get or create the singleton HttpClientPool instance.
120119
@@ -135,8 +134,7 @@ def get_instance(
135134
with _instance_lock:
136135
if cls._instance is None:
137136
cls._instance = cls(
138-
limits=limits or PoolLimits(),
139-
timeouts=timeouts or PoolTimeouts(),
137+
limits=limits or PoolLimits(), timeouts=timeouts or PoolTimeouts()
140138
)
141139
logger.debug(
142140
"Created HttpClientPool singleton with limits=%s, timeouts=%s",
@@ -205,8 +203,7 @@ async def get_client(self, name: str, **overrides: Any) -> httpx.AsyncClient:
205203
limits = httpx.Limits(
206204
max_connections=overrides.get("max_connections", self.limits.max_connections),
207205
max_keepalive_connections=overrides.get(
208-
"max_keepalive_connections",
209-
self.limits.max_keepalive_connections,
206+
"max_keepalive_connections", self.limits.max_keepalive_connections
210207
),
211208
keepalive_expiry=overrides.get("keepalive_expiry", self.limits.keepalive_expiry),
212209
)
@@ -275,10 +272,11 @@ def get_client_sync(self, name: str, **overrides: Any) -> httpx.AsyncClient:
275272
limits = httpx.Limits(
276273
max_connections=overrides.get("max_connections", self.limits.max_connections),
277274
max_keepalive_connections=overrides.get(
278-
"max_keepalive_connections",
279-
self.limits.max_keepalive_connections,
275+
"max_keepalive_connections", self.limits.max_keepalive_connections
276+
),
277+
keepalive_expiry=overrides.get(
278+
"keepalive_expiry", self.limits.keepalive_expiry
280279
),
281-
keepalive_expiry=overrides.get("keepalive_expiry", self.limits.keepalive_expiry),
282280
)
283281

284282
timeout = httpx.Timeout(
@@ -289,9 +287,7 @@ def get_client_sync(self, name: str, **overrides: Any) -> httpx.AsyncClient:
289287
)
290288

291289
self._clients[name] = httpx.AsyncClient(
292-
limits=limits,
293-
timeout=timeout,
294-
http2=overrides.get("http2", True),
290+
limits=limits, timeout=timeout, http2=overrides.get("http2", True)
295291
)
296292

297293
logger.debug(
@@ -341,10 +337,11 @@ async def close_client(self, name: str) -> bool:
341337
try:
342338
await client.aclose()
343339
logger.debug("Closed HTTP client pool for %s", name)
344-
return True
345340
except (httpx.HTTPError, OSError) as e:
346341
logger.warning("Error closing HTTP client pool for %s: %s", name, e)
347342
# Client already removed from dict above
343+
else:
344+
return True
348345
return False
349346

350347
async def close_all(self) -> None:
@@ -372,11 +369,11 @@ async def close_all(self) -> None:
372369
if client_names:
373370
logger.debug("Closed %d HTTP client pool(s)", len(client_names))
374371

375-
async def __aenter__(self) -> HttpClientPool:
372+
async def __aenter__(self) -> Self:
376373
"""Async context manager entry."""
377374
return self
378375

379-
async def __aexit__(self, *args: Any) -> None:
376+
async def __aexit__(self, *args: object) -> None:
380377
"""Async context manager exit - closes all clients."""
381378
await self.close_all()
382379

src/codeweaver/providers/embedding/providers/bedrock.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ def from_boto3_response(cls, response: Any) -> BedrockInvokeEmbeddingResponse:
434434
exc_info=True,
435435
)
436436
raise ConfigurationError(
437-
"Failed to import boto3. You need to install the boto3 package, you can do this by running 'pip install code-weaver[bedrock]'"
437+
r"Failed to import boto3. You need to install the boto3 package, you can do this by running 'pip install code-weaver\[bedrock]'"
438438
) from e
439439

440440

src/codeweaver/providers/embedding/providers/cohere.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def try_for_azure_endpoint(kwargs: Any) -> str:
8989

9090
except ImportError as e:
9191
raise ConfigurationError(
92-
'Please install the `cohere` package to use the Cohere provider, \nyou can use the `cohere` optional group -- `pip install "code-weaver[cohere]"`'
92+
r'Please install the `cohere` package to use the Cohere provider, \nyou can use the `cohere` optional group -- `pip install "code-weaver\[cohere]"`'
9393
) from e
9494

9595

src/codeweaver/providers/embedding/providers/fastembed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
)
5050
except ImportError as e:
5151
raise ConfigurationError(
52-
"FastEmbed is not installed. Please install it with `pip install code-weaver[fastembed]` or `codeweaver[fastembed-gpu]`."
52+
r"FastEmbed is not installed. Please install it with `pip install code-weaver\[fastembed]` or `code-weaver\[fastembed-gpu]`."
5353
) from e
5454

5555
_TextEmbedding = get_text_embedder()

src/codeweaver/providers/embedding/providers/google.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def __str__(
8383

8484
except ImportError as e:
8585
raise ConfigurationError(
86-
"The 'google-genai' package is required to use the Google embedding provider. Please install it with 'pip install code-weaver[google]'."
86+
r"The 'google-genai' package is required to use the Google embedding provider. Please install it with 'pip install code-weaver\[google]'."
8787
) from e
8888

8989

0 commit comments

Comments
 (0)