iris-devtester 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- iris_devtester-1.0.0/LICENSE +21 -0
- iris_devtester-1.0.0/PKG-INFO +354 -0
- iris_devtester-1.0.0/README.md +295 -0
- iris_devtester-1.0.0/iris_devtester/__init__.py +34 -0
- iris_devtester-1.0.0/iris_devtester/cli/__init__.py +22 -0
- iris_devtester-1.0.0/iris_devtester/cli/fixture_commands.py +430 -0
- iris_devtester-1.0.0/iris_devtester/config/__init__.py +19 -0
- iris_devtester-1.0.0/iris_devtester/config/auto_discovery.py +352 -0
- iris_devtester-1.0.0/iris_devtester/config/defaults.py +63 -0
- iris_devtester-1.0.0/iris_devtester/config/discovery.py +191 -0
- iris_devtester-1.0.0/iris_devtester/config/models.py +86 -0
- iris_devtester-1.0.0/iris_devtester/connections/__init__.py +48 -0
- iris_devtester-1.0.0/iris_devtester/connections/auto_discovery.py +174 -0
- iris_devtester-1.0.0/iris_devtester/connections/connection.py +149 -0
- iris_devtester-1.0.0/iris_devtester/connections/dbapi.py +160 -0
- iris_devtester-1.0.0/iris_devtester/connections/jdbc.py +244 -0
- iris_devtester-1.0.0/iris_devtester/connections/manager.py +230 -0
- iris_devtester-1.0.0/iris_devtester/connections/models.py +52 -0
- iris_devtester-1.0.0/iris_devtester/connections/retry.py +108 -0
- iris_devtester-1.0.0/iris_devtester/containers/__init__.py +13 -0
- iris_devtester-1.0.0/iris_devtester/containers/iris_container.py +949 -0
- iris_devtester-1.0.0/iris_devtester/containers/monitor_utils.py +185 -0
- iris_devtester-1.0.0/iris_devtester/containers/monitoring.py +1200 -0
- iris_devtester-1.0.0/iris_devtester/containers/performance.py +329 -0
- iris_devtester-1.0.0/iris_devtester/containers/wait_strategies.py +216 -0
- iris_devtester-1.0.0/iris_devtester/fixtures/__init__.py +90 -0
- iris_devtester-1.0.0/iris_devtester/fixtures/creator.py +676 -0
- iris_devtester-1.0.0/iris_devtester/fixtures/loader.py +560 -0
- iris_devtester-1.0.0/iris_devtester/fixtures/manifest.py +327 -0
- iris_devtester-1.0.0/iris_devtester/fixtures/validator.py +336 -0
- iris_devtester-1.0.0/iris_devtester/testing/__init__.py +43 -0
- iris_devtester-1.0.0/iris_devtester/testing/models.py +310 -0
- iris_devtester-1.0.0/iris_devtester/testing/schema_reset.py +371 -0
- iris_devtester-1.0.0/iris_devtester/utils/__init__.py +19 -0
- iris_devtester-1.0.0/iris_devtester/utils/password_reset.py +298 -0
- iris_devtester-1.0.0/iris_devtester/utils/unexpire_passwords.py +168 -0
- iris_devtester-1.0.0/iris_devtester.egg-info/PKG-INFO +354 -0
- iris_devtester-1.0.0/iris_devtester.egg-info/SOURCES.txt +42 -0
- iris_devtester-1.0.0/iris_devtester.egg-info/dependency_links.txt +1 -0
- iris_devtester-1.0.0/iris_devtester.egg-info/entry_points.txt +2 -0
- iris_devtester-1.0.0/iris_devtester.egg-info/requires.txt +37 -0
- iris_devtester-1.0.0/iris_devtester.egg-info/top_level.txt +1 -0
- iris_devtester-1.0.0/pyproject.toml +166 -0
- iris_devtester-1.0.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 IRIS DevTools Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: iris-devtester
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Battle-tested InterSystems IRIS infrastructure utilities for Python development
|
|
5
|
+
Author-email: InterSystems Community <community@intersystems.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/intersystems-community/iris-devtools
|
|
8
|
+
Project-URL: Documentation, https://github.com/intersystems-community/iris-devtools#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/intersystems-community/iris-devtools
|
|
10
|
+
Project-URL: Issues, https://github.com/intersystems-community/iris-devtools/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/intersystems-community/iris-devtools/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: intersystems,iris,database,testing,testcontainers,docker,devtools
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Software Development :: Testing
|
|
22
|
+
Classifier: Topic :: Database
|
|
23
|
+
Classifier: Framework :: Pytest
|
|
24
|
+
Requires-Python: >=3.9
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: testcontainers>=4.0.0
|
|
28
|
+
Requires-Dist: testcontainers-iris>=1.2.2
|
|
29
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
30
|
+
Requires-Dist: docker>=6.0.0
|
|
31
|
+
Requires-Dist: click>=8.0.0
|
|
32
|
+
Provides-Extra: dbapi
|
|
33
|
+
Requires-Dist: intersystems-irispython>=3.2.0; extra == "dbapi"
|
|
34
|
+
Provides-Extra: jdbc
|
|
35
|
+
Requires-Dist: jaydebeapi>=1.2.3; extra == "jdbc"
|
|
36
|
+
Requires-Dist: JPype1>=1.4.0; extra == "jdbc"
|
|
37
|
+
Provides-Extra: all
|
|
38
|
+
Requires-Dist: intersystems-irispython>=3.2.0; extra == "all"
|
|
39
|
+
Requires-Dist: jaydebeapi>=1.2.3; extra == "all"
|
|
40
|
+
Requires-Dist: JPype1>=1.4.0; extra == "all"
|
|
41
|
+
Provides-Extra: test
|
|
42
|
+
Requires-Dist: pytest>=8.0.0; extra == "test"
|
|
43
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == "test"
|
|
44
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == "test"
|
|
45
|
+
Requires-Dist: pytest-timeout>=2.2.0; extra == "test"
|
|
46
|
+
Provides-Extra: dev
|
|
47
|
+
Requires-Dist: black>=24.0.0; extra == "dev"
|
|
48
|
+
Requires-Dist: isort>=5.13.0; extra == "dev"
|
|
49
|
+
Requires-Dist: mypy>=1.8.0; extra == "dev"
|
|
50
|
+
Requires-Dist: flake8>=7.0.0; extra == "dev"
|
|
51
|
+
Requires-Dist: pre-commit>=3.6.0; extra == "dev"
|
|
52
|
+
Requires-Dist: build>=1.0.0; extra == "dev"
|
|
53
|
+
Requires-Dist: twine>=5.0.0; extra == "dev"
|
|
54
|
+
Provides-Extra: docs
|
|
55
|
+
Requires-Dist: sphinx>=7.0.0; extra == "docs"
|
|
56
|
+
Requires-Dist: sphinx-rtd-theme>=2.0.0; extra == "docs"
|
|
57
|
+
Requires-Dist: myst-parser>=2.0.0; extra == "docs"
|
|
58
|
+
Dynamic: license-file
|
|
59
|
+
|
|
60
|
+
# IRIS DevTools
|
|
61
|
+
|
|
62
|
+
**Battle-tested InterSystems IRIS infrastructure utilities for Python development**
|
|
63
|
+
|
|
64
|
+
[](https://badge.fury.io/py/iris-devtester)
|
|
65
|
+
[](https://pypi.org/project/iris-devtester/)
|
|
66
|
+
[](https://opensource.org/licenses/MIT)
|
|
67
|
+
[](https://github.com/intersystems-community/iris-devtools)
|
|
68
|
+
|
|
69
|
+
## What is This?
|
|
70
|
+
|
|
71
|
+
IRIS DevTools is a comprehensive Python package that provides **automatic, reliable, production-tested** infrastructure for InterSystems IRIS development. Born from years of production experience and hundreds of hours debugging IRIS + Docker + Python integration issues, this library codifies all the hard-won lessons into a reusable package.
|
|
72
|
+
|
|
73
|
+
## The Problem It Solves
|
|
74
|
+
|
|
75
|
+
Ever experienced these?
|
|
76
|
+
- ❌ "Password change required" errors breaking your tests
|
|
77
|
+
- ❌ Port conflicts when running tests in parallel
|
|
78
|
+
- ❌ Tests polluting each other's data
|
|
79
|
+
- ❌ "Works on my machine" but fails in CI
|
|
80
|
+
- ❌ Spending hours debugging IRIS connection issues
|
|
81
|
+
- ❌ Copying infrastructure code between projects
|
|
82
|
+
|
|
83
|
+
**IRIS DevTools fixes all of these automatically.**
|
|
84
|
+
|
|
85
|
+
## Quick Start
|
|
86
|
+
|
|
87
|
+
### Installation
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Basic installation
|
|
91
|
+
pip install iris-devtester
|
|
92
|
+
|
|
93
|
+
# With DBAPI support (recommended - 3x faster)
|
|
94
|
+
pip install iris-devtester[dbapi]
|
|
95
|
+
|
|
96
|
+
# With all features
|
|
97
|
+
pip install iris-devtester[all]
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Zero-Config Usage
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
from iris_devtools.containers import IRISContainer
|
|
104
|
+
|
|
105
|
+
# That's it! No configuration needed.
|
|
106
|
+
with IRISContainer.community() as iris:
|
|
107
|
+
conn = iris.get_connection()
|
|
108
|
+
cursor = conn.cursor()
|
|
109
|
+
cursor.execute("SELECT $ZVERSION")
|
|
110
|
+
print(cursor.fetchone())
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Pytest Integration
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
# conftest.py
|
|
117
|
+
from iris_devtools.testing import iris_test_fixture
|
|
118
|
+
import pytest
|
|
119
|
+
|
|
120
|
+
@pytest.fixture(scope="module")
|
|
121
|
+
def iris_db():
|
|
122
|
+
return iris_test_fixture()
|
|
123
|
+
|
|
124
|
+
# test_example.py
|
|
125
|
+
def test_my_feature(iris_db):
|
|
126
|
+
conn, state = iris_db
|
|
127
|
+
cursor = conn.cursor()
|
|
128
|
+
cursor.execute("SELECT 1")
|
|
129
|
+
assert cursor.fetchone()[0] == 1
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Run tests:
|
|
133
|
+
```bash
|
|
134
|
+
pytest # Just works! 🎉
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Key Features
|
|
138
|
+
|
|
139
|
+
### 🔐 Automatic Password Management
|
|
140
|
+
- Detects "Password change required" errors
|
|
141
|
+
- Automatically resets passwords via Docker
|
|
142
|
+
- Transparent retry - your code never knows it happened
|
|
143
|
+
|
|
144
|
+
### 🐳 Testcontainers Integration
|
|
145
|
+
- Each test suite gets isolated IRIS instance
|
|
146
|
+
- Automatic cleanup (even on crashes)
|
|
147
|
+
- No port conflicts
|
|
148
|
+
- No test data pollution
|
|
149
|
+
|
|
150
|
+
### ⚡ DBAPI-First Performance
|
|
151
|
+
- Automatically uses fastest connection method
|
|
152
|
+
- DBAPI (Database API): 3x faster than JDBC (Java Database Connectivity)
|
|
153
|
+
- Falls back to JDBC if DBAPI unavailable
|
|
154
|
+
- All transparent to your code
|
|
155
|
+
|
|
156
|
+
### 📦 DAT Fixture Management
|
|
157
|
+
- Create reproducible test fixtures from IRIS tables
|
|
158
|
+
- 10-100x faster than programmatic data creation
|
|
159
|
+
- SHA256 checksum validation for data integrity
|
|
160
|
+
- Load 10K rows in <10 seconds
|
|
161
|
+
- CLI commands for create, load, validate
|
|
162
|
+
|
|
163
|
+
### 📊 Performance Monitoring
|
|
164
|
+
- Auto-configure ^SystemPerformance monitoring
|
|
165
|
+
- Task Manager integration for scheduled monitoring
|
|
166
|
+
- Resource-aware auto-disable under high load
|
|
167
|
+
- Automatic re-enable when resources recover
|
|
168
|
+
- Zero-config monitoring setup
|
|
169
|
+
|
|
170
|
+
### 🧪 Production-Ready Testing
|
|
171
|
+
- Schema validation & auto-reset
|
|
172
|
+
- Test data isolation
|
|
173
|
+
- Pre-flight checks
|
|
174
|
+
- Medical-grade reliability (94%+ coverage)
|
|
175
|
+
|
|
176
|
+
### 📦 Zero Configuration
|
|
177
|
+
- Sensible defaults
|
|
178
|
+
- Auto-discovery of IRIS instances
|
|
179
|
+
- Environment variable overrides
|
|
180
|
+
- Works with both Community & Enterprise editions
|
|
181
|
+
|
|
182
|
+
## Example: Enterprise Setup
|
|
183
|
+
|
|
184
|
+
```python
|
|
185
|
+
from iris_devtools.containers import IRISContainer
|
|
186
|
+
|
|
187
|
+
# Auto-discovers license from ~/.iris/iris.key
|
|
188
|
+
with IRISContainer.enterprise(namespace="PRODUCTION") as iris:
|
|
189
|
+
conn = iris.get_connection()
|
|
190
|
+
# Use your enterprise IRIS instance
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Example: DAT Fixtures
|
|
194
|
+
|
|
195
|
+
Create reproducible test fixtures 10-100x faster than programmatic data creation:
|
|
196
|
+
|
|
197
|
+
```python
|
|
198
|
+
from iris_devtools.fixtures import FixtureCreator, DATFixtureLoader
|
|
199
|
+
|
|
200
|
+
# Create fixture from existing data
|
|
201
|
+
creator = FixtureCreator()
|
|
202
|
+
manifest = creator.create_fixture(
|
|
203
|
+
fixture_id="test-users-100",
|
|
204
|
+
namespace="USER",
|
|
205
|
+
output_dir="./fixtures/test-users-100"
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
# Load fixture in tests (10K rows in <10 seconds)
|
|
209
|
+
loader = DATFixtureLoader()
|
|
210
|
+
result = loader.load_fixture("./fixtures/test-users-100")
|
|
211
|
+
print(f"Loaded {len(result.tables_loaded)} tables in {result.elapsed_seconds:.2f}s")
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### CLI Usage
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
# Create fixture
|
|
218
|
+
iris-devtester fixture create --name test-100 --namespace USER --output ./fixtures/test-100
|
|
219
|
+
|
|
220
|
+
# Validate integrity
|
|
221
|
+
iris-devtester fixture validate --fixture ./fixtures/test-100
|
|
222
|
+
|
|
223
|
+
# Load fixture
|
|
224
|
+
iris-devtester fixture load --fixture ./fixtures/test-100
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Example: Performance Monitoring
|
|
228
|
+
|
|
229
|
+
Auto-configure IRIS performance monitoring with resource-aware auto-disable:
|
|
230
|
+
|
|
231
|
+
```python
|
|
232
|
+
from iris_devtools.containers.monitoring import configure_monitoring
|
|
233
|
+
from iris_devtools.containers import IRISContainer
|
|
234
|
+
|
|
235
|
+
with IRISContainer.community() as iris:
|
|
236
|
+
conn = iris.get_connection()
|
|
237
|
+
|
|
238
|
+
# Zero-config monitoring setup
|
|
239
|
+
success, message = configure_monitoring(conn)
|
|
240
|
+
print(f"Monitoring configured: {message}")
|
|
241
|
+
|
|
242
|
+
# Automatically disables monitoring if CPU > 90%
|
|
243
|
+
# Automatically re-enables when CPU < 85%
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Architecture
|
|
247
|
+
|
|
248
|
+
Built on proven foundations:
|
|
249
|
+
- **testcontainers-python**: Industry-standard container management
|
|
250
|
+
- **testcontainers-iris-python** (caretdev): IRIS-specific extensions
|
|
251
|
+
- **Battle-tested code**: Extracted from production RAG (Retrieval-Augmented Generation) systems
|
|
252
|
+
|
|
253
|
+
## Constitution
|
|
254
|
+
|
|
255
|
+
This library follows [8 core principles](https://github.com/intersystems-community/iris-devtools/blob/main/CONSTITUTION.md) learned through production experience:
|
|
256
|
+
|
|
257
|
+
1. **Automatic Remediation Over Manual Intervention** - No "run this command" errors
|
|
258
|
+
2. **DBAPI First, JDBC Fallback** - Always use the fastest option
|
|
259
|
+
3. **Isolation by Default** - Each test gets its own database
|
|
260
|
+
4. **Zero Configuration Viable** - `pip install && pytest` just works
|
|
261
|
+
5. **Fail Fast with Guidance** - Clear errors with fix instructions
|
|
262
|
+
6. **Enterprise Ready, Community Friendly** - Both editions supported
|
|
263
|
+
7. **Medical-Grade Reliability** - 95%+ test coverage, all error paths tested
|
|
264
|
+
8. **Document the Blind Alleys** - Learn from our mistakes
|
|
265
|
+
|
|
266
|
+
## Documentation
|
|
267
|
+
|
|
268
|
+
- [Troubleshooting Guide](https://github.com/intersystems-community/iris-devtools/blob/main/docs/TROUBLESHOOTING.md)
|
|
269
|
+
- [Codified Learnings](https://github.com/intersystems-community/iris-devtools/blob/main/docs/learnings/) - Our hard-won knowledge
|
|
270
|
+
- [Examples](https://github.com/intersystems-community/iris-devtools/blob/main/examples/) - Runnable code samples
|
|
271
|
+
|
|
272
|
+
## Real-World Use Cases
|
|
273
|
+
|
|
274
|
+
### Use Case 1: CI/CD (Continuous Integration/Continuous Deployment) Testing
|
|
275
|
+
```yaml
|
|
276
|
+
# .github/workflows/test.yml
|
|
277
|
+
- name: Run tests
|
|
278
|
+
run: |
|
|
279
|
+
pip install iris-devtester[all]
|
|
280
|
+
pytest # IRIS spins up automatically!
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Use Case 2: Local Development
|
|
284
|
+
```python
|
|
285
|
+
# Start coding immediately - no setup!
|
|
286
|
+
from iris_devtools.connections import get_iris_connection
|
|
287
|
+
|
|
288
|
+
conn = get_iris_connection() # Auto-discovers or starts container
|
|
289
|
+
# Code your features...
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Use Case 3: Enterprise Production Testing
|
|
293
|
+
```python
|
|
294
|
+
# Test against real enterprise features
|
|
295
|
+
with IRISContainer.enterprise(
|
|
296
|
+
license_key="/path/to/iris.key",
|
|
297
|
+
image="containers.intersystems.com/intersystems/iris:latest"
|
|
298
|
+
) as iris:
|
|
299
|
+
# Test mirrors, sharding, etc.
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## Performance
|
|
303
|
+
|
|
304
|
+
Benchmarks on MacBook Pro M1:
|
|
305
|
+
- Container startup: ~5 seconds
|
|
306
|
+
- DBAPI connection: ~80ms
|
|
307
|
+
- JDBC connection: ~250ms
|
|
308
|
+
- Schema reset: <5 seconds
|
|
309
|
+
- Test isolation overhead: <100ms per test class
|
|
310
|
+
|
|
311
|
+
## Requirements
|
|
312
|
+
|
|
313
|
+
- Python 3.9+
|
|
314
|
+
- Docker (for testcontainers)
|
|
315
|
+
- InterSystems IRIS (Community or Enterprise)
|
|
316
|
+
|
|
317
|
+
## AI-Assisted Development
|
|
318
|
+
|
|
319
|
+
This project is optimized for AI coding assistants:
|
|
320
|
+
|
|
321
|
+
- **[AGENTS.md](AGENTS.md)** - Vendor-neutral AI configuration (build commands, CI/CD)
|
|
322
|
+
- **[CLAUDE.md](CLAUDE.md)** - Claude Code-specific context and patterns
|
|
323
|
+
- **[.cursorrules](.cursorrules)** - Cursor IDE configuration
|
|
324
|
+
- **Comprehensive examples** - All examples include expected outputs
|
|
325
|
+
- **Structured documentation** - Clear architecture, conventions, and troubleshooting
|
|
326
|
+
|
|
327
|
+
## Contributing
|
|
328
|
+
|
|
329
|
+
We welcome contributions! This library embodies real production experience. If you've solved an IRIS infrastructure problem, please contribute it so others don't repeat the same journey.
|
|
330
|
+
|
|
331
|
+
See [CONTRIBUTING.md](https://github.com/intersystems-community/iris-devtools/blob/main/CONTRIBUTING.md) for guidelines.
|
|
332
|
+
|
|
333
|
+
## Credits
|
|
334
|
+
|
|
335
|
+
Built on the shoulders of giants:
|
|
336
|
+
- **caretdev/testcontainers-iris-python** - IRIS testcontainers foundation
|
|
337
|
+
- **testcontainers/testcontainers-python** - Container lifecycle management
|
|
338
|
+
- **InterSystems** - IRIS database platform
|
|
339
|
+
|
|
340
|
+
Special thanks to all the developers who debugged these issues so you don't have to.
|
|
341
|
+
|
|
342
|
+
## License
|
|
343
|
+
|
|
344
|
+
MIT License - See [LICENSE](https://github.com/intersystems-community/iris-devtools/blob/main/LICENSE)
|
|
345
|
+
|
|
346
|
+
## Support
|
|
347
|
+
|
|
348
|
+
- [GitHub Issues](https://github.com/intersystems-community/iris-devtools/issues)
|
|
349
|
+
- [Documentation](https://github.com/intersystems-community/iris-devtools#readme)
|
|
350
|
+
- [Stack Overflow](https://stackoverflow.com/questions/tagged/intersystems-iris) (tag: intersystems-iris)
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
**Remember**: Every feature here was paid for with real debugging time. Use this library to stand on our shoulders, not repeat our mistakes. 🚀
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
# IRIS DevTools
|
|
2
|
+
|
|
3
|
+
**Battle-tested InterSystems IRIS infrastructure utilities for Python development**
|
|
4
|
+
|
|
5
|
+
[](https://badge.fury.io/py/iris-devtester)
|
|
6
|
+
[](https://pypi.org/project/iris-devtester/)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
[](https://github.com/intersystems-community/iris-devtools)
|
|
9
|
+
|
|
10
|
+
## What is This?
|
|
11
|
+
|
|
12
|
+
IRIS DevTools is a comprehensive Python package that provides **automatic, reliable, production-tested** infrastructure for InterSystems IRIS development. Born from years of production experience and hundreds of hours debugging IRIS + Docker + Python integration issues, this library codifies all the hard-won lessons into a reusable package.
|
|
13
|
+
|
|
14
|
+
## The Problem It Solves
|
|
15
|
+
|
|
16
|
+
Ever experienced these?
|
|
17
|
+
- ❌ "Password change required" errors breaking your tests
|
|
18
|
+
- ❌ Port conflicts when running tests in parallel
|
|
19
|
+
- ❌ Tests polluting each other's data
|
|
20
|
+
- ❌ "Works on my machine" but fails in CI
|
|
21
|
+
- ❌ Spending hours debugging IRIS connection issues
|
|
22
|
+
- ❌ Copying infrastructure code between projects
|
|
23
|
+
|
|
24
|
+
**IRIS DevTools fixes all of these automatically.**
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
### Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Basic installation
|
|
32
|
+
pip install iris-devtester
|
|
33
|
+
|
|
34
|
+
# With DBAPI support (recommended - 3x faster)
|
|
35
|
+
pip install iris-devtester[dbapi]
|
|
36
|
+
|
|
37
|
+
# With all features
|
|
38
|
+
pip install iris-devtester[all]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Zero-Config Usage
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from iris_devtools.containers import IRISContainer
|
|
45
|
+
|
|
46
|
+
# That's it! No configuration needed.
|
|
47
|
+
with IRISContainer.community() as iris:
|
|
48
|
+
conn = iris.get_connection()
|
|
49
|
+
cursor = conn.cursor()
|
|
50
|
+
cursor.execute("SELECT $ZVERSION")
|
|
51
|
+
print(cursor.fetchone())
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Pytest Integration
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
# conftest.py
|
|
58
|
+
from iris_devtools.testing import iris_test_fixture
|
|
59
|
+
import pytest
|
|
60
|
+
|
|
61
|
+
@pytest.fixture(scope="module")
|
|
62
|
+
def iris_db():
|
|
63
|
+
return iris_test_fixture()
|
|
64
|
+
|
|
65
|
+
# test_example.py
|
|
66
|
+
def test_my_feature(iris_db):
|
|
67
|
+
conn, state = iris_db
|
|
68
|
+
cursor = conn.cursor()
|
|
69
|
+
cursor.execute("SELECT 1")
|
|
70
|
+
assert cursor.fetchone()[0] == 1
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Run tests:
|
|
74
|
+
```bash
|
|
75
|
+
pytest # Just works! 🎉
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Key Features
|
|
79
|
+
|
|
80
|
+
### 🔐 Automatic Password Management
|
|
81
|
+
- Detects "Password change required" errors
|
|
82
|
+
- Automatically resets passwords via Docker
|
|
83
|
+
- Transparent retry - your code never knows it happened
|
|
84
|
+
|
|
85
|
+
### 🐳 Testcontainers Integration
|
|
86
|
+
- Each test suite gets isolated IRIS instance
|
|
87
|
+
- Automatic cleanup (even on crashes)
|
|
88
|
+
- No port conflicts
|
|
89
|
+
- No test data pollution
|
|
90
|
+
|
|
91
|
+
### ⚡ DBAPI-First Performance
|
|
92
|
+
- Automatically uses fastest connection method
|
|
93
|
+
- DBAPI (Database API): 3x faster than JDBC (Java Database Connectivity)
|
|
94
|
+
- Falls back to JDBC if DBAPI unavailable
|
|
95
|
+
- All transparent to your code
|
|
96
|
+
|
|
97
|
+
### 📦 DAT Fixture Management
|
|
98
|
+
- Create reproducible test fixtures from IRIS tables
|
|
99
|
+
- 10-100x faster than programmatic data creation
|
|
100
|
+
- SHA256 checksum validation for data integrity
|
|
101
|
+
- Load 10K rows in <10 seconds
|
|
102
|
+
- CLI commands for create, load, validate
|
|
103
|
+
|
|
104
|
+
### 📊 Performance Monitoring
|
|
105
|
+
- Auto-configure ^SystemPerformance monitoring
|
|
106
|
+
- Task Manager integration for scheduled monitoring
|
|
107
|
+
- Resource-aware auto-disable under high load
|
|
108
|
+
- Automatic re-enable when resources recover
|
|
109
|
+
- Zero-config monitoring setup
|
|
110
|
+
|
|
111
|
+
### 🧪 Production-Ready Testing
|
|
112
|
+
- Schema validation & auto-reset
|
|
113
|
+
- Test data isolation
|
|
114
|
+
- Pre-flight checks
|
|
115
|
+
- Medical-grade reliability (94%+ coverage)
|
|
116
|
+
|
|
117
|
+
### 📦 Zero Configuration
|
|
118
|
+
- Sensible defaults
|
|
119
|
+
- Auto-discovery of IRIS instances
|
|
120
|
+
- Environment variable overrides
|
|
121
|
+
- Works with both Community & Enterprise editions
|
|
122
|
+
|
|
123
|
+
## Example: Enterprise Setup
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
from iris_devtools.containers import IRISContainer
|
|
127
|
+
|
|
128
|
+
# Auto-discovers license from ~/.iris/iris.key
|
|
129
|
+
with IRISContainer.enterprise(namespace="PRODUCTION") as iris:
|
|
130
|
+
conn = iris.get_connection()
|
|
131
|
+
# Use your enterprise IRIS instance
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Example: DAT Fixtures
|
|
135
|
+
|
|
136
|
+
Create reproducible test fixtures 10-100x faster than programmatic data creation:
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
from iris_devtools.fixtures import FixtureCreator, DATFixtureLoader
|
|
140
|
+
|
|
141
|
+
# Create fixture from existing data
|
|
142
|
+
creator = FixtureCreator()
|
|
143
|
+
manifest = creator.create_fixture(
|
|
144
|
+
fixture_id="test-users-100",
|
|
145
|
+
namespace="USER",
|
|
146
|
+
output_dir="./fixtures/test-users-100"
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
# Load fixture in tests (10K rows in <10 seconds)
|
|
150
|
+
loader = DATFixtureLoader()
|
|
151
|
+
result = loader.load_fixture("./fixtures/test-users-100")
|
|
152
|
+
print(f"Loaded {len(result.tables_loaded)} tables in {result.elapsed_seconds:.2f}s")
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### CLI Usage
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# Create fixture
|
|
159
|
+
iris-devtester fixture create --name test-100 --namespace USER --output ./fixtures/test-100
|
|
160
|
+
|
|
161
|
+
# Validate integrity
|
|
162
|
+
iris-devtester fixture validate --fixture ./fixtures/test-100
|
|
163
|
+
|
|
164
|
+
# Load fixture
|
|
165
|
+
iris-devtester fixture load --fixture ./fixtures/test-100
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Example: Performance Monitoring
|
|
169
|
+
|
|
170
|
+
Auto-configure IRIS performance monitoring with resource-aware auto-disable:
|
|
171
|
+
|
|
172
|
+
```python
|
|
173
|
+
from iris_devtools.containers.monitoring import configure_monitoring
|
|
174
|
+
from iris_devtools.containers import IRISContainer
|
|
175
|
+
|
|
176
|
+
with IRISContainer.community() as iris:
|
|
177
|
+
conn = iris.get_connection()
|
|
178
|
+
|
|
179
|
+
# Zero-config monitoring setup
|
|
180
|
+
success, message = configure_monitoring(conn)
|
|
181
|
+
print(f"Monitoring configured: {message}")
|
|
182
|
+
|
|
183
|
+
# Automatically disables monitoring if CPU > 90%
|
|
184
|
+
# Automatically re-enables when CPU < 85%
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Architecture
|
|
188
|
+
|
|
189
|
+
Built on proven foundations:
|
|
190
|
+
- **testcontainers-python**: Industry-standard container management
|
|
191
|
+
- **testcontainers-iris-python** (caretdev): IRIS-specific extensions
|
|
192
|
+
- **Battle-tested code**: Extracted from production RAG (Retrieval-Augmented Generation) systems
|
|
193
|
+
|
|
194
|
+
## Constitution
|
|
195
|
+
|
|
196
|
+
This library follows [8 core principles](https://github.com/intersystems-community/iris-devtools/blob/main/CONSTITUTION.md) learned through production experience:
|
|
197
|
+
|
|
198
|
+
1. **Automatic Remediation Over Manual Intervention** - No "run this command" errors
|
|
199
|
+
2. **DBAPI First, JDBC Fallback** - Always use the fastest option
|
|
200
|
+
3. **Isolation by Default** - Each test gets its own database
|
|
201
|
+
4. **Zero Configuration Viable** - `pip install && pytest` just works
|
|
202
|
+
5. **Fail Fast with Guidance** - Clear errors with fix instructions
|
|
203
|
+
6. **Enterprise Ready, Community Friendly** - Both editions supported
|
|
204
|
+
7. **Medical-Grade Reliability** - 95%+ test coverage, all error paths tested
|
|
205
|
+
8. **Document the Blind Alleys** - Learn from our mistakes
|
|
206
|
+
|
|
207
|
+
## Documentation
|
|
208
|
+
|
|
209
|
+
- [Troubleshooting Guide](https://github.com/intersystems-community/iris-devtools/blob/main/docs/TROUBLESHOOTING.md)
|
|
210
|
+
- [Codified Learnings](https://github.com/intersystems-community/iris-devtools/blob/main/docs/learnings/) - Our hard-won knowledge
|
|
211
|
+
- [Examples](https://github.com/intersystems-community/iris-devtools/blob/main/examples/) - Runnable code samples
|
|
212
|
+
|
|
213
|
+
## Real-World Use Cases
|
|
214
|
+
|
|
215
|
+
### Use Case 1: CI/CD (Continuous Integration/Continuous Deployment) Testing
|
|
216
|
+
```yaml
|
|
217
|
+
# .github/workflows/test.yml
|
|
218
|
+
- name: Run tests
|
|
219
|
+
run: |
|
|
220
|
+
pip install iris-devtester[all]
|
|
221
|
+
pytest # IRIS spins up automatically!
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Use Case 2: Local Development
|
|
225
|
+
```python
|
|
226
|
+
# Start coding immediately - no setup!
|
|
227
|
+
from iris_devtools.connections import get_iris_connection
|
|
228
|
+
|
|
229
|
+
conn = get_iris_connection() # Auto-discovers or starts container
|
|
230
|
+
# Code your features...
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Use Case 3: Enterprise Production Testing
|
|
234
|
+
```python
|
|
235
|
+
# Test against real enterprise features
|
|
236
|
+
with IRISContainer.enterprise(
|
|
237
|
+
license_key="/path/to/iris.key",
|
|
238
|
+
image="containers.intersystems.com/intersystems/iris:latest"
|
|
239
|
+
) as iris:
|
|
240
|
+
# Test mirrors, sharding, etc.
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## Performance
|
|
244
|
+
|
|
245
|
+
Benchmarks on MacBook Pro M1:
|
|
246
|
+
- Container startup: ~5 seconds
|
|
247
|
+
- DBAPI connection: ~80ms
|
|
248
|
+
- JDBC connection: ~250ms
|
|
249
|
+
- Schema reset: <5 seconds
|
|
250
|
+
- Test isolation overhead: <100ms per test class
|
|
251
|
+
|
|
252
|
+
## Requirements
|
|
253
|
+
|
|
254
|
+
- Python 3.9+
|
|
255
|
+
- Docker (for testcontainers)
|
|
256
|
+
- InterSystems IRIS (Community or Enterprise)
|
|
257
|
+
|
|
258
|
+
## AI-Assisted Development
|
|
259
|
+
|
|
260
|
+
This project is optimized for AI coding assistants:
|
|
261
|
+
|
|
262
|
+
- **[AGENTS.md](AGENTS.md)** - Vendor-neutral AI configuration (build commands, CI/CD)
|
|
263
|
+
- **[CLAUDE.md](CLAUDE.md)** - Claude Code-specific context and patterns
|
|
264
|
+
- **[.cursorrules](.cursorrules)** - Cursor IDE configuration
|
|
265
|
+
- **Comprehensive examples** - All examples include expected outputs
|
|
266
|
+
- **Structured documentation** - Clear architecture, conventions, and troubleshooting
|
|
267
|
+
|
|
268
|
+
## Contributing
|
|
269
|
+
|
|
270
|
+
We welcome contributions! This library embodies real production experience. If you've solved an IRIS infrastructure problem, please contribute it so others don't repeat the same journey.
|
|
271
|
+
|
|
272
|
+
See [CONTRIBUTING.md](https://github.com/intersystems-community/iris-devtools/blob/main/CONTRIBUTING.md) for guidelines.
|
|
273
|
+
|
|
274
|
+
## Credits
|
|
275
|
+
|
|
276
|
+
Built on the shoulders of giants:
|
|
277
|
+
- **caretdev/testcontainers-iris-python** - IRIS testcontainers foundation
|
|
278
|
+
- **testcontainers/testcontainers-python** - Container lifecycle management
|
|
279
|
+
- **InterSystems** - IRIS database platform
|
|
280
|
+
|
|
281
|
+
Special thanks to all the developers who debugged these issues so you don't have to.
|
|
282
|
+
|
|
283
|
+
## License
|
|
284
|
+
|
|
285
|
+
MIT License - See [LICENSE](https://github.com/intersystems-community/iris-devtools/blob/main/LICENSE)
|
|
286
|
+
|
|
287
|
+
## Support
|
|
288
|
+
|
|
289
|
+
- [GitHub Issues](https://github.com/intersystems-community/iris-devtools/issues)
|
|
290
|
+
- [Documentation](https://github.com/intersystems-community/iris-devtools#readme)
|
|
291
|
+
- [Stack Overflow](https://stackoverflow.com/questions/tagged/intersystems-iris) (tag: intersystems-iris)
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
**Remember**: Every feature here was paid for with real debugging time. Use this library to stand on our shoulders, not repeat our mistakes. 🚀
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""
|
|
2
|
+
IRIS DevTools - Battle-tested InterSystems IRIS infrastructure utilities.
|
|
3
|
+
|
|
4
|
+
This package provides automatic, reliable infrastructure for IRIS development:
|
|
5
|
+
- Testcontainers integration with auto-remediation
|
|
6
|
+
- Connection management (DBAPI-first, JDBC fallback)
|
|
7
|
+
- Automatic password reset
|
|
8
|
+
- Testing utilities (pytest fixtures, schema management)
|
|
9
|
+
- Zero-configuration defaults
|
|
10
|
+
|
|
11
|
+
Quick Start:
|
|
12
|
+
>>> from iris_devtester.containers import IRISContainer
|
|
13
|
+
>>> with IRISContainer.community() as iris:
|
|
14
|
+
... conn = iris.get_connection()
|
|
15
|
+
... cursor = conn.cursor()
|
|
16
|
+
... cursor.execute("SELECT 1")
|
|
17
|
+
... print(cursor.fetchone())
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
__version__ = "1.0.0"
|
|
21
|
+
__author__ = "InterSystems Community"
|
|
22
|
+
__license__ = "MIT"
|
|
23
|
+
|
|
24
|
+
# Convenience imports for common usage
|
|
25
|
+
from iris_devtester.connections import get_connection
|
|
26
|
+
from iris_devtester.containers import IRISContainer
|
|
27
|
+
from iris_devtester.config import IRISConfig
|
|
28
|
+
|
|
29
|
+
__all__ = [
|
|
30
|
+
"__version__",
|
|
31
|
+
"get_connection",
|
|
32
|
+
"IRISContainer",
|
|
33
|
+
"IRISConfig",
|
|
34
|
+
]
|