ahawker / pai-lang

Language for describing resources/relations as shell-safe strings.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pai-lang

PyPI version PyPI versions PyPI downloads Build Status Coverage Status Code Climate Issue Count

Language for describing resources/relations as shell-safe strings.

Status

pai-lang is in alpha stage and not yet used by any production workloads.

Installation

Install pai-lang using pip:

    $ pip install pai_lang

Install pai-lang from source:

    $ git clone git@github.com:ahawker/pai-lang.git
    $ cd pai_lang
    $ python setup.py install

Deployment

Package deployments to index servers are automatically performed by Travis CI.

PyPI - Hosts Official Builds

TestPyPI - Hosts Development Builds

Tagged versions of the master branch will be deployed to the official PyPI index server while non-tagged versions will be deployed to the test PyPI index server.

To kick off a new, official deployment, just run one of the following:

Patch Version Release: Use this when you make backwards-compatible bug fixes.

    $ make push-patch

Minor Version Release: Use this when you add functionality in a backwards-compatible manner.

    $ make push-minor

Major Version Release: Use this when you make incompatible API changes.

    $ make push-major

Usage

pai-lang does not enforce any constraints on the node, relation, and property values.

For this example, lets imagine we're trying to describe a service that deals with:

  • Users
  • Workspaces
  • Workspace Settings

Describe a single resource by its relation to a property value. In layman's terms: "Resolve to a user with the email address foo@bar.com".

    import pai_lang

    >>> pai_lang.parse('user:email:foo@bar.com')
    [<Node(node=user, edge=email, property=foo@bar.com>]

Describe two linked resources by a specific relation. In layman's terms: "Resolve to a workspace (linked by workspace-id) to a user with the email address foo@bar.com"

    import pai_lang

    >>> pai_lang.parse('workspace:workspace-id:user:email:foo@bar.com')
    [<Node(node=user, edge=email, property=foo@bar.com>,
     <Node(node=workspace, edge=workspace-id, property=None>]

Describe two linked resources by any relation. In layman's terms: "Resolve a workspace (linked by any discoverable relation) to a user with the email address foo@bar.com".

    import pai_lang

    >>> pai_lang.parse('workspace:any:user:email:foo@bar.com')
    [<Node(node=user, edge=email, property=foo@bar.com>,
     <Node(node=workspace, edge=any, property=None>]

Describe N (where N=3 in this example) resources by any relation. In layman's terms: "Resolve the settings data (linked by any discoverable relation) to a workspace (linked by any discoverable relation) to a user with the email address foo@bar.com"

    import pai_lang

    >>> pai_lang.parse('settings:any:workspace:any:user:email:foo@bar.com')
    [<Node(node=user, edge=email, property=foo@bar.com>,
     <Node(node=workspace, edge=any, property=None>,
     <Node(node=settings, edge=any, property=None>]

License

Apache 2.0

About

Language for describing resources/relations as shell-safe strings.

License:Apache License 2.0


Languages

Language:Python 96.3%Language:Makefile 3.7%