Registry / testing / cosmic-ray

cosmic-ray

JSON →
library8.4.6pypypi✓ verified 86d ago

Cosmic Ray is a mutation testing tool for Python. It runs tests against mutated versions of your code to assess test suite quality. Current version 8.4.6. Release cadence is irregular with several minor releases per year.

pip install cosmic-ray
INSTALL
IMPORT
SIG · COSMIC-RAY
C
cosmic-ray
testingpythonv8.4.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

main
from cosmic_ray.cli import main
from cosmic_ray import main
main is in the cli submodule, not top-level

Quickstart: Run cosmic-ray mutation testing on a module using pytest as the test runner.

from cosmic_ray.cli import main import sys # Run mutation test on a specific module sys.argv = ['cosmic-ray', '--baseline=10', 'test', '--tests', 'pytest', '--executor', 'local', 'my_module.py'] main()
cosmic-ray --version
Debug
Known issues
breakingIn version 8.0.0, the CLI command structure changed from `cosmic-ray <subcommand>` to `cosmic-ray <subcommand> ...` with different argument order. Old scripts using positional arguments will break.
fix
Update to new CLI syntax: `cosmic-ray test --tests pytest --executor local my_module.py`
affects: <8.0.0
deprecatedThe `--baseline` option is deprecated in version 8.4.0 and may be removed in future versions. Use `--timeout` instead.
fix
Replace `--baseline` with `--timeout` (value in seconds).
affects: >=8.4.0
gotchaCosmic Ray requires an executor (local, celery, etc.). Default is not set; you must specify `--executor local` or configure one.
fix
Always include `--executor local` for local execution.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'cosmic_ray'
Package name on PyPI is 'cosmic-ray' (with a dash), but the import uses underscore.
fix
Install with pip: `pip install cosmic-ray`. Import with: `import cosmic_ray`.
NameError: name 'main' is not defined
The main entry point is in the cli submodule, not at the package root.
fix
Use `from cosmic_ray.cli import main` instead of `from cosmic_ray import main`.
Upgrade
Version history
8.4.6latest on PyPI · released Apr 2, 2026
Audit
Dependencies
pytestoptionalRequired for running tests with pytest plugin
Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
cosmic-ray — pip install cosmic-ray · libregistry