Skip to content

Commit 30a34cc

Browse files
jfrench9claude
andauthored
Rename extensions package to clients with facade refactor (#90)
## Summary Renames the `robosystems_client/extensions` package to `robosystems_client/clients` to better reflect the module's purpose as a collection of API client implementations. The main orchestrator class is also renamed from `extensions.py` to `facade.py`, clarifying its role as a facade over the individual domain clients. ## Key Changes - **Package rename:** `robosystems_client/extensions/` → `robosystems_client/clients/` - All 17 module files moved to the new package location - Internal imports and `__init__.py` exports updated accordingly - **Facade rename:** `extensions.py` → `facade.py` to better describe the pattern used (Facade pattern over multiple domain-specific clients) - **Auth integration updates:** Renamed references and adjusted class/function naming to align with the new `clients` terminology - **README updates:** Documentation within the package updated to reflect the new naming conventions - **pyproject.toml:** Package metadata updated to reference the new module path - **Test suite updates:** All 19 test files updated to import from `robosystems_client.clients` instead of `robosystems_client.extensions` ## Breaking Changes ⚠️ **This is a breaking change for all consumers of the SDK.** - All imports from `robosystems_client.extensions` must be changed to `robosystems_client.clients` - The `extensions` module entry point (e.g., `from robosystems_client.extensions.extensions import ...`) is now `from robosystems_client.clients.facade import ...` - Any downstream code or configuration referencing the old package path will need to be updated ## Testing Notes - All existing tests have been updated to use the new import paths - No logic changes were made — this is a pure structural refactor, so existing test coverage remains fully applicable - Net line change is -6 lines, confirming this is a rename/refactor with minimal content modifications ## Infrastructure Considerations - Any CI/CD pipelines, documentation generation, or tooling that references `robosystems_client.extensions` will need to be updated to point to `robosystems_client.clients` - Downstream packages or services that depend on this SDK will require a coordinated update when this version is released - Consider publishing this as a new major version to signal the breaking import path change --- 🤖 Generated with [Claude Code](https://claude.ai/code) **Branch Info:** - Source: `refactor/sdk-extensions-rename-clients` - Target: `main` - Type: feature Co-Authored-By: Claude <noreply@anthropic.com>
2 parents e91b25e + 9ec3cb2 commit 30a34cc

39 files changed

Lines changed: 327 additions & 333 deletions

‎pyproject.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ include = [
7474
]
7575

7676
[tool.basedpyright]
77-
include = ["robosystems_client/extensions"]
78-
exclude = ["robosystems_client/extensions/tests"]
77+
include = ["robosystems_client/clients"]
78+
exclude = ["tests"]
7979
extraPaths = ["."]
8080
pythonVersion = "3.13"
8181
venvPath = "."
Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ pip install httpx pandas # For SSE and DataFrame support
3232
### Basic Usage
3333

3434
```python
35-
from robosystems_client.extensions import create_production_extensions
35+
from robosystems_client.clients import create_production_clients
3636

3737
# Initialize with API key
38-
extensions = create_production_extensions("your-api-key-here")
38+
extensions = create_production_clients("your-api-key-here")
3939

4040
# Execute a simple query
4141
result = extensions.execute_query(
@@ -66,10 +66,10 @@ for transaction in extensions.stream_query("your_graph_id", query, chunk_size=10
6666

6767
```python
6868
import asyncio
69-
from robosystems_client.extensions import AsyncRoboSystemsExtensions
69+
from robosystems_client.clients import AsyncRoboSystemsClients
7070

7171
async def main():
72-
extensions = AsyncRoboSystemsExtensions(config)
72+
extensions = AsyncRoboSystemsClients(config)
7373

7474
# Async query execution
7575
result = await extensions.execute_query("graph_id", "MATCH (n) RETURN COUNT(n)")
@@ -89,9 +89,9 @@ asyncio.run(main())
8989
### API Key Authentication (Recommended)
9090

9191
```python
92-
from robosystems_client.extensions import AuthenticatedExtensions
92+
from robosystems_client.clients import AuthenticatedClients
9393

94-
extensions = AuthenticatedExtensions(
94+
extensions = AuthenticatedClients(
9595
api_key="your-api-key-here",
9696
base_url="https://api.robosystems.ai"
9797
)
@@ -100,9 +100,9 @@ extensions = AuthenticatedExtensions(
100100
### Cookie Authentication
101101

102102
```python
103-
from robosystems_client.extensions import CookieAuthExtensions
103+
from robosystems_client.clients import CookieAuthClients
104104

105-
extensions = CookieAuthExtensions(
105+
extensions = CookieAuthClients(
106106
cookies={"auth-token": "your-cookie-token"},
107107
base_url="https://api.robosystems.ai"
108108
)
@@ -111,9 +111,9 @@ extensions = CookieAuthExtensions(
111111
### JWT Token Authentication
112112

113113
```python
114-
from robosystems_client.extensions import TokenExtensions
114+
from robosystems_client.clients import TokenClients
115115

116-
extensions = TokenExtensions(
116+
extensions = TokenClients(
117117
token="your-jwt-token",
118118
base_url="https://api.robosystems.ai"
119119
)
@@ -122,17 +122,17 @@ extensions = TokenExtensions(
122122
### Environment-Specific Configurations
123123

124124
```python
125-
from robosystems_client.extensions import create_extensions
125+
from robosystems_client.clients import create_clients
126126

127127
# Production
128-
prod_ext = create_extensions(
128+
prod_ext = create_clients(
129129
'api_key',
130130
api_key=os.getenv('ROBOSYSTEMS_API_KEY'),
131131
base_url="https://api.robosystems.ai"
132132
)
133133

134134
# Development
135-
dev_ext = create_extensions(
135+
dev_ext = create_clients(
136136
'api_key',
137137
api_key="dev-key-123",
138138
base_url="http://localhost:8000"
@@ -146,7 +146,7 @@ dev_ext = create_extensions(
146146
Build complex Cypher queries programmatically:
147147

148148
```python
149-
from robosystems_client.extensions import QueryBuilder
149+
from robosystems_client.clients import QueryBuilder
150150

151151
builder = QueryBuilder()
152152
query, params = (builder
@@ -169,7 +169,7 @@ print("Parameters:", params)
169169
### Query Validation & Cost Estimation
170170

171171
```python
172-
from robosystems_client.extensions import validate_cypher_query, estimate_query_cost
172+
from robosystems_client.clients import validate_cypher_query, estimate_query_cost
173173

174174
# Validate syntax
175175
validation = validate_cypher_query(query)
@@ -190,7 +190,7 @@ for rec in cost['recommendations']:
190190
Convert results to different formats:
191191

192192
```python
193-
from robosystems_client.extensions import ResultProcessor
193+
from robosystems_client.clients import ResultProcessor
194194

195195
# Convert to JSON
196196
json_output = ResultProcessor.to_json(result, pretty=True)
@@ -211,7 +211,7 @@ except ImportError:
211211
Cache expensive queries automatically:
212212

213213
```python
214-
from robosystems_client.extensions import CacheManager
214+
from robosystems_client.clients import CacheManager
215215

216216
cache = CacheManager(max_size=100, ttl_seconds=300) # 5 minute TTL
217217

@@ -232,7 +232,7 @@ print(cache.stats())
232232
Monitor long-running operations:
233233

234234
```python
235-
from robosystems_client.extensions import ProgressTracker
235+
from robosystems_client.clients import ProgressTracker
236236

237237
def progress_handler(progress):
238238
print(f"Step {progress.current_step}/{progress.total_steps}: {progress.message}")
@@ -249,7 +249,7 @@ print(f"Operation completed: {result.status}")
249249
Direct SSE connection for real-time events:
250250

251251
```python
252-
from robosystems_client.extensions import SSEClient, SSEConfig, EventType
252+
from robosystems_client.clients import SSEClient, SSEConfig, EventType
253253

254254
config = SSEConfig(base_url="https://api.robosystems.ai")
255255
client = SSEClient(config)
@@ -276,9 +276,9 @@ client.close()
276276
### Financial Data Analysis
277277

278278
```python
279-
from robosystems_client.extensions import create_production_extensions, QueryBuilder
279+
from robosystems_client.clients import create_production_clients, QueryBuilder
280280

281-
extensions = create_production_extensions(api_key)
281+
extensions = create_production_clients(api_key)
282282

283283
# Find top performing companies by revenue growth
284284
builder = QueryBuilder()
@@ -303,7 +303,7 @@ for company in result.data:
303303
### Batch Processing with Streaming
304304

305305
```python
306-
from robosystems_client.extensions import DataBatcher, format_duration
306+
from robosystems_client.clients import DataBatcher, format_duration
307307
import time
308308

309309
# Process large transaction dataset in batches
@@ -338,7 +338,7 @@ print(f"Processed {total_processed:,} transactions total")
338338
### Error Handling
339339

340340
```python
341-
from robosystems_client.extensions import QueuedQueryError
341+
from robosystems_client.clients import QueuedQueryError
342342

343343
try:
344344
result = extensions.execute_query("graph_id", "COMPLEX LONG RUNNING QUERY")
@@ -369,21 +369,21 @@ Extensions automatically manage SSE connections with pooling:
369369

370370
```python
371371
# Configure connection limits
372-
config = RoboSystemsExtensionConfig(
372+
config = RoboSystemsClientConfig(
373373
max_retries=5,
374374
retry_delay=2000, # 2 seconds
375375
timeout=60
376376
)
377377

378-
extensions = RoboSystemsExtensions(config)
378+
extensions = RoboSystemsClients(config)
379379
```
380380

381381
### Query Optimization
382382

383383
Use query analysis tools:
384384

385385
```python
386-
from robosystems_client.extensions import estimate_query_cost, validate_cypher_query
386+
from robosystems_client.clients import estimate_query_cost, validate_cypher_query
387387

388388
# Analyze before execution
389389
query = "MATCH (c:Company) WHERE c.revenue > 1000000 RETURN c"
@@ -434,20 +434,20 @@ Run the test suite:
434434
python run_tests.py
435435

436436
# Or individual test suites
437-
python -c "from robosystems_client.extensions.tests.test_unit import run_unit_tests; run_unit_tests()"
438-
python -c "from robosystems_client.extensions.tests.test_integration import run_integration_tests; run_integration_tests()"
437+
python -c "from robosystems_client.clients.tests.test_unit import run_unit_tests; run_unit_tests()"
438+
python -c "from robosystems_client.clients.tests.test_integration import run_integration_tests; run_integration_tests()"
439439
```
440440

441441
### Writing Tests
442442

443443
```python
444-
from robosystems_client.extensions import AuthenticatedExtensions
444+
from robosystems_client.clients import AuthenticatedClients
445445
from unittest.mock import Mock, patch
446446

447447
def test_query_execution():
448-
extensions = AuthenticatedExtensions("test-key")
448+
extensions = AuthenticatedClients("test-key")
449449

450-
with patch('robosystems_client.extensions.auth_integration.sync_detailed') as mock_query:
450+
with patch('robosystems_client.clients.auth_integration.sync_detailed') as mock_query:
451451
# Mock successful response
452452
mock_response = Mock()
453453
mock_response.parsed.data = [{"count": 100}]
@@ -476,9 +476,9 @@ export ROBOSYSTEMS_RETRY_DELAY="2000"
476476
### Configuration Object
477477

478478
```python
479-
from robosystems_client.extensions import RoboSystemsExtensionConfig
479+
from robosystems_client.clients import RoboSystemsClientConfig
480480

481-
config = RoboSystemsExtensionConfig(
481+
config = RoboSystemsClientConfig(
482482
base_url="https://api.robosystems.ai",
483483
headers={
484484
"X-Custom-Header": "value",
@@ -489,18 +489,18 @@ config = RoboSystemsExtensionConfig(
489489
timeout=45
490490
)
491491

492-
extensions = RoboSystemsExtensions(config)
492+
extensions = RoboSystemsClients(config)
493493
```
494494

495495
## API Reference
496496

497497
### Core Classes
498498

499-
- **`RoboSystemsExtensions`** - Main extensions class
500-
- **`AuthenticatedExtensions`** - API key authentication
501-
- **`CookieAuthExtensions`** - Cookie authentication
502-
- **`TokenExtensions`** - JWT token authentication
503-
- **`AsyncRoboSystemsExtensions`** - Async version
499+
- **`RoboSystemsClients`** - Main extensions class
500+
- **`AuthenticatedClients`** - API key authentication
501+
- **`CookieAuthClients`** - Cookie authentication
502+
- **`TokenClients`** - JWT token authentication
503+
- **`AsyncRoboSystemsClients`** - Async version
504504

505505
### SSE Components
506506

@@ -526,7 +526,7 @@ extensions = RoboSystemsExtensions(config)
526526
- **`validate_cypher_query(query)`** - Query syntax validation
527527
- **`estimate_query_cost(query, params)`** - Complexity analysis
528528
- **`format_duration(milliseconds)`** - Human-readable time formatting
529-
- **`create_extensions(method, **kwargs)`** - Extensions factory
529+
- **`create_clients(method, **kwargs)`** - Extensions factory
530530

531531
## Troubleshooting
532532

@@ -542,7 +542,7 @@ pip install pandas # For DataFrame conversion (optional)
542542
**Authentication Failures**
543543
```python
544544
# Verify API key is valid
545-
extensions = AuthenticatedExtensions("your-api-key")
545+
extensions = AuthenticatedClients("your-api-key")
546546
try:
547547
result = extensions.execute_query("graph_id", "MATCH (n) RETURN count(n) LIMIT 1")
548548
print("Authentication successful")
@@ -582,7 +582,7 @@ import logging
582582
logging.basicConfig(level=logging.DEBUG)
583583

584584
# This will show internal HTTP requests and SSE events
585-
extensions = AuthenticatedExtensions("your-key")
585+
extensions = AuthenticatedClients("your-key")
586586
```
587587

588588
## Contributing

0 commit comments

Comments
 (0)