Metadata-Version: 2.4
Name: causal_testing_framework
Version: 13.2.0
Summary: A framework for causal testing using causal directed acyclic graphs.
Author: The CITCOM team
License: MIT
Project-URL: Bug_Tracker, https://github.com/CITCOM-project/CausalTestingFramework/issues
Project-URL: Documentation, https://causal-testing-framework.readthedocs.io/
Project-URL: Source, https://github.com/CITCOM-project/CausalTestingFramework
Keywords: causal inference,verification
Requires-Python: <3.14,>=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: lifelines~=0.30.0
Requires-Dist: networkx<3.5,>=3.4
Requires-Dist: numpy<=2.2.0,>=1.2.6
Requires-Dist: pandas>=2.1
Requires-Dist: scikit_learn~=1.4
Requires-Dist: scipy<=1.16.2,>=1.12.0
Requires-Dist: statsmodels~=0.14
Requires-Dist: tabulate~=0.9
Requires-Dist: pydot~=2.0
Requires-Dist: pygad~=3.3
Requires-Dist: deap~=1.4.1
Requires-Dist: sympy~=1.13.1
Requires-Dist: pyarrow~=19.0.1
Requires-Dist: fastparquet~=2024.11.0
Requires-Dist: tqdm~=4.67.1
Provides-Extra: dev
Requires-Dist: astroid==3.3.8; extra == "dev"
Requires-Dist: isort; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pylint; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: autoapi; extra == "dev"
Requires-Dist: myst-parser; extra == "dev"
Requires-Dist: sphinx; extra == "dev"
Requires-Dist: sphinx-autoapi; extra == "dev"
Requires-Dist: sphinx_rtd_theme; extra == "dev"
Requires-Dist: nbsphinx; extra == "dev"
Requires-Dist: ipykernel; extra == "dev"
Requires-Dist: pandoc; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: tox; extra == "dev"
Provides-Extra: test
Requires-Dist: covasim~=3.0.7; extra == "test"
Dynamic: license-file

# Causal Testing Framework
### A Causal Inference-Driven Software Testing Framework


