# Check DVC status from PythonAPI

**URL:** <https://discuss.dvc.org/t/check-dvc-status-from-pythonapi/1673>\
**Category:** Questions\
**Created:** [May 23, 2023, 8:53am UTC](https://discuss.dvc.org/t/check-dvc-status-from-pythonapi/1673 "2023-05-23T08:53:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abahnasy](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@abahnasy](https://discuss.dvc.org/u/abahnasy)\
**Post date:** [May 23, 2023, 8:53am UTC](https://discuss.dvc.org/t/check-dvc-status-from-pythonapi/1673/1 "2023-05-23T08:53:09Z")

</div>

Hi,

I’m wondering if there is an option to check the DVC status of the repo using any of the Python APIs. I’m trying to write a utility function that shall abort training run if any of the tracked data is modified or not tracked.

Thanks

---

<div class="post-metadata">

**Author:** ![dberenbaum](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@dberenbaum](https://discuss.dvc.org/u/dberenbaum)\
**Post date:** [May 23, 2023, 11:49am UTC](https://discuss.dvc.org/t/check-dvc-status-from-pythonapi/1673/2 "2023-05-23T11:49:29Z")

</div>

There is no official API, but you can use the internal Repo API like this:

```python
>>> from dvc.repo import Repo
>>> repo = Repo()
>>> repo.status() # status of the pipeline
{'featurize': [{'changed outs': {'data/features': 'modified'}}], 'train': [{'changed deps': {'data/features': 'modified'}}], 'evaluate': [{'changed deps': {'data/features': 'modified'}}], 'data/data.xml.dvc': [{'changed deps': {'get-started/data.xml (https://github.com/iterative/dataset-registry)': 'update available'}}]}
>>> repo.data_status() # status of data since last git commit
{'not_in_cache': [], 'not_in_remote': [], 'committed': {'modified': ['model.pkl', 'eval/importance.png']}, 'uncommitted': {'modified': ['data/features/']}, 'untracked': [], 'unchanged': ['data/data.xml', 'data/prepared/'], 'git': {'staged': {}, 'unstaged': ['dvc.lock', 'eval/live/plots/sklearn/cm/test.json', 'eval/live/plots/sklearn/cm/train.json', 'eval/live/plots/sklearn/roc/train.json', 'eval/prc/train.json'], 'untracked': [], 'is_empty': False, 'is_dirty': True}}

```
