Skip to main content

a python package for vega-lite lint and quick-fix

Project description

vega-lite-linter

Fixing your visualization design written in Vega-Lite based on the Answer Set Programming.

Setup

Step 1: install Clingo

First, you need to install Clingo.

For MacOS

brew install clingo

Using Conda

conda install -c potassco clingo

For other system, please look up to https://potassco.org/clingo/

Step 2: install vega-lite-linter

pip install vega-lite-linter

Usage

from vega_lite_linter import Lint 

vega_json = {
    "data": {
        "url": "data/cars.json"
    },
    "mark": "bar",
    "encoding": {
        "x": {
            "field": "Horsepower",
            "type": "quantitative"
        },
        "y": {
            "field": "Miles_per_Gallon",
            "type": "quantitative"
        },
        "size": {
            "field": "Cylinders",
            "type": "ordinal"
        }
    }
}

# initialize 
lint = Lint(vega_json)

# show rules that the input vega-lite json violated
violate_rules = lint.lint()

# show fixing recommendation by vega-lite-linter
fix = lint.fix()

License

The software is available under the MIT License.

Contact

If you have any question, feel free to open an issue.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vega-lite-linter-0.0.1.tar.gz (317.6 kB view hashes)

Uploaded source

Built Distribution

vega_lite_linter-0.0.1-py3-none-any.whl (335.2 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page