[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
![example workflow](https://github.com/CITCOM-project/CausalTestingFramework/actions/workflows/ci-tests.yaml/badge.svg)
[![codecov](https://codecov.io/gh/CITCOM-project/CausalTestingFramework/branch/main/graph/badge.svg?token=04ijFVrb4a)](https://codecov.io/gh/CITCOM-project/CausalTestingFramework)
[![Documentation Status](https://readthedocs.org/projects/causal-testing-framework/badge/?version=latest)](https://causal-testing-framework.readthedocs.io/en/latest/?badge=latest)
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/CITCOM-project/CausalTestingFramework)
![Dynamic TOML Badge](https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2FCITCOM-project%2FCausalTestingFramework%2Fmain%2Fpyproject.toml&query=%24.project%5B'requires-python'%5D&label=python)
![PyPI - Version](https://img.shields.io/pypi/v/causal-testing-framework)
[![conda-forge](https://img.shields.io/conda/v/conda-forge/causal-testing-framework.svg)](https://anaconda.org/conda-forge/causal-testing-framework)
![GitHub License](https://img.shields.io/github/license/CITCOM-project/CausalTestingFramework)
[![DOI](https://joss.theoj.org/papers/10.21105/joss.07739/status.svg)](https://doi.org/10.21105/joss.07739)
[![DOI](https://img.shields.io/badge/doi-10.26180/5c6e1160b8d8a-blue.svg?style=flat&labelColor=whitesmoke&logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAAB8AAAAfCAYAAAAfrhY5AAAJsklEQVR42qWXd1DTaRrHf%2BiB2Hdt5zhrAUKz4IKEYu9IGiGFFJJQ0gkJCAKiWFDWBRdFhCQUF3UVdeVcRQEBxUI3yY9iEnQHb3bdW1fPubnyz%2F11M7lvEHfOQee2ZOYzPyDv%2B3yf9%2Fk95YX4fx%2BltfUt08GcFEuPR4U9hDDZ%2FVngIlhb%2FSiI6InkTgLzgDcgfvtnovhH4BzoVlrbwr55QnhCtBW4QHXnFrZbPBaQoBh4%2FSYH2EnpBEtqcDMVzB93wA%2F8AFwa23XFGcc8CkT3mxz%2Bf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%3D)](http://doi.org/10.15131/shef.data.24427516.v2)

The Causal Testing Framework is composed of a causal inference-driven architecture designed for functional black-box testing.
It leverages graphical causal inference (CI) techniques to specify and evaluate software behaviour from a black-box perspective.
Within this framework, causal directed acyclic graphs (DAGs) are used to represent the expected cause–effect relationships between
the inputs and outputs of the system under test, supported by mathematical foundations for designing statistical procedures that
enable causal inference. Each causal test case targets the causal effect of a specific intervention on the system under test--that is,
a deliberate modification to the input configuration expected to produce a corresponding change in one or more outputs.

![Causal Testing Workflow](images/schematic-dark.png#gh-dark-mode-only)
![Causal Testing Workflow](images/schematic.png#gh-light-mode-only)

## Installation

### Requirements
- Python 3.10, 3.11, 3.12 and 3.13

### Recommended: Install from conda-forge

**We recommend using conda or mamba for installation**, as they provide better dependency management and environment isolation, particularly for scientific computing workflows.

First, create a new conda environment with a supported Python version, e.g:
```shell
conda create -n causal-testing-env python=3.13
conda activate causal-testing-env
```

> **Note:** If you have [Miniforge](https://conda-forge.org/download/) installed, you can replace `conda` with `mamba` in any of the commands below for faster package resolution.

Add the `conda-forge` channel:
```shell
conda config --add channels conda-forge
conda config --set channel_priority strict
```

Install `causal-testing-framework`:
```shell
conda install causal-testing-framework
```

### Alternative: Install from PyPI

If you prefer using pip or need the development packages, you can install from PyPI:

``pip install causal-testing-framework``

or if you want to install with the development packages/tools:

``pip install causal-testing-framework[dev]``

### For Developers/Contributors: Install from source

If you're planning to contribute to the project or need an editable installation for development, you can install directly from source:
```shell
git clone https://github.com/CITCOM-project/CausalTestingFramework
cd CausalTestingFramework
```
then to install a specific release:
```shell
git fetch --all --tags --prune
git checkout tags/<tag> -b <branch>
pip install . # For core API only
pip install -e . # For editable install, useful for development work
```
For more information on how to use the Causal Testing Framework, please refer to our [documentation](https://causal-testing-framework.readthedocs.io/en/latest/?badge=latest).

>[!NOTE]
>We recommend you use a 64-bit OS (standard in most modern machines) as we have had reports of the installation crashing on legacy 32-bit Debian systems.

## Usage
>[!NOTE]
> Step-by-step tutorials can be found on our [documentation](https://causal-testing-framework.readthedocs.io/en/latest/tutorials.html).

1. To run the causal testing framework, you need some runtime data from your system, some causal test cases, and a causal DAG that specifies the expected causal relationships between the variables in your runtime data (and any other relevant variables that are _not_ recorded in the data but are known to be relevant).

2. If you do not already have causal test cases, you can convert your causal DAG to causal tests by running the following command.
```
python -m causal_testing generate --dag_path $PATH_TO_DAG --output_path $PATH_TO_TESTS
```

3. You can now execute your tests by running the following command.
```
python -m causal_testing test --dag_path $PATH_TO_DAG --data_paths $PATH_TO_DATA --test_config $PATH_TO_TESTS --output $OUTPUT
```
The results will be saved for inspection in a JSON file located at `$OUTPUT`.
In the future, we hope to add a visualisation tool to assist with this.

## How to Cite
If you use our framework in your work, please cite the following:

``This research has used version X.Y.Z (software citation) of the
Causal Testing Framework (paper citation).``

The paper citation should be the Causal Testing Framework [paper](https://dl.acm.org/doi/10.1145/3607184),
and the software citation should contain the specific Figshare [DOI](https://orda.shef.ac.uk/articles/software/CITCOM_Software_Release/24427516) of the version used in your work.


<details>
  <summary><b>BibTeX Citations</b></summary>

  <details>
    <summary>Paper</summary>
```
    @ARTICLE{Clark_etal_2023,
    author = {Clark, Andrew G. and Foster, Michael and Prifling, Benedikt and Walkinshaw, Neil and Hierons, Robert M.
    and Schmidt, Volker and Turner, Robert D.},
    title = {Testing Causality in Scientific Modelling Software},
    year = {2023},
    publisher = {Association for Computing Machinery},
    url = {https://doi.org/10.1145/3607184},
    doi = {10.1145/3607184},
    journal = {ACM Trans. Softw. Eng. Methodol.},
    month = {jul},
    keywords = {Software Testing, Causal Testing, Causal Inference}
    }
```

  </details>

  <details>
    <summary>Software (example)</summary>
```
    @ARTICLE{Wild2023,
    author = {Foster, Michael and Clark, Andrew G. and Somers, Richard and Wild, Christopher and Allian, Farhad and Hierons, Robert M. and Wagg, David and Walkinshaw, Neil},
    title = {CITCOM Software Release},
    year = {2023},
    month = {nov},
    url = {https://orda.shef.ac.uk/articles/software/CITCOM_Software_Release/24427516},
    doi = {10.15131/shef.data.24427516.v1}
    }
```
  </details>

</details>

## Acknowledgements

The Causal Testing Framework is supported by the UK's Engineering and Physical Sciences Research Council (EPSRC),
with the project name [CITCOM](https://gtr.ukri.org/projects?ref=EP%2FT030526%2F1) - "_Causal Inference for Testing of Computational Models_"
under the grant EP/T030526/1.
