Skip to main content

A lightweight validation engine written in rust

Project description

valve.py

VALVE bindings for Python

Install/setup from source

  1. Retrieve valve.py from GitHub:

     git clone git@github.com:ontodev/valve.py.git
     cd valve.py
     make test
    
  2. Activate the virtual environment:

     source valve.rs/.venv/bin/activate
    
  3. Add the statement

     import ontodev_valve
    

    to the top of your python script.

Usage examples

See the file test/main.py for usage examples.

API reference

configure_and_or_load(table_table, db_path, load)

Given a path to a table table file (table.tsv), a directory in which to find/create a database: configure the database using the configuration which can be looked up using the table table, and optionally load it if the load flag is set to true.

Returns the configuration map back as a JSON string.

get_matching_values(config, db_path, table_name, column_name, matching_string)

Given a config map represented as a JSON string, a directory containing the database, the table name and column name from which to retrieve matching values, return a JSON array (represented as a string) of possible valid values for the given column which contain the matching string (optional) as a substring (or all of them if no matching string is given). The JSON array returned is formatted for Typeahead, i.e., it takes the form: [{"id": id, "label": label, "order": order}, ...].

validate_row(config, db_path, table_name, row, existing_row, row_number)

Given a config map represented as a JSON string, a directory in which to find the database, a table name, a row, and if the row already exists in the database, its associated row number (optional), perform both intra- and inter-row validation and return the validated row as a JSON string.

update_row(config, db_path, table_name, row, row_number)

Given a config map represented as a JSON string, a directory in which the database is located, a table name, a row represented as a JSON string, and its associated row number, update the row in the database.

insert_new_row(config, db_path, table_name, row)

Given a config map represented as a JSON string, a directory in which the database is located, a table name, and a row represented as a JSON string, insert the new row to the database.

Before creating a new release

Edit the file VALVE.VERSION and adjust the version of valve.py (and, if necessary, valve.rs). After pushing your commit, create a new release in GitHub with the new version number as the release name and tag.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

ontodev_valve-0.1.13-cp310-cp310-manylinux_2_31_x86_64.whl (4.8 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.31+ x86-64

ontodev_valve-0.1.13-cp310-cp310-macosx_10_7_x86_64.whl (3.4 MB view hashes)

Uploaded CPython 3.10 macOS 10.7+ x86-64

ontodev_valve-0.1.13-cp39-cp39-manylinux_2_31_x86_64.whl (4.8 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.31+ x86-64

ontodev_valve-0.1.13-cp39-cp39-macosx_10_7_x86_64.whl (3.4 MB view hashes)

Uploaded CPython 3.9 macOS 10.7+ x86-64

ontodev_valve-0.1.13-cp38-cp38-manylinux_2_31_x86_64.whl (4.8 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.31+ x86-64

ontodev_valve-0.1.13-cp38-cp38-macosx_10_7_x86_64.whl (3.4 MB view hashes)

Uploaded CPython 3.8 macOS 10.7+ x86-64

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