- CLI entry points live in
ccm/and the core implementation is underccmlib/(cluster lifecycle, node management, command helpers). - Tests are in
tests/and mirror library modules; add new tests alongside the code they cover. - Packaging and install metadata:
setup.py,setup.cfg, and runtime deps inrequirements.txt. Miscellaneous utilities and docs live inmisc/,ssl/, andINSTALL.md.
- Create an isolated environment:
python3 -m venv venv && source venv/bin/activate. - Install runtime deps and editable package:
pip install -r requirements.txt && pip install -e .. - Add test-only deps:
pip install mock pytest requests. - Run tests:
pytest(usepytest tests/test_node.py -k <pattern>for focused runs). Expect integration-like cases that spawn local Cassandra nodes; keep environments clean. - Validate a local install:
ccm --helpto confirm entry points resolve.
- Python-first codebase; follow PEP 8 with 4-space indents and line-length restraint (~100 chars).
- Maintain Python 2.7 and 3.x compatibility where practical; avoid newer syntax that breaks 2.7 and gate version-specific behavior carefully.
- Use descriptive identifiers for nodes/clusters, and align CLI option names with existing verbs/nouns (
create,populate,start, etc.). - Prefer pure functions for helpers; keep side effects (filesystem, subprocess) localized and well-logged.
- Framework: pytest. Name files
test_*.pyand favor small, deterministic cases over long-lived clusters. - When tests need Cassandra binaries, prefer the repository cache (
~/.ccm/repository) to avoid repeated downloads. - Add coverage when touching node lifecycle, logging, or install path resolution; include regression tests reproducing reported issues.
- Use markers or narrow selections for slow tests; do not assume network availability beyond local loopback.
- Commits are short, action-oriented summaries (e.g.,
Improve jdk validation,Fix cleanup when node start fails); keep a single focus per commit. - PRs should describe the change, note risk areas (filesystem writes, subprocess calls), and link related tickets/issues.
- Include how you tested (
pytest, manualccminvocation) and any environment notes (Python version, OS). Screenshots are unnecessary; logs or command transcripts help reviewers.