semvec/pypi-packages huggingface dataset:
mlfarm 0.1.2
Tools for fast development of Machine Learning projects.
Requires Python: >=3.6

[![PyPI version](https://badge.fury.io/py/mlfarm.svg)](https://badge.fury.io/py/mlfarm) [![Documentation Status](https://readthedocs.org/projects/mlfarm/badge/?version=stable)](https://mlfarm.readthedocs.io/en/latest/?badge=stable) [![Build Status](https://dev.azure.com/mlfarm/mlfarm/_apis/build/status/MLFarm.CI.Test?branchName=release)](https://dev.azure.com/mlfarm/mlfarm/_build/latest?definitionId=1&branchName=release)

# MLFarm

This package contains a suite of tools to be used for fast development of new Machine Learning projects.
yaml-error-report 0.1.0
Create console error reports for YAML (and JSON) documents
Requires Python: >=3.7

# yaml-error-report
[![pipeline status](https://gitlab.com/rmcgregor/yaml-error-report/badges/master/pipeline.svg)](https://gitlab.com/rmcgregor/yaml-error-report/commits/master)
[![coverage report](https://gitlab.com/rmcgregor/yaml-error-report/badges/master/coverage.svg)](https://rmcgregor.gitlab.io/yaml-error-report/coverage)


Generate rich console errors reports for YAML (and JSON, since its a YAML subset) documents.
This is aimed at console tools which want to present the user with useful errors messages if a YAML or JSON document fails some internal validation.

Uses PyYaml to extract location (line, column, position in stream) information for nodes in a YAML or JSON document.
This information can then be used to create user friendly error reports.

Can be combined with [jsonschema](https://json-schema.org/), to greatly improve error messages.
See [examples\with_jsonschema](examples\with_jsonschema).


## Installation
```
pip install yaml-error-report

```
## Usage
```yaml
# calc.yml
name: calc

methods:
  - name: sum
    description: "Sums x and y"
    request:
      - name: "x"
        type: Int36
      - name: "y"
        type: Int32
    response: Int32
```

```python
# windows only: needed to make coloured output work
import colorama
colorama.init()

from yaml_error_report import path_to_location, error_report

# extract the text location of the offending node
loc = path_to_location("calc.yml", ["methods", 0, "request", 0, "type"])
# create the error report
error = error_report("YAML Validation Error", "Int36 is not a valid type", loc)
print(error)
```

*outputs (nicely coloured on terminals)*
```
YAML Validation Error
   --> calc.yml:8:14
   7|         - name: "x"
   8|           type: Int36
                      ^^^^^ Int36 is not a valid type
   9|         - name: "y"
  10|           type: Int32
```