Giter Site home page Giter Site logo

underpants's Introduction

underpants - Or, using Pants as an embedded rule engine

DISCLAIMER: This is not in any way to show how to use Pants, or recommended patterns of use. Provided here AS-IS. No gurantees of any kind, as this may break with any future release of Pants.

This is a toy POC testing out the feasability of using the Pants Build System as a rule engine in your Python application.

It's also a test-bed for me to explore the intricacies of rule caching etc.

Expected output along the lines of:

$ ./pants run src/pants_rules/main.py
14:00:05.78 [INFO] Starting: pants_rules.demo.basic.answer_to_life_universe_and_everything
14:00:05.78 [INFO] Starting: pants_rules.demo.basic.reverse_input
== in reverse_input: InputData(text='answer')
14:00:05.78 [INFO] Completed: pants_rules.demo.basic.reverse_input
== data: OutputData(text='rewsna')
14:00:05.78 [INFO] Completed: pants_rules.demo.basic.answer_to_life_universe_and_everything
The result is: SimpleResult(answer=41)
14:00:06.29 [INFO] Starting: pants_rules.demo.basic.answer_to_life_universe_and_everything
== data: OutputData(text='rewsna')
14:00:06.29 [INFO] Completed: pants_rules.demo.basic.answer_to_life_universe_and_everything
The result is: SimpleResult(answer=42)
The result is: ProcResult(code=0, err=None)
The result is: ProcResult(code=1, err="proc 'fail' failed")

License

Provided under the MIT license, as "public domain" is not an OSI approved license.

Lockfile

To update the 3rdparty/requirements.lock file run:

./pants generate-lockfiles

Version

Use at your own peril: version

underpants's People

Contributors

kaos avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.