gramseyer / xdrpp

Home Page:http://xdrpp.github.io/xdrpp/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

# XDRPP with a Python binding

This gives an xdr binding usable in python.  It's primarily a wrapper around the functionality of the c++ version of xdrpp.

In particular, this modification to xdrc generates python classes with the structure laid out in the xdr file, and provides an easy
way to save/load/modify these structures.  There's no meddling with individual bytes, and these structs inherit the typesafety/validation logic
of the underlying xdrpp c++ code.

It does not implement every piece of functionality (only what I have needed), and namespaces are only partially implemented.  If 
you happen to use the library and need something that's missing, let me know and I'll add it.  

The big thing that's missing is running as an rpc server.  Only synchronous rpc clients are implemented.  I also have not implemented
pointers (optionals).

The interface is not always super pythonic (esp. strings and arrays).  Suggestions welcome.

# Build

To use, each xdr file becomes three cython files.
abc.x becomes abc_xdr.pyx, abc_xdr.pxd, and abc_includes.pxd
To build, run ./xdrc --pyx or ./xdrc --pxd or ./xdrc --pxdi , respectively.
Limitations on how cython deals with references means that 
unions need a few extra methods in the .hh file.
.hh files should also therefore be generated using ./xdrc --hh --hhpy (i.e. add the --hhpy flag)

Designed for python3.8.  YMMV on other versions of python.

To build, generate the above cython files and .hh files, then cythonize them into an importable python module.
An example build script is included in setup.py (this should be copied into the directory where the cython
files are built).  Example usage: 'python3 setup.py build_ext --inplace (-j 4) --pyx_files="$(PYX_FILES)"', where $(PYX_FILES)
lists only the .pyx files.

This will output a number of python modules to the local directory.  Python shells or scripts run from this directory will be
able to import modules (filename)_xdr, i.e. 'from abc_xdr import *' .


# XDRPP README:



# To build from a release that already has a configure file:

    ./configure
    make

# Documentation

Documentation is available on-line at the project home page,
<http://xdrpp.github.io/xdrpp/>.

To generate and view a local copy of the documentation, run:

    doxygen
    xdg-open doc/html/index.html

Finally, if you have neither an Internet connection nor doxygen, a
copy of the documentation can also be found in the `gh-pages` branch
of the repository, which you can access as:

    git archive --prefix=www/ origin/gh-pages | bsdtar xf -
    xdg-open www/index.html

# Building

To build after a git checkout that doesn't have ./configure, run:

    ./autogen.sh
    ./configure
    make

As is traditional, the software can be installed with

    make install

# To enable the cereal test

You need cereal in the top directory (before running `./configure`),
which you can get by running:

    git clone https://github.com/USCiLab/cereal.git

(Or make cereal a symlink to an already checked out copy.)

# To enable autocheck tests

You need autocheck in the top directory.  Run:

    git clone https://github.com/thejohnfreeman/autocheck.git

(Or make autocheck a symlink to an already checked out copy.)

About

http://xdrpp.github.io/xdrpp/index.html

License:Other


Languages

Language:C++ 80.0%Language:M4 8.1%Language:C 4.5%Language:RPC 3.7%Language:Yacc 2.3%Language:Makefile 1.2%Language:Shell 0.1%Language:Python 0.1%