/PySiddhi

Primary LanguagePythonApache License 2.0Apache-2.0

PySiddhi

You are currently in branch for PySiddhi 4.x

The scope of this project is to develop a Python Wrapper on Siddhi CEP Library. The Python wrapper would support Siddhi 3.1 and Siddhi 4.0. A REST Client is also developed to interact with WSO2 Data Analytics Server (DAS) 4.0.

This is currently a work in progress, as a project for Google Summer of Code 2017 Program.

Note: Currently the API is configured with Siddhi CEP 3.1.0 (in branch 3.x), Siddhi CEP 4.0.0-M53 (in branch master) and WSO2 Data Analytics Server 4.0.0-M6 (in branch master) for Python 2.7.x and Python 3.x

Project Goals

  1. Develop a Python Wrapper on Siddhi Java Library 3.1 and 4.0.
  2. Extend the wrapper to support interactions with WSO2 DAS 4.0.
  3. Testing, Documentation and Deployment

Current Progress

  • Basic features of Siddhi CEP Core 3.1 and 4.0
  • Wrapper on Siddhi Debugger (for PySiddhi4 only)
  • Support to Siddhi Extensions Loading
  • Rest Client on WSO2 DAS 4.0 - Siddhi App Management (for PySiddhi4 only)
  • Rest Client on WSO2 DAS 4.0 Event Simulator (for PySiddhi4 only)
  • Unit Tests
  • Wiki
  • Deployment wheels

Installing the Library from Source

  1. Install following pre-requisites.

    • Python 2.7 or 3.x
    • Requests (sudo apt-get install requests)
    • Cython (sudo apt-get install cython)
    • Pyjnius (sudo pip install pyjnius)
    • Future (sudo pip install future)
    • Python Developer Package (sudo apt-get install python-dev python3-dev python-dev)
    • libboost for Python (sudo apt-get install libboost-python-dev)
    • Maven and Java 8
    • g++ and other development tools
      • sudo apt-get install build-essential g++ autotools-dev libicu-dev build-essential libbz2-dev libboost-all-dev
    • For use of WSO2 DAS 4.0 Client functionality, it is required to have WSO2 DAS 4.0 installed and running. (Refer Running the Tests section for installation details)
  2. Install using Setup.py.

    • Clone the relevant branch (3.1 or 4.0) from GitHub Repository.
    • Navigate to project root and run sudo pip install .
  3. Use the Library using Python.

    • For Siddhi CEP 3.1
    from PySiddhi3.core.SiddhiManager import SiddhiManager
    sm = SiddhiManager()
    ....
    sm.shutdown()
    • For Siddhi CEP 4.0.0-M53
    from PySiddhi4.core.SiddhiManager import SiddhiManager
    sm = SiddhiManager()
    ....
    sm.shutdown()

    *Refer Tests to get more familiar with library functionality.

Running the Tests

  1. Install pre-requisites mentioned in Installing the Library from Source section.
  2. Compile Java Libraries.
    • Navigate to PySiddhi/PySiddhi4Proxy and run mvn clean install
  3. For running tests on WSO2 DAS 4.0 Client, it is required to have WSO2 DAS 4.0 installed and running.
  4. Run the tests cases in PySiddhi/Tests directory

*If mvn clean install throws errors, check the paths provided for imports of Python3 Developer Headers

Creating deployment wheel (for Linux)

  1. Install pre-requisites mentioned in Installing the Library from Source section.
  2. Delete directory build if exist.
  3. Goto source root and run python setup.py bdist_wheel --plat-name manylinux1_x86_64

Note: You need to use linux operating system to build linux wheels.

Creating deployment wheel (for Windows)

  1. Install pre-requisites mentioned in Installing the Library from Source section.
  2. Delete directory build if exist.
  3. Goto source root and run python setup.py bdist_wheel --plat-name win-amd64

Note: You need to use Windows operating system to build Windows wheels.

Installing deployment wheel

  1. Make sure all pre-requisites are met. (You may have to separately install cython using pip install cython if you use virtual environments)
  2. Install python wheel using pip install [path_to_wheel_file].

Background

Siddhi is a Query Language and a Library for Realtime Complex Event Processing developed by WSO2 Inc. Siddhi CEP is currently used in WSO2 Data Analytics Server, an Enterprise Level Open Source Data Analytics Solution.

Further information on above products are available in the links below.

Contributors

Developer Mail Group: dev@wso2.org